LCOV - code coverage report
Current view: top level - libreoffice/canvas/source/cairo - cairo_spritedevicehelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 62 0.0 %
Date: 2012-12-27 Functions: 0 20 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             : #include <canvas/debug.hxx>
      21             : #include <canvas/verbosetrace.hxx>
      22             : #include <canvas/canvastools.hxx>
      23             : 
      24             : #include <osl/mutex.hxx>
      25             : #include <cppuhelper/compbase1.hxx>
      26             : 
      27             : #include <com/sun/star/lang/NoSupportException.hpp>
      28             : 
      29             : #include <toolkit/helper/vclunohelper.hxx>
      30             : #include <basegfx/tools/canvastools.hxx>
      31             : #include <basegfx/tools/unopolypolygon.hxx>
      32             : 
      33             : #include <vcl/syschild.hxx>
      34             : #include <vcl/canvastools.hxx>
      35             : 
      36             : #include "cairo_spritecanvas.hxx"
      37             : #include "cairo_canvasbitmap.hxx"
      38             : #include "cairo_devicehelper.hxx"
      39             : #include "cairo_cairo.hxx"
      40             : 
      41             : using namespace ::cairo;
      42             : using namespace ::com::sun::star;
      43             : 
      44             : namespace cairocanvas
      45             : {
      46             : 
      47           0 :     SpriteDeviceHelper::SpriteDeviceHelper() :
      48             :         mpSpriteCanvas( NULL ),
      49             :         mpBufferSurface(),
      50             :         maSize(),
      51           0 :         mbFullScreen( false )
      52           0 :     {}
      53             : 
      54           0 :     void SpriteDeviceHelper::init( Window&                   rOutputWindow,
      55             :                                    SpriteCanvas&             rSpriteCanvas,
      56             :                                    const ::basegfx::B2ISize& rSize,
      57             :                                    bool                      bFullscreen )
      58             :     {
      59             :         DeviceHelper::init(rSpriteCanvas,
      60           0 :                            rOutputWindow);
      61             : 
      62           0 :         mpSpriteCanvas = &rSpriteCanvas;
      63           0 :         mbFullScreen = bFullscreen;
      64             : 
      65           0 :         setSize( rSize );
      66           0 :     }
      67             : 
      68           0 :     void SpriteDeviceHelper::disposing()
      69             :     {
      70             :         // release all references
      71           0 :         mpBufferSurface.reset();
      72           0 :         mpSpriteCanvas = NULL;
      73           0 :     }
      74             : 
      75           0 :     ::sal_Int32 SpriteDeviceHelper::createBuffers( ::sal_Int32 /*nBuffers*/ )
      76             :     {
      77             :         // TODO(F3): implement XBufferStrategy interface. For now, we
      78             :         // _always_ will have exactly one backbuffer
      79           0 :         return 1;
      80             :     }
      81             : 
      82           0 :     void SpriteDeviceHelper::destroyBuffers()
      83             :     {
      84             :         // TODO(F3): implement XBufferStrategy interface. For now, we
      85             :         // _always_ will have exactly one backbuffer
      86           0 :     }
      87             : 
      88           0 :     ::sal_Bool SpriteDeviceHelper::showBuffer( bool, ::sal_Bool )
      89             :     {
      90             :         OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
      91           0 :         return sal_False;
      92             :     }
      93             : 
      94           0 :     ::sal_Bool SpriteDeviceHelper::switchBuffer( bool, ::sal_Bool )
      95             :     {
      96             :         OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
      97           0 :         return sal_False;
      98             :     }
      99             : 
     100           0 :     uno::Any SpriteDeviceHelper::isAccelerated() const
     101             :     {
     102           0 :         return ::com::sun::star::uno::makeAny(true);
     103             :     }
     104             : 
     105           0 :     uno::Any SpriteDeviceHelper::getDeviceHandle() const
     106             :     {
     107           0 :         return DeviceHelper::getDeviceHandle();
     108             :     }
     109             : 
     110           0 :     uno::Any SpriteDeviceHelper::getSurfaceHandle() const
     111             :     {
     112           0 :         return DeviceHelper::getSurfaceHandle();
     113             :     }
     114             : 
     115           0 :     void SpriteDeviceHelper::setSize( const ::basegfx::B2ISize& rSize )
     116             :     {
     117             :         OSL_TRACE("SpriteDeviceHelper::setSize(): device size %d x %d", rSize.getX(), rSize.getY() );
     118             : 
     119           0 :         if( !mpSpriteCanvas )
     120           0 :             return; // disposed
     121             : 
     122           0 :         DeviceHelper::setSize(rSize);
     123             : 
     124           0 :         if( mpBufferSurface && maSize != rSize )
     125           0 :             mpBufferSurface.reset();
     126           0 :         if( !mpBufferSurface )
     127           0 :             mpBufferSurface = getWindowSurface()->getSimilar(
     128             :                 CAIRO_CONTENT_COLOR,
     129           0 :                 rSize.getX(), rSize.getY() );
     130             : 
     131           0 :         if( maSize != rSize )
     132           0 :             maSize = rSize;
     133             : 
     134           0 :         mpSpriteCanvas->setSizePixel( maSize );
     135             :     }
     136             : 
     137           0 :     const ::basegfx::B2ISize& SpriteDeviceHelper::getSizePixel()
     138             :     {
     139           0 :         return maSize;
     140             :     }
     141             : 
     142           0 :     void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
     143             :     {
     144           0 :         setSize( ::basegfx::B2ISize(rBounds.Width, rBounds.Height) );
     145           0 :     }
     146             : 
     147           0 :     SurfaceSharedPtr SpriteDeviceHelper::getBufferSurface()
     148             :     {
     149           0 :         return mpBufferSurface;
     150             :     }
     151             : 
     152           0 :     SurfaceSharedPtr SpriteDeviceHelper::getWindowSurface()
     153             :     {
     154           0 :         return DeviceHelper::getSurface();
     155             :     }
     156             : 
     157           0 :     SurfaceSharedPtr SpriteDeviceHelper::createSurface( const ::basegfx::B2ISize& rSize, Content aContent )
     158             :     {
     159           0 :         if( mpBufferSurface )
     160           0 :             return mpBufferSurface->getSimilar( aContent, rSize.getX(), rSize.getY() );
     161             : 
     162           0 :         return SurfaceSharedPtr();
     163             :     }
     164             : 
     165           0 :     SurfaceSharedPtr SpriteDeviceHelper::createSurface( BitmapSystemData& rData, const Size& rSize )
     166             :     {
     167           0 :         if( getOutputDevice() )
     168           0 :             return createBitmapSurface( *getOutputDevice(), rData, rSize );
     169             : 
     170           0 :         return SurfaceSharedPtr();
     171             :     }
     172             : 
     173             : 
     174             :     /** SpriteDeviceHelper::flush  Flush the platform native window
     175             :      *
     176             :      * Flushes the window by using the internally stored mpSysData.
     177             :      *
     178             :      **/
     179           0 :     void SpriteDeviceHelper::flush()
     180             :     {
     181           0 :         SurfaceSharedPtr pWinSurface=getWindowSurface();
     182           0 :         if( pWinSurface )
     183           0 :             pWinSurface->flush();
     184           0 :     }
     185           0 : }
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10