LCOV - code coverage report
Current view: top level - libreoffice/cppcanvas/source/wrapper - basegfxfactory.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-12-17 Functions: 0 6 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 <rtl/instance.hxx>
      22             : #include <osl/getglobalmutex.hxx>
      23             : #include <osl/diagnose.h>
      24             : 
      25             : #include <com/sun/star/rendering/InterpolationMode.hpp>
      26             : 
      27             : #include <basegfx/polygon/b2dpolygon.hxx>
      28             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      29             : #include <basegfx/tools/canvastools.hxx>
      30             : 
      31             : #include <cppcanvas/basegfxfactory.hxx>
      32             : 
      33             : #include <com/sun/star/rendering/RenderState.hpp>
      34             : #include <com/sun/star/rendering/StringContext.hpp>
      35             : #include <com/sun/star/rendering/XCanvas.hpp>
      36             : #include <com/sun/star/rendering/XCanvasFont.hpp>
      37             : 
      38             : #include <cppcanvas/text.hxx>
      39             : #include <canvasgraphichelper.hxx>
      40             : 
      41             : #include "implpolypolygon.hxx"
      42             : #include "implbitmap.hxx"
      43             : 
      44             : using namespace ::com::sun::star;
      45             : 
      46             : namespace cppcanvas
      47             : {
      48             :     /* Singleton handling */
      49             :     struct InitInstance2
      50             :     {
      51           0 :         BaseGfxFactory* operator()()
      52             :         {
      53           0 :             return new BaseGfxFactory();
      54             :         }
      55             :     };
      56             : 
      57           0 :     BaseGfxFactory& BaseGfxFactory::getInstance()
      58             :     {
      59             :         return *rtl_Instance< BaseGfxFactory, InitInstance2, ::osl::MutexGuard,
      60             :             ::osl::GetGlobalMutex >::create(
      61           0 :                 InitInstance2(), ::osl::GetGlobalMutex());
      62             :     }
      63             : 
      64           0 :     BaseGfxFactory::BaseGfxFactory()
      65             :     {
      66           0 :     }
      67             : 
      68           0 :     PolyPolygonSharedPtr BaseGfxFactory::createPolyPolygon( const CanvasSharedPtr&          rCanvas,
      69             :                                                             const ::basegfx::B2DPolygon&    rPoly ) const
      70             :     {
      71             :         OSL_ENSURE( rCanvas.get() != NULL &&
      72             :                     rCanvas->getUNOCanvas().is(),
      73             :                     "BaseGfxFactory::createPolyPolygon(): Invalid canvas" );
      74             : 
      75           0 :         if( rCanvas.get() == NULL )
      76           0 :             return PolyPolygonSharedPtr();
      77             : 
      78           0 :         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
      79           0 :         if( !xCanvas.is() )
      80           0 :             return PolyPolygonSharedPtr();
      81             : 
      82             :         return PolyPolygonSharedPtr(
      83             :             new internal::ImplPolyPolygon( rCanvas,
      84             :                                            ::basegfx::unotools::xPolyPolygonFromB2DPolygon(
      85           0 :                                                xCanvas->getDevice(),
      86           0 :                                                rPoly) ) );
      87             :     }
      88             : 
      89           0 :     BitmapSharedPtr BaseGfxFactory::createBitmap( const CanvasSharedPtr&    rCanvas,
      90             :                                                   const ::basegfx::B2ISize& rSize ) const
      91             :     {
      92             :         OSL_ENSURE( rCanvas.get() != NULL &&
      93             :                     rCanvas->getUNOCanvas().is(),
      94             :                     "BaseGfxFactory::createBitmap(): Invalid canvas" );
      95             : 
      96           0 :         if( rCanvas.get() == NULL )
      97           0 :             return BitmapSharedPtr();
      98             : 
      99           0 :         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
     100           0 :         if( !xCanvas.is() )
     101           0 :             return BitmapSharedPtr();
     102             : 
     103             :         return BitmapSharedPtr(
     104             :             new internal::ImplBitmap( rCanvas,
     105           0 :                                       xCanvas->getDevice()->createCompatibleBitmap(
     106           0 :                                           ::basegfx::unotools::integerSize2DFromB2ISize(rSize) ) ) );
     107             :     }
     108             : 
     109           0 :     BitmapSharedPtr BaseGfxFactory::createAlphaBitmap( const CanvasSharedPtr&   rCanvas,
     110             :                                                        const ::basegfx::B2ISize& rSize ) const
     111             :     {
     112             :         OSL_ENSURE( rCanvas.get() != NULL &&
     113             :                     rCanvas->getUNOCanvas().is(),
     114             :                     "BaseGfxFactory::createBitmap(): Invalid canvas" );
     115             : 
     116           0 :         if( rCanvas.get() == NULL )
     117           0 :             return BitmapSharedPtr();
     118             : 
     119           0 :         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
     120           0 :         if( !xCanvas.is() )
     121           0 :             return BitmapSharedPtr();
     122             : 
     123             :         return BitmapSharedPtr(
     124             :             new internal::ImplBitmap( rCanvas,
     125           0 :                                       xCanvas->getDevice()->createCompatibleAlphaBitmap(
     126           0 :                                           ::basegfx::unotools::integerSize2DFromB2ISize(rSize) ) ) );
     127             :     }
     128             : 
     129             : }
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10