LCOV - code coverage report
Current view: top level - canvas/source/cairo - cairo_spritedevicehelper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 58 1.7 %
Date: 2014-11-03 Functions: 2 18 11.1 %
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( vcl::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 :     bool SpriteDeviceHelper::showBuffer( bool, bool )
      89             :     {
      90             :         OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
      91           0 :         return false;
      92             :     }
      93             : 
      94           0 :     bool SpriteDeviceHelper::switchBuffer( bool, bool )
      95             :     {
      96             :         OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
      97           0 :         return 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             : 
     138           0 :     void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
     139             :     {
     140           0 :         setSize( ::basegfx::B2ISize(rBounds.Width, rBounds.Height) );
     141           0 :     }
     142             : 
     143           0 :     SurfaceSharedPtr SpriteDeviceHelper::getWindowSurface()
     144             :     {
     145           0 :         return DeviceHelper::getSurface();
     146             :     }
     147             : 
     148           0 :     SurfaceSharedPtr SpriteDeviceHelper::createSurface( const ::basegfx::B2ISize& rSize, Content aContent )
     149             :     {
     150           0 :         if( mpBufferSurface )
     151           0 :             return mpBufferSurface->getSimilar( aContent, rSize.getX(), rSize.getY() );
     152             : 
     153           0 :         return SurfaceSharedPtr();
     154             :     }
     155             : 
     156           0 :     SurfaceSharedPtr SpriteDeviceHelper::createSurface( BitmapSystemData& rData, const Size& rSize )
     157             :     {
     158           0 :         if( getOutputDevice() )
     159           0 :             return createBitmapSurface( *getOutputDevice(), rData, rSize );
     160             : 
     161           0 :         return SurfaceSharedPtr();
     162             :     }
     163             : 
     164             : 
     165             :     /** SpriteDeviceHelper::flush  Flush the platform native window
     166             :      *
     167             :      * Flushes the window by using the internally stored mpSysData.
     168             :      *
     169             :      **/
     170           0 :     void SpriteDeviceHelper::flush()
     171             :     {
     172           0 :         SurfaceSharedPtr pWinSurface=getWindowSurface();
     173           0 :         if( pWinSurface )
     174           0 :             pWinSurface->flush();
     175           0 :     }
     176           6 : }
     177             : 
     178             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10