Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / cairo / cairo_spritedevicehelper.hxx
blob0f586c5e546e5c852681205d70c9107ec8d70596
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 #ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEDEVICEHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEDEVICEHELPER_HXX
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <com/sun/star/rendering/XGraphicDevice.hpp>
25 #include <com/sun/star/rendering/XBufferController.hpp>
27 #include <boost/utility.hpp>
29 #include <vcl/window.hxx>
30 #include <vcl/bitmap.hxx>
31 #include <vcl/cairo.hxx>
33 #include "cairo_devicehelper.hxx"
35 /* Definition of DeviceHelper class */
37 namespace cairocanvas
39 class SpriteCanvas;
41 class SpriteDeviceHelper : public DeviceHelper
43 public:
44 SpriteDeviceHelper();
46 void init( vcl::Window& rOutputWindow,
47 SpriteCanvas& rSpriteCanvas,
48 const ::basegfx::B2ISize& rSize,
49 bool bFullscreen );
51 /// Dispose all internal references
52 void disposing();
54 // XWindowGraphicDevice
55 bool showBuffer( bool, bool );
56 bool switchBuffer( bool, bool bUpdateAll );
58 ::com::sun::star::uno::Any isAccelerated() const;
59 ::com::sun::star::uno::Any getDeviceHandle() const;
60 ::com::sun::star::uno::Any getSurfaceHandle() const;
62 void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
63 void setSize( const ::basegfx::B2ISize& rSize );
65 ::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 const ::basegfx::B2ISize& getSizePixel() { return maSize; }
70 void flush();
72 private:
73 /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
74 SpriteCanvas* mpSpriteCanvas;
76 ::cairo::SurfaceSharedPtr mpBufferSurface;
78 ::basegfx::B2ISize maSize;
79 bool mbFullScreen;
83 #endif
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */