cid#1607171 Data race condition
[LibreOffice.git] / canvas / source / cairo / cairo_spritehelper.hxx
blobdf0919e7fd6af2dcecfdfe10698bd839cfb4f343
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 #pragma once
22 #include <base/canvascustomspritehelper.hxx>
24 #include <basegfx/point/b2dpoint.hxx>
26 #include "cairo_spritecanvas.hxx"
29 namespace cairocanvas
31 /* Definition of SpriteHelper class */
33 /** Helper class for canvas sprites.
35 This class implements all sprite-related functionality, like
36 that available on the XSprite interface.
38 class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper
40 public:
41 /** Create sprite helper
43 SpriteHelper();
45 /** Late-init the sprite helper
47 @param rSpriteSize
48 Size of the sprite
50 @param rSpriteCanvas
51 Sprite canvas this sprite is part of. Object stores
52 ref-counted reference to it, thus, don't forget to pass on
53 disposing()!
55 @param rDevice
56 DX device to use
58 @param rSpriteSurface
59 The surface of the sprite (not the DX texture, but the
60 persistent target of content rendering)
62 @param bShowSpriteBounds
63 When true, little debug bound rects for sprites are shown
65 void init( const css::geometry::RealSize2D& rSpriteSize,
66 const SpriteCanvasRef& rSpriteCanvas );
68 void disposing();
70 void setSurface( const ::cairo::SurfaceSharedPtr& pBufferSurface );
72 /** Repaint sprite content to associated sprite canvas
74 @param rPos
75 Output position (sprite's own position is disregarded)
77 @param io_bSurfacesDirty
78 When true, the referenced sprite surfaces (backBuffer and
79 backBufferMask) have been modified since last call.
81 @param bBufferedUpdate
82 When true, the redraw does <em>not</em> happen directly on
83 the front buffer, but within a VDev. Used to speed up
84 drawing.
86 void redraw( const ::cairo::CairoSharedPtr& pCairo,
87 const ::basegfx::B2DPoint& rPos,
88 bool& bSurfacesDirty,
89 bool bBufferedUpdate ) const;
91 private:
92 virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
93 css::uno::Reference< css::rendering::XPolyPolygon2D >& xPoly ) const override;
96 SpriteCanvasRef mpSpriteCanvas;
97 ::cairo::SurfaceSharedPtr mpBufferSurface;
98 mutable bool mbTextureDirty; // when true, texture needs update
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */