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 : #ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEDEVICEHELPER_HXX
21 : #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEDEVICEHELPER_HXX
22 :
23 : #include <com/sun/star/awt/Rectangle.hpp>
24 : #include <com/sun/star/rendering/XGraphicDevice.hpp>
25 : #include <com/sun/star/rendering/XBufferController.hpp>
26 :
27 : #include <boost/utility.hpp>
28 :
29 : #include <vcl/window.hxx>
30 : #include <vcl/bitmap.hxx>
31 : #include <vcl/cairo.hxx>
32 :
33 : #include "cairo_devicehelper.hxx"
34 :
35 : /* Definition of DeviceHelper class */
36 :
37 : namespace cairocanvas
38 : {
39 : class SpriteCanvas;
40 :
41 0 : class SpriteDeviceHelper : public DeviceHelper
42 : {
43 : public:
44 : SpriteDeviceHelper();
45 :
46 : void init( vcl::Window& rOutputWindow,
47 : SpriteCanvas& rSpriteCanvas,
48 : const ::basegfx::B2ISize& rSize,
49 : bool bFullscreen );
50 :
51 : /// Dispose all internal references
52 : void disposing();
53 :
54 : // XWindowGraphicDevice
55 : bool showBuffer( bool, bool );
56 : bool switchBuffer( bool, bool bUpdateAll );
57 :
58 : ::com::sun::star::uno::Any isAccelerated() const;
59 : ::com::sun::star::uno::Any getDeviceHandle() const;
60 : ::com::sun::star::uno::Any getSurfaceHandle() const;
61 :
62 : void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
63 : void setSize( const ::basegfx::B2ISize& rSize );
64 :
65 0 : ::cairo::SurfaceSharedPtr getBufferSurface() { return mpBufferSurface; }
66 : ::cairo::SurfaceSharedPtr getWindowSurface();
67 : ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent = CAIRO_CONTENT_COLOR_ALPHA );
68 : ::cairo::SurfaceSharedPtr createSurface( BitmapSystemData& rData, const Size& rSize );
69 0 : const ::basegfx::B2ISize& getSizePixel() { return maSize; }
70 : void flush();
71 :
72 : private:
73 : /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
74 : SpriteCanvas* mpSpriteCanvas;
75 :
76 : ::cairo::SurfaceSharedPtr mpBufferSurface;
77 :
78 : ::basegfx::B2ISize maSize;
79 : bool mbFullScreen;
80 : };
81 : }
82 :
83 : #endif
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|