1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _DXCANVAS_SPRITEDEVICEHELPER_HXX 25*b1cdbd2cSJim Jagielski #define _DXCANVAS_SPRITEDEVICEHELPER_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/Rectangle.hpp> 28*b1cdbd2cSJim Jagielski #include <com/sun/star/rendering/XGraphicDevice.hpp> 29*b1cdbd2cSJim Jagielski #include <com/sun/star/rendering/XBufferController.hpp> 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski #include "dx_rendermodule.hxx" 32*b1cdbd2cSJim Jagielski #include "dx_surfacebitmap.hxx" 33*b1cdbd2cSJim Jagielski #include "dx_devicehelper.hxx" 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski #include <canvas/rendering/isurfaceproxymanager.hxx> 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski #include <boost/utility.hpp> 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski namespace dxcanvas 41*b1cdbd2cSJim Jagielski { 42*b1cdbd2cSJim Jagielski class SpriteCanvas; 43*b1cdbd2cSJim Jagielski class SpriteCanvasHelper; 44*b1cdbd2cSJim Jagielski 45*b1cdbd2cSJim Jagielski class SpriteDeviceHelper : public DeviceHelper 46*b1cdbd2cSJim Jagielski { 47*b1cdbd2cSJim Jagielski public: 48*b1cdbd2cSJim Jagielski SpriteDeviceHelper(); 49*b1cdbd2cSJim Jagielski 50*b1cdbd2cSJim Jagielski void init( Window& rWindow, 51*b1cdbd2cSJim Jagielski SpriteCanvas& rSpriteCanvas, 52*b1cdbd2cSJim Jagielski const ::com::sun::star::awt::Rectangle& rRect, 53*b1cdbd2cSJim Jagielski bool bFullscreen ); 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim Jagielski /// Dispose all internal references 56*b1cdbd2cSJim Jagielski void disposing(); 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim Jagielski // partial override XWindowGraphicDevice 59*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap( 60*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 61*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 62*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap( 63*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 64*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 65*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap( 66*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 67*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 68*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap( 69*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 70*b1cdbd2cSJim Jagielski const ::com::sun::star::geometry::IntegerSize2D& size ); 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski sal_Bool hasFullScreenMode( ); 73*b1cdbd2cSJim Jagielski sal_Bool enterFullScreenMode( sal_Bool bEnter ); 74*b1cdbd2cSJim Jagielski 75*b1cdbd2cSJim Jagielski ::sal_Int32 createBuffers( ::sal_Int32 nBuffers ); 76*b1cdbd2cSJim Jagielski void destroyBuffers( ); 77*b1cdbd2cSJim Jagielski ::sal_Bool showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ); 78*b1cdbd2cSJim Jagielski ::sal_Bool switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ); 79*b1cdbd2cSJim Jagielski getRenderModule() const80*b1cdbd2cSJim Jagielski const IDXRenderModuleSharedPtr& getRenderModule() const { return mpRenderModule; } getBackBuffer() const81*b1cdbd2cSJim Jagielski const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; } getSurfaceProxy() const82*b1cdbd2cSJim Jagielski const ::canvas::ISurfaceProxyManagerSharedPtr &getSurfaceProxy() const { return mpSurfaceProxyManager; } 83*b1cdbd2cSJim Jagielski 84*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any isAccelerated() const; 85*b1cdbd2cSJim Jagielski 86*b1cdbd2cSJim Jagielski void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds ); 87*b1cdbd2cSJim Jagielski 88*b1cdbd2cSJim Jagielski /** called when DumpScreenContent property is enabled on 89*b1cdbd2cSJim Jagielski XGraphicDevice, and writes out bitmaps of current screen. 90*b1cdbd2cSJim Jagielski */ 91*b1cdbd2cSJim Jagielski void dumpScreenContent() const; 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski private: 94*b1cdbd2cSJim Jagielski void resizeBackBuffer( const ::basegfx::B2ISize& rNewSize ); 95*b1cdbd2cSJim Jagielski HWND getHwnd() const; 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps 98*b1cdbd2cSJim Jagielski SpriteCanvas* mpSpriteCanvas; 99*b1cdbd2cSJim Jagielski 100*b1cdbd2cSJim Jagielski DXSurfaceBitmapSharedPtr mpBackBuffer; 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski /// Instance passing out HW textures 103*b1cdbd2cSJim Jagielski ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxyManager; 104*b1cdbd2cSJim Jagielski 105*b1cdbd2cSJim Jagielski /// Our encapsulation interface to DirectX 106*b1cdbd2cSJim Jagielski IDXRenderModuleSharedPtr mpRenderModule; 107*b1cdbd2cSJim Jagielski }; 108*b1cdbd2cSJim Jagielski } 109*b1cdbd2cSJim Jagielski 110*b1cdbd2cSJim Jagielski #endif /* _DXCANVAS_SPRITEDEVICEHELPER_HXX */ 111