LCOV - code coverage report
Current view: top level - canvas/source/vcl - spritedevicehelper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 46 0.0 %
Date: 2014-04-14 Functions: 0 14 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/canvastools.hxx>
      22             : #include <toolkit/helper/vclunohelper.hxx>
      23             : #include <vcl/canvastools.hxx>
      24             : #include <basegfx/tools/canvastools.hxx>
      25             : #include <vcl/dibtools.hxx>
      26             : 
      27             : #include "spritedevicehelper.hxx"
      28             : #include "spritecanvas.hxx"
      29             : #include "spritecanvashelper.hxx"
      30             : #include "canvasbitmap.hxx"
      31             : 
      32             : using namespace ::com::sun::star;
      33             : 
      34             : namespace vclcanvas
      35             : {
      36           0 :     SpriteDeviceHelper::SpriteDeviceHelper() :
      37           0 :         mpBackBuffer()
      38             :     {
      39           0 :     }
      40             : 
      41           0 :     void SpriteDeviceHelper::init( const OutDevProviderSharedPtr& pOutDev )
      42             :     {
      43           0 :         DeviceHelper::init(pOutDev);
      44             : 
      45             :         // setup back buffer
      46           0 :         OutputDevice& rOutDev( pOutDev->getOutDev() );
      47           0 :         mpBackBuffer.reset( new BackBuffer( rOutDev ));
      48           0 :         mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() );
      49             : 
      50             :         // #i95645#
      51             : #if defined( MACOSX )
      52             :         // use AA on VCLCanvas for Mac
      53             :         mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | mpBackBuffer->getOutDev().GetAntialiasing() );
      54             : #else
      55             :         // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and
      56             :         // is not required to do AA. It would need to be adapted to use it correctly
      57             :         // (especially gradient painting). This will need extra work.
      58           0 :         mpBackBuffer->getOutDev().SetAntialiasing(mpBackBuffer->getOutDev().GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
      59             : #endif
      60           0 :     }
      61             : 
      62           0 :     ::sal_Int32 SpriteDeviceHelper::createBuffers( ::sal_Int32 nBuffers )
      63             :     {
      64             :         (void)nBuffers;
      65             : 
      66             :         // TODO(F3): implement XBufferStrategy interface. For now, we
      67             :         // _always_ will have exactly one backbuffer
      68           0 :         return 1;
      69             :     }
      70             : 
      71           0 :     void SpriteDeviceHelper::destroyBuffers()
      72             :     {
      73             :         // TODO(F3): implement XBufferStrategy interface. For now, we
      74             :         // _always_ will have exactly one backbuffer
      75           0 :     }
      76             : 
      77           0 :     sal_Bool SpriteDeviceHelper::showBuffer( bool, sal_Bool )
      78             :     {
      79             :         OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
      80           0 :         return sal_False;
      81             :     }
      82             : 
      83           0 :     sal_Bool SpriteDeviceHelper::switchBuffer( bool, sal_Bool )
      84             :     {
      85             :         OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
      86           0 :         return sal_False;
      87             :     }
      88             : 
      89           0 :     void SpriteDeviceHelper::disposing()
      90             :     {
      91             :         // release all references
      92           0 :         mpBackBuffer.reset();
      93             : 
      94           0 :         DeviceHelper::disposing();
      95           0 :     }
      96             : 
      97           0 :     uno::Any SpriteDeviceHelper::isAccelerated() const
      98             :     {
      99           0 :         return DeviceHelper::isAccelerated();
     100             :     }
     101             : 
     102           0 :     uno::Any SpriteDeviceHelper::getDeviceHandle() const
     103             :     {
     104           0 :         return DeviceHelper::getDeviceHandle();
     105             :     }
     106             : 
     107           0 :     uno::Any SpriteDeviceHelper::getSurfaceHandle() const
     108             :     {
     109           0 :         if( !mpBackBuffer )
     110           0 :             return uno::Any();
     111             : 
     112             :         return uno::makeAny(
     113           0 :             reinterpret_cast< sal_Int64 >(&mpBackBuffer->getOutDev()) );
     114             :     }
     115             : 
     116           0 :     void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
     117             :     {
     118           0 :         if( mpBackBuffer )
     119             :             mpBackBuffer->setSize( ::Size(rBounds.Width,
     120           0 :                                           rBounds.Height) );
     121           0 :     }
     122             : 
     123           0 :     void SpriteDeviceHelper::dumpScreenContent() const
     124             :     {
     125           0 :         DeviceHelper::dumpScreenContent();
     126             : 
     127             :         static sal_Int32 nFilePostfixCount(0);
     128             : 
     129           0 :         if( mpBackBuffer )
     130             :         {
     131           0 :             OUString aFilename = "dbg_backbuffer" + OUString::number(nFilePostfixCount) + ".bmp";
     132             : 
     133           0 :             SvFileStream aStream( aFilename, STREAM_STD_READWRITE );
     134             : 
     135           0 :             const ::Point aEmptyPoint;
     136           0 :             mpBackBuffer->getOutDev().EnableMapMode( false );
     137           0 :             mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW );
     138           0 :             WriteDIB(mpBackBuffer->getOutDev().GetBitmap(aEmptyPoint, mpBackBuffer->getOutDev().GetOutputSizePixel()), aStream, false, true);
     139             :         }
     140             : 
     141           0 :         ++nFilePostfixCount;
     142           0 :     }
     143             : 
     144           0 : }
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10