LCOV - code coverage report
Current view: top level - canvas/source/null - null_canvashelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 74 0.0 %
Date: 2012-08-25 Functions: 0 33 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10