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 :
32 : #include "cairo_cairo.hxx"
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( 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 : ::sal_Int32 createBuffers( ::sal_Int32 nBuffers );
56 : void destroyBuffers( );
57 : sal_Bool showBuffer( bool, sal_Bool );
58 : sal_Bool switchBuffer( bool, sal_Bool bUpdateAll );
59 :
60 : ::com::sun::star::uno::Any isAccelerated() const;
61 : ::com::sun::star::uno::Any getDeviceHandle() const;
62 : ::com::sun::star::uno::Any getSurfaceHandle() const;
63 :
64 : void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
65 : void setSize( const ::basegfx::B2ISize& rSize );
66 :
67 : ::cairo::SurfaceSharedPtr getBufferSurface();
68 : ::cairo::SurfaceSharedPtr getWindowSurface();
69 : ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, ::cairo::Content aContent = CAIRO_CONTENT_COLOR_ALPHA );
70 : ::cairo::SurfaceSharedPtr createSurface( BitmapSystemData& rData, const Size& rSize );
71 : const ::basegfx::B2ISize& getSizePixel();
72 : void flush();
73 :
74 : private:
75 : /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
76 : SpriteCanvas* mpSpriteCanvas;
77 :
78 : ::cairo::SurfaceSharedPtr mpBufferSurface;
79 :
80 : ::basegfx::B2ISize maSize;
81 : bool mbFullScreen;
82 : };
83 : }
84 :
85 : #endif
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|