LCOV - code coverage report
Current view: top level - cppcanvas/source/wrapper - implbitmap.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 35 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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 "implbitmap.hxx"
      22             : #include "implbitmapcanvas.hxx"
      23             : 
      24             : #include <basegfx/matrix/b2dhommatrix.hxx>
      25             : #include <canvas/canvastools.hxx>
      26             : 
      27             : 
      28             : using namespace ::com::sun::star;
      29             : 
      30             : namespace cppcanvas
      31             : {
      32             : 
      33             :     namespace internal
      34             :     {
      35             : 
      36           0 :         ImplBitmap::ImplBitmap( const CanvasSharedPtr&                      rParentCanvas,
      37             :                                 const uno::Reference< rendering::XBitmap >& rBitmap ) :
      38             :             CanvasGraphicHelper( rParentCanvas ),
      39             :             mxBitmap( rBitmap ),
      40           0 :             mpBitmapCanvas()
      41             :         {
      42             :             OSL_ENSURE( mxBitmap.is(), "ImplBitmap::ImplBitmap: no valid bitmap" );
      43             : 
      44             :             uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( rBitmap,
      45           0 :                                                                       uno::UNO_QUERY );
      46           0 :             if( xBitmapCanvas.is() )
      47             :                 mpBitmapCanvas.reset( new ImplBitmapCanvas(
      48             :                                           uno::Reference< rendering::XBitmapCanvas >(rBitmap,
      49           0 :                                                                                      uno::UNO_QUERY) ) );
      50           0 :         }
      51             : 
      52           0 :         ImplBitmap::~ImplBitmap()
      53             :         {
      54           0 :         }
      55             : 
      56           0 :         bool ImplBitmap::draw() const
      57             :         {
      58           0 :             CanvasSharedPtr pCanvas( getCanvas() );
      59             : 
      60             :             OSL_ENSURE( pCanvas.get() != NULL &&
      61             :                         pCanvas->getUNOCanvas().is(),
      62             :                         "ImplBitmap::draw: invalid canvas" );
      63             : 
      64           0 :             if( pCanvas.get() == NULL ||
      65           0 :                 !pCanvas->getUNOCanvas().is() )
      66             :             {
      67           0 :                 return false;
      68             :             }
      69             : 
      70             :             // TODO(P1): implement caching
      71           0 :             pCanvas->getUNOCanvas()->drawBitmap( mxBitmap,
      72           0 :                                                  pCanvas->getViewState(),
      73           0 :                                                  getRenderState() );
      74             : 
      75           0 :             return true;
      76             :         }
      77             : 
      78           0 :         bool ImplBitmap::drawAlphaModulated( double nAlphaModulation ) const
      79             :         {
      80           0 :             CanvasSharedPtr pCanvas( getCanvas() );
      81             : 
      82             :             OSL_ENSURE( pCanvas.get() != NULL &&
      83             :                         pCanvas->getUNOCanvas().is(),
      84             :                         "ImplBitmap::drawAlphaModulated(): invalid canvas" );
      85             : 
      86           0 :             if( pCanvas.get() == NULL ||
      87           0 :                 !pCanvas->getUNOCanvas().is() )
      88             :             {
      89           0 :                 return false;
      90             :             }
      91             : 
      92           0 :             rendering::RenderState aLocalState( getRenderState() );
      93           0 :             uno::Sequence<rendering::ARGBColor> aCol(1);
      94           0 :             aCol[0] = rendering::ARGBColor( nAlphaModulation, 1.0, 1.0, 1.0 );
      95           0 :             aLocalState.DeviceColor =
      96           0 :                 pCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace()->convertFromARGB(aCol);
      97             : 
      98             :             // TODO(P1): implement caching
      99           0 :             pCanvas->getUNOCanvas()->drawBitmapModulated( mxBitmap,
     100           0 :                                                           pCanvas->getViewState(),
     101           0 :                                                           aLocalState );
     102             : 
     103           0 :             return true;
     104             :         }
     105             : 
     106           0 :         BitmapCanvasSharedPtr ImplBitmap::getBitmapCanvas() const
     107             :         {
     108           0 :             return mpBitmapCanvas;
     109             :         }
     110             : 
     111           0 :         uno::Reference< rendering::XBitmap > ImplBitmap::getUNOBitmap() const
     112             :         {
     113           0 :             return mxBitmap;
     114             :         }
     115             :     }
     116             : }
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11