update dev300-m58
[ooovba.git] / canvas / source / cairo / cairo_spritehelper.hxx
blob040a8cc265a70632c5c50a9b10adc6b1fb5d302d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cairo_spritehelper.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CAIROCANVAS_SPRITEHELPER_HXX
32 #define _CAIROCANVAS_SPRITEHELPER_HXX
34 #include <com/sun/star/rendering/XCustomSprite.hpp>
36 #include <canvas/base/canvascustomspritehelper.hxx>
38 #include <basegfx/point/b2dpoint.hxx>
39 #include <basegfx/vector/b2isize.hxx>
40 #include <basegfx/matrix/b2dhommatrix.hxx>
42 #include "cairo_spritecanvas.hxx"
45 namespace cairocanvas
47 /* Definition of SpriteHelper class */
49 /** Helper class for canvas sprites.
51 This class implements all sprite-related functionality, like
52 that available on the XSprite interface.
54 class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper
56 public:
57 /** Create sprite helper
59 SpriteHelper();
61 /** Late-init the sprite helper
63 @param rSpriteSize
64 Size of the sprite
66 @param rSpriteCanvas
67 Sprite canvas this sprite is part of. Object stores
68 ref-counted reference to it, thus, don't forget to pass on
69 disposing()!
71 @param rDevice
72 DX device to use
74 @param rSpriteSurface
75 The surface of the sprite (not the DX texture, but the
76 persistent target of content rendering)
78 @param bShowSpriteBounds
79 When true, little debug bound rects for sprites are shown
81 void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
82 const SpriteCanvasRef& rSpriteCanvas );
84 void disposing();
86 void setSurface( const ::cairo::SurfaceSharedPtr& pBufferSurface );
88 /** Repaint sprite content to associated sprite canvas
90 @param rPos
91 Output position (sprite's own position is disregarded)
93 @param io_bSurfacesDirty
94 When true, the referenced sprite surfaces (backBuffer and
95 backBufferMask) have been modified since last call.
97 @param bBufferedUpdate
98 When true, the redraw does <em>not</em> happen directly on
99 the front buffer, but within a VDev. Used to speed up
100 drawing.
102 void redraw( const ::cairo::CairoSharedPtr& pCairo,
103 const ::basegfx::B2DPoint& rPos,
104 bool& bSurfacesDirty,
105 bool bBufferedUpdate ) const;
107 private:
108 virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
109 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const;
112 SpriteCanvasRef mpSpriteCanvas;
113 ::cairo::SurfaceSharedPtr mpBufferSurface;
114 mutable bool mbTextureDirty; // when true, texture needs update
118 #endif /* _CAIROCANVAS_SPRITEHELPER_HXX */