LCOV - code coverage report
Current view: top level - canvas/source/vcl - spritedevicehelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 48 0.0 %
Date: 2012-08-25 Functions: 0 14 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 <canvas/canvastools.hxx>
      32                 :            : 
      33                 :            : #include <toolkit/helper/vclunohelper.hxx>
      34                 :            : #include <vcl/canvastools.hxx>
      35                 :            : #include <basegfx/tools/canvastools.hxx>
      36                 :            : 
      37                 :            : #include "spritedevicehelper.hxx"
      38                 :            : #include "spritecanvas.hxx"
      39                 :            : #include "spritecanvashelper.hxx"
      40                 :            : #include "canvasbitmap.hxx"
      41                 :            : 
      42                 :            : 
      43                 :            : using namespace ::com::sun::star;
      44                 :            : 
      45                 :            : namespace vclcanvas
      46                 :            : {
      47                 :          0 :     SpriteDeviceHelper::SpriteDeviceHelper() :
      48                 :          0 :         mpBackBuffer()
      49                 :            :     {
      50                 :          0 :     }
      51                 :            : 
      52                 :          0 :     void SpriteDeviceHelper::init( const OutDevProviderSharedPtr& pOutDev )
      53                 :            :     {
      54                 :          0 :         DeviceHelper::init(pOutDev);
      55                 :            : 
      56                 :            :         // setup back buffer
      57                 :          0 :         OutputDevice& rOutDev( pOutDev->getOutDev() );
      58                 :          0 :         mpBackBuffer.reset( new BackBuffer( rOutDev ));
      59                 :          0 :         mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() );
      60                 :            : 
      61                 :            :         // #i95645#
      62                 :            : #if defined( QUARTZ )
      63                 :            :         // use AA on VCLCanvas for Mac
      64                 :            :         mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | mpBackBuffer->getOutDev().GetAntialiasing() );
      65                 :            : #else
      66                 :            :         // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and
      67                 :            :         // is not required to do AA. It would need to be adapted to use it correctly
      68                 :            :         // (especially gradient painting). This will need extra work.
      69                 :          0 :         mpBackBuffer->getOutDev().SetAntialiasing(mpBackBuffer->getOutDev().GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
      70                 :            : #endif
      71                 :          0 :     }
      72                 :            : 
      73                 :          0 :     ::sal_Int32 SpriteDeviceHelper::createBuffers( ::sal_Int32 nBuffers )
      74                 :            :     {
      75                 :            :         (void)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 :     void SpriteDeviceHelper::disposing()
     101                 :            :     {
     102                 :            :         // release all references
     103                 :          0 :         mpBackBuffer.reset();
     104                 :            : 
     105                 :          0 :         DeviceHelper::disposing();
     106                 :          0 :     }
     107                 :            : 
     108                 :          0 :     uno::Any SpriteDeviceHelper::isAccelerated() const
     109                 :            :     {
     110                 :          0 :         return DeviceHelper::isAccelerated();
     111                 :            :     }
     112                 :            : 
     113                 :          0 :     uno::Any SpriteDeviceHelper::getDeviceHandle() const
     114                 :            :     {
     115                 :          0 :         return DeviceHelper::getDeviceHandle();
     116                 :            :     }
     117                 :            : 
     118                 :          0 :     uno::Any SpriteDeviceHelper::getSurfaceHandle() const
     119                 :            :     {
     120                 :          0 :         if( !mpBackBuffer )
     121                 :          0 :             return uno::Any();
     122                 :            : 
     123                 :            :         return uno::makeAny(
     124                 :          0 :             reinterpret_cast< sal_Int64 >(&mpBackBuffer->getOutDev()) );
     125                 :            :     }
     126                 :            : 
     127                 :          0 :     void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
     128                 :            :     {
     129                 :          0 :         if( mpBackBuffer )
     130                 :            :             mpBackBuffer->setSize( ::Size(rBounds.Width,
     131                 :          0 :                                           rBounds.Height) );
     132                 :          0 :     }
     133                 :            : 
     134                 :          0 :     void SpriteDeviceHelper::dumpScreenContent() const
     135                 :            :     {
     136                 :          0 :         DeviceHelper::dumpScreenContent();
     137                 :            : 
     138                 :            :         static sal_Int32 nFilePostfixCount(0);
     139                 :            : 
     140                 :          0 :         if( mpBackBuffer )
     141                 :            :         {
     142                 :          0 :             rtl::OUString aFilename("dbg_backbuffer");
     143                 :          0 :             aFilename += rtl::OUString::valueOf(nFilePostfixCount);
     144                 :          0 :             aFilename += rtl::OUString(".bmp");
     145                 :            : 
     146                 :          0 :             SvFileStream aStream( aFilename, STREAM_STD_READWRITE );
     147                 :            : 
     148                 :          0 :             const ::Point aEmptyPoint;
     149                 :          0 :             mpBackBuffer->getOutDev().EnableMapMode( sal_False );
     150                 :          0 :             aStream << mpBackBuffer->getOutDev().GetBitmap(aEmptyPoint,
     151                 :          0 :                                                             mpBackBuffer->getOutDev().GetOutputSizePixel());
     152                 :            :         }
     153                 :            : 
     154                 :          0 :         ++nFilePostfixCount;
     155                 :          0 :     }
     156                 :            : 
     157                 :          0 : }
     158                 :            : 
     159                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10