Simplify a bit
[LibreOffice.git] / canvas / source / directx / dx_spritedevicehelper.hxx
blobad74177706676fe7e6b83825c6aa80e5c7c6530f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <com/sun/star/awt/Rectangle.hpp>
23 #include <com/sun/star/rendering/XGraphicDevice.hpp>
24 #include <com/sun/star/rendering/XBufferController.hpp>
26 #include "dx_rendermodule.hxx"
27 #include "dx_surfacebitmap.hxx"
28 #include "dx_devicehelper.hxx"
30 #include <rendering/isurfaceproxymanager.hxx>
33 namespace dxcanvas
35 class SpriteCanvas;
37 class SpriteDeviceHelper : public DeviceHelper
39 public:
40 SpriteDeviceHelper();
42 void init( vcl::Window& rWindow,
43 SpriteCanvas& rSpriteCanvas,
44 const css::awt::Rectangle& rRect,
45 bool bFullscreen );
47 /// Dispose all internal references
48 void disposing();
50 // partial override XWindowGraphicDevice
51 css::uno::Reference< css::rendering::XBitmap > createCompatibleBitmap(
52 const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
53 const css::geometry::IntegerSize2D& size );
54 css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileBitmap(
55 const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
56 const css::geometry::IntegerSize2D& size );
57 css::uno::Reference< css::rendering::XBitmap > createCompatibleAlphaBitmap(
58 const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
59 const css::geometry::IntegerSize2D& size );
60 css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
61 const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
62 const css::geometry::IntegerSize2D& size );
64 void destroyBuffers( );
65 bool showBuffer( bool bIsVisible, bool bUpdateAll );
66 bool switchBuffer( bool bIsVisible, bool bUpdateAll );
68 const IDXRenderModuleSharedPtr& getRenderModule() const { return mpRenderModule; }
69 const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; }
70 const std::shared_ptr<canvas::ISurfaceProxyManager> &getSurfaceProxy() const { return mpSurfaceProxyManager; }
72 css::uno::Any isAccelerated() const;
74 void notifySizeUpdate( const css::awt::Rectangle& rBounds );
76 /** called when DumpScreenContent property is enabled on
77 XGraphicDevice, and writes out bitmaps of current screen.
79 void dumpScreenContent() const;
81 private:
82 void resizeBackBuffer( const ::basegfx::B2ISize& rNewSize );
83 HWND getHwnd() const;
85 /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
86 SpriteCanvas* mpSpriteCanvas;
88 DXSurfaceBitmapSharedPtr mpBackBuffer;
90 /// Instance passing out HW textures
91 std::shared_ptr<canvas::ISurfaceProxyManager> mpSurfaceProxyManager;
93 /// Our encapsulation interface to DirectX
94 IDXRenderModuleSharedPtr mpRenderModule;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */