Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / cairo / cairo_spritehelper.hxx
blob3fc45274838ed47be33d4ced9e343d6e2aca6bc1
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_SPRITEHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEHELPER_HXX
23 #include <com/sun/star/rendering/XCustomSprite.hpp>
25 #include <canvas/base/canvascustomspritehelper.hxx>
27 #include <basegfx/point/b2dpoint.hxx>
28 #include <basegfx/vector/b2isize.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
31 #include "cairo_spritecanvas.hxx"
34 namespace cairocanvas
36 /* Definition of SpriteHelper class */
38 /** Helper class for canvas sprites.
40 This class implements all sprite-related functionality, like
41 that available on the XSprite interface.
43 class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper
45 public:
46 /** Create sprite helper
48 SpriteHelper();
50 /** Late-init the sprite helper
52 @param rSpriteSize
53 Size of the sprite
55 @param rSpriteCanvas
56 Sprite canvas this sprite is part of. Object stores
57 ref-counted reference to it, thus, don't forget to pass on
58 disposing()!
60 @param rDevice
61 DX device to use
63 @param rSpriteSurface
64 The surface of the sprite (not the DX texture, but the
65 persistent target of content rendering)
67 @param bShowSpriteBounds
68 When true, little debug bound rects for sprites are shown
70 void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
71 const SpriteCanvasRef& rSpriteCanvas );
73 void disposing();
75 void setSurface( const ::cairo::SurfaceSharedPtr& pBufferSurface );
77 /** Repaint sprite content to associated sprite canvas
79 @param rPos
80 Output position (sprite's own position is disregarded)
82 @param io_bSurfacesDirty
83 When true, the referenced sprite surfaces (backBuffer and
84 backBufferMask) have been modified since last call.
86 @param bBufferedUpdate
87 When true, the redraw does <em>not</em> happen directly on
88 the front buffer, but within a VDev. Used to speed up
89 drawing.
91 void redraw( const ::cairo::CairoSharedPtr& pCairo,
92 const ::basegfx::B2DPoint& rPos,
93 bool& bSurfacesDirty,
94 bool bBufferedUpdate ) const;
96 private:
97 virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
98 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const SAL_OVERRIDE;
101 SpriteCanvasRef mpSpriteCanvas;
102 ::cairo::SurfaceSharedPtr mpBufferSurface;
103 mutable bool mbTextureDirty; // when true, texture needs update
107 #endif // INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEHELPER_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */