LCOV - code coverage report
Current view: top level - canvas/source/opengl - ogl_spritecanvas.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 58 0.0 %
Date: 2014-11-03 Functions: 0 18 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             : 
      10             : #include "ogl_spritecanvas.hxx"
      11             : 
      12             : #include <canvas/debug.hxx>
      13             : #include <canvas/verbosetrace.hxx>
      14             : #include <tools/diagnose_ex.h>
      15             : 
      16             : #include <osl/mutex.hxx>
      17             : 
      18             : #include <com/sun/star/uno/XComponentContext.hpp>
      19             : #include <com/sun/star/registry/XRegistryKey.hpp>
      20             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      21             : #include <com/sun/star/lang/NoSupportException.hpp>
      22             : 
      23             : #include <toolkit/helper/vclunohelper.hxx>
      24             : #include <cppuhelper/factory.hxx>
      25             : #include <cppuhelper/implementationentry.hxx>
      26             : #include <comphelper/servicedecl.hxx>
      27             : 
      28             : #include "ogl_canvascustomsprite.hxx"
      29             : 
      30             : #define SPRITECANVAS_SERVICE_NAME        "com.sun.star.rendering.SpriteCanvas.OGL"
      31             : #define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.OGL"
      32             : 
      33             : 
      34             : using namespace ::com::sun::star;
      35             : 
      36             : namespace oglcanvas
      37             : {
      38           0 :     SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >&                aArguments,
      39             :                                 const uno::Reference< uno::XComponentContext >& rxContext ) :
      40             :         maArguments(aArguments),
      41           0 :         mxComponentContext( rxContext )
      42             :     {
      43           0 :     }
      44             : 
      45           0 :     void SpriteCanvas::initialize()
      46             :     {
      47             :         // Only call initialize when not in probe mode
      48           0 :         if( maArguments.getLength() == 0 )
      49           0 :             return;
      50             : 
      51             :         VERBOSE_TRACE( "SpriteCanvas::initialize called" );
      52             : 
      53             :         /* aArguments:
      54             :            0: ptr to creating instance (Window or VirtualDevice)
      55             :            1: SystemEnvData as a streamed Any (or empty for VirtualDevice)
      56             :            2: current bounds of creating instance
      57             :            3: bool, denoting always on top state for Window (always false for VirtualDevice)
      58             :            4: XWindow for creating Window (or empty for VirtualDevice)
      59             :            5: SystemGraphicsData as a streamed Any
      60             :          */
      61           0 :         ENSURE_ARG_OR_THROW( maArguments.getLength() >= 5 &&
      62             :                              maArguments[4].getValueTypeClass() == uno::TypeClass_INTERFACE,
      63             :                              "OpenGL SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
      64             : 
      65           0 :         uno::Reference< awt::XWindow > xParentWindow;
      66           0 :         maArguments[4] >>= xParentWindow;
      67           0 :         vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
      68           0 :         if( !pParentWindow )
      69             :             throw lang::NoSupportException(
      70           0 :                 "Parent window not VCL window, or canvas out-of-process!", NULL);
      71             : 
      72           0 :         awt::Rectangle aRect;
      73           0 :         maArguments[2] >>= aRect;
      74             : 
      75             :         // setup helper
      76             :         maDeviceHelper.init( *pParentWindow,
      77             :                              *this,
      78           0 :                              aRect );
      79           0 :         maCanvasHelper.init( *this, maDeviceHelper );
      80           0 :         maArguments.realloc(0);
      81             :     }
      82             : 
      83           0 :     void SpriteCanvas::disposeThis()
      84             :     {
      85           0 :         ::osl::MutexGuard aGuard( m_aMutex );
      86             : 
      87           0 :         mxComponentContext.clear();
      88             : 
      89             :         // forward to parent
      90           0 :         SpriteCanvasBaseT::disposeThis();
      91           0 :     }
      92             : 
      93           0 :     sal_Bool SAL_CALL SpriteCanvas::showBuffer( sal_Bool bUpdateAll ) throw (uno::RuntimeException, std::exception)
      94             :     {
      95           0 :         ::osl::MutexGuard aGuard( m_aMutex );
      96             : 
      97             :         // avoid repaints on hidden window (hidden: not mapped to
      98             :         // screen). Return failure, since the screen really has _not_
      99             :         // been updated (caller should try again later)
     100           0 :         return !mbIsVisible ? false : SpriteCanvasBaseT::showBuffer( bUpdateAll );
     101             :     }
     102             : 
     103           0 :     sal_Bool SAL_CALL SpriteCanvas::switchBuffer( sal_Bool bUpdateAll ) throw (uno::RuntimeException, std::exception)
     104             :     {
     105           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     106             : 
     107             :         // avoid repaints on hidden window (hidden: not mapped to
     108             :         // screen). Return failure, since the screen really has _not_
     109             :         // been updated (caller should try again later)
     110           0 :         return !mbIsVisible ? false : SpriteCanvasBaseT::switchBuffer( bUpdateAll );
     111             :     }
     112             : 
     113           0 :     uno::Reference< rendering::XAnimatedSprite > SAL_CALL SpriteCanvas::createSpriteFromAnimation(
     114             :         const uno::Reference< rendering::XAnimation >& /*animation*/ ) throw (lang::IllegalArgumentException,
     115             :                                                                               uno::RuntimeException, std::exception)
     116             :     {
     117           0 :         return uno::Reference< rendering::XAnimatedSprite >();
     118             :     }
     119             : 
     120           0 :     uno::Reference< rendering::XAnimatedSprite > SAL_CALL SpriteCanvas::createSpriteFromBitmaps(
     121             :         const uno::Sequence< uno::Reference< rendering::XBitmap > >& /*animationBitmaps*/,
     122             :         ::sal_Int8 /*interpolationMode*/ ) throw (lang::IllegalArgumentException,
     123             :                                                   rendering::VolatileContentDestroyedException,
     124             :                                                   uno::RuntimeException, std::exception)
     125             :     {
     126           0 :         return uno::Reference< rendering::XAnimatedSprite >();
     127             :     }
     128             : 
     129           0 :     uno::Reference< rendering::XCustomSprite > SAL_CALL SpriteCanvas::createCustomSprite(
     130             :         const geometry::RealSize2D& spriteSize ) throw (lang::IllegalArgumentException,
     131             :                                                         uno::RuntimeException, std::exception)
     132             :     {
     133             :         return uno::Reference< rendering::XCustomSprite >(
     134           0 :             new CanvasCustomSprite(spriteSize, this, maDeviceHelper) );
     135             :     }
     136             : 
     137           0 :     uno::Reference< rendering::XSprite > SAL_CALL SpriteCanvas::createClonedSprite(
     138             :         const uno::Reference< rendering::XSprite >& /*original*/ ) throw (lang::IllegalArgumentException,
     139             :                                                                           uno::RuntimeException, std::exception)
     140             :     {
     141           0 :         return uno::Reference< rendering::XSprite >();
     142             :     }
     143             : 
     144           0 :     sal_Bool SAL_CALL SpriteCanvas::updateScreen(sal_Bool bUpdateAll)
     145             :         throw (uno::RuntimeException, std::exception)
     146             :     {
     147           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     148           0 :         return maDeviceHelper.showBuffer(mbIsVisible, bUpdateAll);
     149             :     }
     150             : 
     151           0 :     ::rtl::OUString SAL_CALL SpriteCanvas::getServiceName(  ) throw (uno::RuntimeException, std::exception)
     152             :     {
     153           0 :         return ::rtl::OUString( SPRITECANVAS_SERVICE_NAME );
     154             :     }
     155             : 
     156           0 :     void SpriteCanvas::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
     157             :     {
     158           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     159           0 :         maDeviceHelper.show(xSprite);
     160           0 :     }
     161             : 
     162           0 :     void SpriteCanvas::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
     163             :     {
     164           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     165           0 :         maDeviceHelper.hide(xSprite);
     166           0 :     }
     167             : 
     168           0 :     bool SpriteCanvas::renderRecordedActions() const
     169             :     {
     170           0 :         return maCanvasHelper.renderRecordedActions();
     171             :     }
     172             : 
     173           0 :     static uno::Reference<uno::XInterface> initCanvas( SpriteCanvas* pCanvas )
     174             :     {
     175           0 :         uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
     176           0 :         pCanvas->initialize();
     177           0 :         return xRet;
     178             :     }
     179             : 
     180             :     namespace sdecl = comphelper::service_decl;
     181           0 :     sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl(&initCanvas);
     182           0 :     const sdecl::ServiceDecl oglSpriteCanvasDecl(
     183             :         serviceImpl,
     184             :         SPRITECANVAS_IMPLEMENTATION_NAME,
     185             :         SPRITECANVAS_SERVICE_NAME );
     186             : }
     187             : 
     188             : // The C shared lib entry points
     189           0 : COMPHELPER_SERVICEDECL_EXPORTS1(oglcanvas, oglcanvas::oglSpriteCanvasDecl);
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10