LCOV - code coverage report
Current view: top level - libreoffice/canvas/source/null - null_canvashelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 74 0.0 %
Date: 2012-12-27 Functions: 0 33 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <canvas/debug.hxx>
      22             : #include <tools/diagnose_ex.h>
      23             : 
      24             : #include <rtl/logfile.hxx>
      25             : #include <rtl/math.hxx>
      26             : 
      27             : #include <com/sun/star/util/Endianness.hpp>
      28             : #include <com/sun/star/rendering/TexturingMode.hpp>
      29             : #include <com/sun/star/rendering/CompositeOperation.hpp>
      30             : #include <com/sun/star/rendering/RepaintResult.hpp>
      31             : #include <com/sun/star/rendering/PathCapType.hpp>
      32             : #include <com/sun/star/rendering/PathJoinType.hpp>
      33             : 
      34             : #include <basegfx/matrix/b2dhommatrix.hxx>
      35             : #include <basegfx/point/b2dpoint.hxx>
      36             : #include <basegfx/tools/canvastools.hxx>
      37             : 
      38             : #include <comphelper/sequence.hxx>
      39             : #include <canvas/canvastools.hxx>
      40             : 
      41             : #include "null_spritecanvas.hxx"
      42             : #include "null_canvasfont.hxx"
      43             : #include "null_textlayout.hxx"
      44             : #include "null_canvashelper.hxx"
      45             : 
      46             : #include <algorithm>
      47             : 
      48             : 
      49             : using namespace ::com::sun::star;
      50             : 
      51             : namespace nullcanvas
      52             : {
      53           0 :     CanvasHelper::CanvasHelper() :
      54             :         mpDevice( NULL ),
      55             :         maSize(),
      56           0 :         mbHaveAlpha()
      57             :     {
      58           0 :     }
      59             : 
      60           0 :     void CanvasHelper::disposing()
      61             :     {
      62           0 :         mpDevice = NULL;
      63           0 :     }
      64             : 
      65           0 :     void CanvasHelper::init( const ::basegfx::B2ISize& rSize,
      66             :                              SpriteCanvas&             rDevice,
      67             :                              bool                      bHasAlpha )
      68             :     {
      69           0 :         mpDevice = &rDevice;
      70           0 :         maSize = rSize;
      71           0 :         mbHaveAlpha = bHasAlpha;
      72           0 :     }
      73             : 
      74           0 :     void CanvasHelper::clear()
      75             :     {
      76           0 :     }
      77             : 
      78           0 :     void CanvasHelper::drawPoint( const rendering::XCanvas*     /*pCanvas*/,
      79             :                                   const geometry::RealPoint2D&  /*aPoint*/,
      80             :                                   const rendering::ViewState&   /*viewState*/,
      81             :                                   const rendering::RenderState& /*renderState*/ )
      82             :     {
      83           0 :     }
      84             : 
      85           0 :     void CanvasHelper::drawLine( const rendering::XCanvas*      /*pCanvas*/,
      86             :                                  const geometry::RealPoint2D&   /*aPoint1*/,
      87             :                                  const geometry::RealPoint2D&   /*aPoint2*/,
      88             :                                  const rendering::ViewState&    /*viewState*/,
      89             :                                  const rendering::RenderState&  /*renderState*/ )
      90             :     {
      91           0 :     }
      92             : 
      93           0 :     void CanvasHelper::drawBezier( const rendering::XCanvas*            /*pCanvas*/,
      94             :                                    const geometry::RealBezierSegment2D& /*aBezierSegment*/,
      95             :                                    const geometry::RealPoint2D&         /*aEndPoint*/,
      96             :                                    const rendering::ViewState&          /*viewState*/,
      97             :                                    const rendering::RenderState&        /*renderState*/ )
      98             :     {
      99           0 :     }
     100             : 
     101           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas*                          /*pCanvas*/,
     102             :                                                                                  const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
     103             :                                                                                  const rendering::ViewState&                        /*viewState*/,
     104             :                                                                                  const rendering::RenderState&                      /*renderState*/ )
     105             :     {
     106             :         // TODO(P1): Provide caching here.
     107           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     108             :     }
     109             : 
     110           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokePolyPolygon( const rendering::XCanvas*                            /*pCanvas*/,
     111             :                                                                                    const uno::Reference< rendering::XPolyPolygon2D >&   /*xPolyPolygon*/,
     112             :                                                                                    const rendering::ViewState&                          /*viewState*/,
     113             :                                                                                    const rendering::RenderState&                        /*renderState*/,
     114             :                                                                                    const rendering::StrokeAttributes&                   /*strokeAttributes*/ )
     115             :     {
     116             :         // TODO(P1): Provide caching here.
     117           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     118             :     }
     119             : 
     120           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTexturedPolyPolygon( const rendering::XCanvas*                            /*pCanvas*/,
     121             :                                                                                            const uno::Reference< rendering::XPolyPolygon2D >&   /*xPolyPolygon*/,
     122             :                                                                                            const rendering::ViewState&                          /*viewState*/,
     123             :                                                                                            const rendering::RenderState&                        /*renderState*/,
     124             :                                                                                            const uno::Sequence< rendering::Texture >&           /*textures*/,
     125             :                                                                                            const rendering::StrokeAttributes&                   /*strokeAttributes*/ )
     126             :     {
     127             :         // TODO
     128           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     129             :     }
     130             : 
     131           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTextureMappedPolyPolygon( const rendering::XCanvas*                           /*pCanvas*/,
     132             :                                                                                                 const uno::Reference< rendering::XPolyPolygon2D >&  /*xPolyPolygon*/,
     133             :                                                                                                 const rendering::ViewState&                         /*viewState*/,
     134             :                                                                                                 const rendering::RenderState&                       /*renderState*/,
     135             :                                                                                                 const uno::Sequence< rendering::Texture >&          /*textures*/,
     136             :                                                                                                 const uno::Reference< geometry::XMapping2D >&       /*xMapping*/,
     137             :                                                                                                 const rendering::StrokeAttributes&                  /*strokeAttributes*/ )
     138             :     {
     139             :         // TODO
     140           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     141             :     }
     142             : 
     143           0 :     uno::Reference< rendering::XPolyPolygon2D >   CanvasHelper::queryStrokeShapes( const rendering::XCanvas*                            /*pCanvas*/,
     144             :                                                                                    const uno::Reference< rendering::XPolyPolygon2D >&   /*xPolyPolygon*/,
     145             :                                                                                    const rendering::ViewState&                          /*viewState*/,
     146             :                                                                                    const rendering::RenderState&                        /*renderState*/,
     147             :                                                                                    const rendering::StrokeAttributes&                   /*strokeAttributes*/ )
     148             :     {
     149             :         // TODO
     150           0 :         return uno::Reference< rendering::XPolyPolygon2D >(NULL);
     151             :     }
     152             : 
     153           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillPolyPolygon( const rendering::XCanvas*                          /*pCanvas*/,
     154             :                                                                                  const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
     155             :                                                                                  const rendering::ViewState&                        /*viewState*/,
     156             :                                                                                  const rendering::RenderState&                      /*renderState*/ )
     157             :     {
     158             :         // TODO(P1): Provide caching here.
     159           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     160             :     }
     161             : 
     162           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas*                          /*pCanvas*/,
     163             :                                                                                          const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
     164             :                                                                                          const rendering::ViewState&                        /*viewState*/,
     165             :                                                                                          const rendering::RenderState&                      /*renderState*/,
     166             :                                                                                          const uno::Sequence< rendering::Texture >&         /*textures*/ )
     167             :     {
     168             :         // TODO(P1): Provide caching here.
     169           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     170             :     }
     171             : 
     172           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTextureMappedPolyPolygon( const rendering::XCanvas*                             /*pCanvas*/,
     173             :                                                                                               const uno::Reference< rendering::XPolyPolygon2D >&    /*xPolyPolygon*/,
     174             :                                                                                               const rendering::ViewState&                           /*viewState*/,
     175             :                                                                                               const rendering::RenderState&                         /*renderState*/,
     176             :                                                                                               const uno::Sequence< rendering::Texture >&            /*textures*/,
     177             :                                                                                               const uno::Reference< geometry::XMapping2D >&         /*xMapping*/ )
     178             :     {
     179             :         // TODO
     180           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     181             :     }
     182             : 
     183           0 :     uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas*                    /*pCanvas*/,
     184             :                                                                        const rendering::FontRequest&                fontRequest,
     185             :                                                                        const uno::Sequence< beans::PropertyValue >& extraFontProperties,
     186             :                                                                        const geometry::Matrix2D&                    fontMatrix )
     187             :     {
     188             :         return uno::Reference< rendering::XCanvasFont >(
     189           0 :             new CanvasFont(fontRequest, extraFontProperties, fontMatrix ) );
     190             :     }
     191             : 
     192           0 :     uno::Sequence< rendering::FontInfo > CanvasHelper::queryAvailableFonts( const rendering::XCanvas*                       /*pCanvas*/,
     193             :                                                                             const rendering::FontInfo&                      /*aFilter*/,
     194             :                                                                             const uno::Sequence< beans::PropertyValue >&    /*aFontProperties*/ )
     195             :     {
     196             :         // TODO
     197           0 :         return uno::Sequence< rendering::FontInfo >();
     198             :     }
     199             : 
     200           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawText( const rendering::XCanvas*                         /*pCanvas*/,
     201             :                                                                           const rendering::StringContext&                   /*text*/,
     202             :                                                                           const uno::Reference< rendering::XCanvasFont >&   /*xFont*/,
     203             :                                                                           const rendering::ViewState&                       /*viewState*/,
     204             :                                                                           const rendering::RenderState&                     /*renderState*/,
     205             :                                                                           sal_Int8                                          /*textDirection*/ )
     206             :     {
     207           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     208             :     }
     209             : 
     210           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas*                       /*pCanvas*/,
     211             :                                                                                 const uno::Reference< rendering::XTextLayout >& xLayoutetText,
     212             :                                                                                 const rendering::ViewState&                     viewState,
     213             :                                                                                 const rendering::RenderState&                   renderState )
     214             :     {
     215           0 :         ENSURE_OR_THROW( xLayoutetText.is(),
     216             :                           "CanvasHelper::drawTextLayout: layout is NULL");
     217             : 
     218             :         TextLayout* pTextLayout =
     219           0 :             dynamic_cast< TextLayout* >( xLayoutetText.get() );
     220             : 
     221           0 :         ENSURE_OR_THROW( pTextLayout,
     222             :                           "CanvasHelper::drawTextLayout(): TextLayout not compatible with this canvas" );
     223             : 
     224             :         pTextLayout->draw( viewState,
     225             :                            renderState,
     226           0 :                            mpDevice );
     227             : 
     228           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     229             :     }
     230             : 
     231           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmap( const rendering::XCanvas*                   /*pCanvas*/,
     232             :                                                                             const uno::Reference< rendering::XBitmap >& /*xBitmap*/,
     233             :                                                                             const rendering::ViewState&                 /*viewState*/,
     234             :                                                                             const rendering::RenderState&               /*renderState*/ )
     235             :     {
     236             :         // TODO(P1): Provide caching here.
     237           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     238             :     }
     239             : 
     240           0 :     uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas*                      /*pCanvas*/,
     241             :                                                                                      const uno::Reference< rendering::XBitmap >&    /*xBitmap*/,
     242             :                                                                                      const rendering::ViewState&                    /*viewState*/,
     243             :                                                                                      const rendering::RenderState&                  /*renderState*/ )
     244             :     {
     245             :         // TODO(P1): Provide caching here.
     246           0 :         return uno::Reference< rendering::XCachedPrimitive >(NULL);
     247             :     }
     248             : 
     249           0 :     uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice()
     250             :     {
     251           0 :         return uno::Reference< rendering::XGraphicDevice >(mpDevice);
     252             :     }
     253             : 
     254           0 :     void CanvasHelper::copyRect( const rendering::XCanvas*                          /*pCanvas*/,
     255             :                                  const uno::Reference< rendering::XBitmapCanvas >&  /*sourceCanvas*/,
     256             :                                  const geometry::RealRectangle2D&                   /*sourceRect*/,
     257             :                                  const rendering::ViewState&                        /*sourceViewState*/,
     258             :                                  const rendering::RenderState&                      /*sourceRenderState*/,
     259             :                                  const geometry::RealRectangle2D&                   /*destRect*/,
     260             :                                  const rendering::ViewState&                        /*destViewState*/,
     261             :                                  const rendering::RenderState&                      /*destRenderState*/ )
     262             :     {
     263             :         // TODO(F2): copyRect NYI
     264           0 :     }
     265             : 
     266           0 :     geometry::IntegerSize2D CanvasHelper::getSize()
     267             :     {
     268           0 :         if( !mpDevice )
     269           0 :             geometry::IntegerSize2D(1, 1); // we're disposed
     270             : 
     271           0 :         return ::basegfx::unotools::integerSize2DFromB2ISize( maSize );
     272             :     }
     273             : 
     274           0 :     uno::Reference< rendering::XBitmap > CanvasHelper::getScaledBitmap( const geometry::RealSize2D& /*newSize*/,
     275             :                                                                         sal_Bool                    /*beFast*/ )
     276             :     {
     277             :         // TODO(F1):
     278           0 :         return uno::Reference< rendering::XBitmap >();
     279             :     }
     280             : 
     281           0 :     uno::Sequence< sal_Int8 > CanvasHelper::getData( rendering::IntegerBitmapLayout&     /*bitmapLayout*/,
     282             :                                                      const geometry::IntegerRectangle2D& /*rect*/ )
     283             :     {
     284             :         // TODO
     285           0 :         return uno::Sequence< sal_Int8 >();
     286             :     }
     287             : 
     288           0 :     void CanvasHelper::setData( const uno::Sequence< sal_Int8 >&        /*data*/,
     289             :                                 const rendering::IntegerBitmapLayout&   /*bitmapLayout*/,
     290             :                                 const geometry::IntegerRectangle2D&     /*rect*/ )
     291             :     {
     292           0 :     }
     293             : 
     294           0 :     void CanvasHelper::setPixel( const uno::Sequence< sal_Int8 >&       /*color*/,
     295             :                                  const rendering::IntegerBitmapLayout&  /*bitmapLayout*/,
     296             :                                  const geometry::IntegerPoint2D&        /*pos*/ )
     297             :     {
     298           0 :     }
     299             : 
     300           0 :     uno::Sequence< sal_Int8 > CanvasHelper::getPixel( rendering::IntegerBitmapLayout&   /*bitmapLayout*/,
     301             :                                                       const geometry::IntegerPoint2D&   /*pos*/ )
     302             :     {
     303           0 :         return uno::Sequence< sal_Int8 >();
     304             :     }
     305             : 
     306           0 :     rendering::IntegerBitmapLayout CanvasHelper::getMemoryLayout()
     307             :     {
     308           0 :         return ::canvas::tools::getStdMemoryLayout(getSize());
     309             :     }
     310             : 
     311           0 :     bool CanvasHelper::hasAlpha() const
     312             :     {
     313           0 :         return mbHaveAlpha;
     314             :     }
     315             : 
     316           0 : }
     317             : 
     318             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10