LibreOffice Module canvas (master)  1
cairo_spritecanvashelper.cxx
Go to the documentation of this file.
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 #include <sal/config.h>
21 #include <sal/log.hxx>
22 
23 #include <boost/cast.hpp>
24 
26 #include <tools/diagnose_ex.h>
27 
28 #include <canvas/canvastools.hxx>
29 
30 #include <cairo.h>
31 
34 
35 using namespace ::cairo;
36 using namespace ::com::sun::star;
37 
38 namespace cairocanvas
39 {
40  namespace
41  {
47  void spriteRedraw( const CairoSharedPtr& pCairo,
48  const ::canvas::Sprite::Reference& rSprite )
49  {
50  // downcast to derived cairocanvas::Sprite interface, which
51  // provides the actual redraw methods.
52  ::boost::polymorphic_downcast< Sprite* >(rSprite.get())->redraw( pCairo, true);
53  }
54 
55  void repaintBackground( const CairoSharedPtr& pCairo,
56  const SurfaceSharedPtr& pBackgroundSurface,
57  const ::basegfx::B2DRange& rArea )
58  {
59  cairo_save( pCairo.get() );
60  cairo_rectangle( pCairo.get(), ceil( rArea.getMinX() ), ceil( rArea.getMinY() ),
61  floor( rArea.getWidth() ), floor( rArea.getHeight() ) );
62  cairo_clip( pCairo.get() );
63  cairo_set_source_surface( pCairo.get(), pBackgroundSurface->getCairoSurface().get(), 0, 0 );
64  cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE );
65  cairo_paint( pCairo.get() );
66  cairo_restore( pCairo.get() );
67  }
68 
69  void opaqueUpdateSpriteArea( const ::canvas::Sprite::Reference& rSprite,
70  const CairoSharedPtr& pCairo,
71  const ::basegfx::B2IRange& rArea )
72  {
73  // clip output to actual update region (otherwise a)
74  // wouldn't save much render time, and b) will clutter
75  // scrolled sprite content outside this area)
76  cairo_save( pCairo.get() );
77  cairo_rectangle( pCairo.get(), rArea.getMinX(), rArea.getMinY(),
78  sal::static_int_cast<sal_Int32>(rArea.getWidth()),
79  sal::static_int_cast<sal_Int32>(rArea.getHeight()) );
80  cairo_clip( pCairo.get() );
81 
82  // repaint affected sprite directly to output device (at
83  // the actual screen output position)
84  // rendering directly to device buffer
85  ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw( pCairo, false );
86 
87  cairo_restore( pCairo.get() );
88  }
89  }
90 
92  mpRedrawManager( nullptr ),
93  mpOwningSpriteCanvas( nullptr ),
94  mpCompositingSurface(),
95  maCompositingSurfaceSize(),
96  mbCompositingSurfaceDirty(true)
97  {
98  }
99 
101  SpriteCanvas& rDevice,
102  const ::basegfx::B2ISize& rSize )
103  {
104  mpRedrawManager = &rManager;
105  mpOwningSpriteCanvas = &rDevice;
106 
107  CanvasHelper::init( rSize, rDevice, &rDevice );
108  }
109 
111  {
112  mpCompositingSurface.reset();
113  mpOwningSpriteCanvas = nullptr;
114  mpRedrawManager = nullptr;
115 
116  // forward to base
118  }
119 
120  uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromAnimation(
121  const uno::Reference< rendering::XAnimation >& )
122  {
123  return uno::Reference< rendering::XAnimatedSprite >();
124  }
125 
126  uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromBitmaps(
127  const uno::Sequence< uno::Reference< rendering::XBitmap > >& /*animationBitmaps*/,
128  sal_Int8 /*interpolationMode*/ )
129  {
130  return uno::Reference< rendering::XAnimatedSprite >();
131  }
132 
133  uno::Reference< rendering::XCustomSprite > SpriteCanvasHelper::createCustomSprite( const geometry::RealSize2D& spriteSize )
134  {
135  if( !mpRedrawManager )
136  return uno::Reference< rendering::XCustomSprite >(); // we're disposed
137 
138  return uno::Reference< rendering::XCustomSprite >(
139  new CanvasCustomSprite( spriteSize,
141  }
142 
143  uno::Reference< rendering::XSprite > SpriteCanvasHelper::createClonedSprite(
144  const uno::Reference< rendering::XSprite >& )
145  {
146  return uno::Reference< rendering::XSprite >();
147  }
148 
149  bool SpriteCanvasHelper::updateScreen( const ::basegfx::B2IRange& /*rCurrArea*/,
150  bool bUpdateAll,
151  bool& io_bSurfaceDirty )
152  {
153  if( !mpRedrawManager ||
157  {
158  return false; // disposed, or otherwise dysfunctional
159  }
160 
161  SAL_INFO("canvas.cairo", "SpriteCanvasHelper::updateScreen called");
162 
163  const ::basegfx::B2ISize& rSize = mpOwningSpriteCanvas->getSizePixel();
164 
165  // force compositing surface to be available before using it
166  // inside forEachSpriteArea
167  SurfaceSharedPtr pCompositingSurface = getCompositingSurface(rSize);
169  CairoSharedPtr pCompositingCairo = pCompositingSurface->getCairo();
170  CairoSharedPtr pWindowCairo = pWindowSurface->getCairo();
171 
172  // TODO(P1): Might be worthwhile to track areas of background
173  // changes, too.
174  if( !bUpdateAll && !io_bSurfaceDirty && !mbCompositingSurfaceDirty )
175  {
176  // background has not changed, so we're free to optimize
177  // repaint to areas where a sprite has changed
178 
179  // process each independent area of overlapping sprites
180  // separately.
182  }
183  else
184  {
185  SAL_INFO("canvas.cairo", "SpriteCanvasHelper::updateScreen update ALL");
186 
187  // background has changed, so we currently have no choice
188  // but repaint everything (or caller requested that)
189 
190  cairo_rectangle( pCompositingCairo.get(), 0, 0, rSize.getX(), rSize.getY() );
191  cairo_clip( pCompositingCairo.get() );
192  cairo_save( pCompositingCairo.get() );
193  cairo_set_source_surface( pCompositingCairo.get(),
194  mpOwningSpriteCanvas->getBufferSurface()->getCairoSurface().get(),
195  0, 0 );
196  cairo_set_operator( pCompositingCairo.get(), CAIRO_OPERATOR_SOURCE );
197  cairo_paint( pCompositingCairo.get() );
198  cairo_restore( pCompositingCairo.get() );
199 
200  // repaint all active sprites on top of background into
201  // VDev.
203  [&pCompositingCairo]( const Sprite::Reference rSprite )
204  { spriteRedraw( pCompositingCairo, rSprite ); }
205  );
206 
207  // flush to screen
208  cairo_rectangle( pWindowCairo.get(), 0, 0, rSize.getX(), rSize.getY() );
209  cairo_clip( pWindowCairo.get() );
210  cairo_set_source_surface( pWindowCairo.get(),
211  pCompositingSurface->getCairoSurface().get(),
212  0, 0 );
213  cairo_set_operator( pWindowCairo.get(), CAIRO_OPERATOR_SOURCE );
214  cairo_paint( pWindowCairo.get() );
215  }
216 
217  // change record vector must be cleared, for the next turn of
218  // rendering and sprite changing
220 
222  io_bSurfaceDirty = false;
223 
224  // commit to screen
226 
227  return true;
228  }
229 
230  void SpriteCanvasHelper::backgroundPaint( const ::basegfx::B2DRange& rUpdateRect )
231  {
233  repaintBackground( mpCompositingSurface->getCairo(),
235  rUpdateRect );
236  }
237 
238  void SpriteCanvasHelper::scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
239  const ::basegfx::B2DRange& rMoveEnd,
240  const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea )
241  {
244  "SpriteCanvasHelper::scrollUpdate(): NULL device pointer " );
245 
246  SAL_INFO("canvas.cairo", "SpriteCanvasHelper::scrollUpdate called");
247 
248  const ::basegfx::B2ISize& rSize = mpOwningSpriteCanvas->getSizePixel();
249  const ::basegfx::B2IRange aOutputBounds( 0,0,
250  rSize.getX(),
251  rSize.getY() );
252 
253  SurfaceSharedPtr pCompositingSurface = getCompositingSurface(rSize);
255  CairoSharedPtr pCompositingCairo = pCompositingSurface->getCairo();
256  CairoSharedPtr pWindowCairo = pWindowSurface->getCairo();
257 
258  // round rectangles to integer pixel. Note: have to be
259  // extremely careful here, to avoid off-by-one errors for
260  // the destination area: otherwise, the next scroll update
261  // would copy pixel that are not supposed to be part of
262  // the sprite.
263  ::basegfx::B2IRange aSourceRect(
265  const ::basegfx::B2IRange& rDestRect(
267  ::basegfx::B2IPoint aDestPos( rDestRect.getMinimum() );
268 
269  std::vector< ::basegfx::B2IRange > aUnscrollableAreas;
270 
271  // TODO(E3): This is plain buggy (but copies the behaviour of
272  // the old Impress slideshow) - the scrolled area might
273  // actually lie _below_ another window!
274 
275  // clip to output bounds (cannot properly scroll stuff
276  // _outside_ our screen area)
277  if( !::canvas::tools::clipScrollArea( aSourceRect,
278  aDestPos,
279  aUnscrollableAreas,
280  aOutputBounds ) )
281  {
282  // fully clipped scroll area: cannot simply scroll
283  // then. Perform normal opaque update (can use that, since
284  // one of the preconditions for scrollable update is
285  // opaque sprite content)
286 
287  // repaint all affected sprites directly to output device
288  for( const auto& rComponent : rUpdateArea.maComponentList )
289  {
290  const ::canvas::Sprite::Reference& rSprite( rComponent.second.getSprite() );
291  if( rSprite.is() )
292  ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw(
293  pCompositingCairo, true );
294  }
295  }
296  else
297  {
298  const ::basegfx::B2IVector aSourceUpperLeftPos( aSourceRect.getMinimum() );
299 
300  // clip dest area (which must be inside rDestBounds)
301  ::basegfx::B2IRange aDestRect( rDestRect );
302  aDestRect.intersect( aOutputBounds );
303 
304  ::basegfx::B2ISize aScrollSize( aDestRect.getWidth(), aDestRect.getHeight() );
305  SurfaceSharedPtr pScrollSurface( getTemporarySurface() );
306  CairoSharedPtr pScrollCairo( pScrollSurface->getCairo() );
307 
308  cairo_save( pScrollCairo.get() );
309  // scroll the current content of the compositing surface (and,
310  // thus, of the window) in temp. surface
311  cairo_set_source_surface( pScrollCairo.get(),
312  pCompositingSurface->getCairoSurface().get(),
313  aDestPos.getX() - aSourceUpperLeftPos.getX(),
314  aDestPos.getY() - aSourceUpperLeftPos.getY() );
315  cairo_rectangle( pScrollCairo.get(),
316  aDestPos.getX(), aDestPos.getY(),
317  aScrollSize.getX(), aScrollSize.getY() );
318  cairo_clip( pScrollCairo.get() );
319  cairo_set_operator( pScrollCairo.get(), CAIRO_OPERATOR_SOURCE );
320  cairo_paint( pScrollCairo.get() );
321  cairo_restore( pScrollCairo.get() );
322 
323  cairo_save( pCompositingCairo.get() );
324  // copy the scrolled area back onto the compositing surface
325  cairo_set_source_surface( pCompositingCairo.get(),
326  pScrollSurface->getCairoSurface().get(),
327  0, 0 );
328  cairo_rectangle( pCompositingCairo.get(),
329  aDestPos.getX(), aDestPos.getY(),
330  aScrollSize.getX(), aScrollSize.getY() );
331  cairo_clip( pCompositingCairo.get() );
332  cairo_set_operator( pCompositingCairo.get(), CAIRO_OPERATOR_SOURCE );
333  cairo_paint( pCompositingCairo.get() );
334  cairo_restore( pCompositingCairo.get() );
335 
336  const ::canvas::SpriteRedrawManager::SpriteConnectedRanges::ComponentListType::const_iterator
337  aFirst( rUpdateArea.maComponentList.begin() );
338  ::canvas::SpriteRedrawManager::SpriteConnectedRanges::ComponentListType::const_iterator
339  aSecond( aFirst );
340  ++aSecond;
341 
342  ENSURE_OR_THROW( aFirst->second.getSprite().is(),
343  "VCLCanvas::scrollUpdate(): no sprite" );
344 
345  // repaint uncovered areas from sprite. Need to actually
346  // clip here, since we're only repainting _parts_ of the
347  // sprite
348  for( const auto& rArea : aUnscrollableAreas )
349  opaqueUpdateSpriteArea( aFirst->second.getSprite(),
350  pCompositingCairo, rArea );
351  }
352 
353  // repaint uncovered areas from backbuffer - take the
354  // _rounded_ rectangles from above, to have the update
355  // consistent with the scroll above.
356  std::vector< ::basegfx::B2DRange > aUncoveredAreas;
357  ::basegfx::computeSetDifference( aUncoveredAreas,
358  rUpdateArea.maTotalBounds,
359  ::basegfx::B2DRange( rDestRect ) );
360  for( const auto& rArea : aUncoveredAreas )
361  repaintBackground( pCompositingCairo,
363 
364  cairo_rectangle( pWindowCairo.get(), 0, 0, rSize.getX(), rSize.getY() );
365  cairo_clip( pWindowCairo.get() );
366  cairo_set_source_surface( pWindowCairo.get(),
367  pCompositingSurface->getCairoSurface().get(),
368  0, 0 );
369  cairo_set_operator( pWindowCairo.get(), CAIRO_OPERATOR_SOURCE );
370  cairo_paint( pWindowCairo.get() );
371  }
372 
373  void SpriteCanvasHelper::opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
374  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites )
375  {
378  "SpriteCanvasHelper::opaqueUpdate(): NULL device pointer " );
379 
380  SAL_INFO("canvas.cairo", "SpriteCanvasHelper::opaqueUpdate called");
381 
382  const ::basegfx::B2ISize& rDeviceSize = mpOwningSpriteCanvas->getSizePixel();
383 
384  SurfaceSharedPtr pCompositingSurface = getCompositingSurface(rDeviceSize);
386  CairoSharedPtr pCompositingCairo = pCompositingSurface->getCairo();
387  CairoSharedPtr pWindowCairo = pWindowSurface->getCairo();
388 
389  cairo_rectangle( pCompositingCairo.get(), 0, 0, rDeviceSize.getX(), rDeviceSize.getY() );
390  cairo_clip( pCompositingCairo.get() );
391 
392  ::basegfx::B2DVector aPos( ceil( rTotalArea.getMinX() ), ceil( rTotalArea.getMinY() ) );
393  ::basegfx::B2DVector aSize( floor( rTotalArea.getMaxX() - aPos.getX() ), floor( rTotalArea.getMaxY() - aPos.getY() ) );
394 
395  cairo_rectangle( pCompositingCairo.get(), aPos.getX(), aPos.getY(), aSize.getX(), aSize.getY() );
396  cairo_clip( pCompositingCairo.get() );
397 
398  // repaint all affected sprites directly to output device
399  for( const auto& rSprite : rSortedUpdateSprites )
400  {
401  if( rSprite.is() )
402  ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw(
403  pCompositingCairo, false );
404  }
405 
406  // flush to screen
407  cairo_rectangle( pWindowCairo.get(), 0, 0, rDeviceSize.getX(), rDeviceSize.getY() );
408  cairo_clip( pWindowCairo.get() );
409  cairo_rectangle( pWindowCairo.get(), aPos.getX(), aPos.getY(), aSize.getX(), aSize.getY() );
410  cairo_clip( pWindowCairo.get() );
411  cairo_set_source_surface( pWindowCairo.get(),
412  pCompositingSurface->getCairoSurface().get(),
413  0, 0 );
414  cairo_set_operator( pWindowCairo.get(), CAIRO_OPERATOR_SOURCE );
415  cairo_paint( pWindowCairo.get() );
416  }
417 
418  void SpriteCanvasHelper::genericUpdate( const ::basegfx::B2DRange& rRequestedArea,
419  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites )
420  {
421  // TODO
422  SAL_INFO("canvas.cairo", "SpriteCanvasHelper::genericUpdate called");
423 
426  "SpriteCanvasHelper::genericUpdate(): NULL device pointer " );
427 
428  // limit size of update VDev to target outdev's size
429  const ::basegfx::B2ISize& rSize = mpOwningSpriteCanvas->getSizePixel();
430 
431  SurfaceSharedPtr pCompositingSurface = getCompositingSurface(rSize);
433  CairoSharedPtr pCompositingCairo = pCompositingSurface->getCairo();
434  CairoSharedPtr pWindowCairo = pWindowSurface->getCairo();
435 
436  // round output position towards zero. Don't want to truncate
437  // a fraction of a sprite pixel... Clip position at origin,
438  // otherwise, truncation of size below might leave visible
439  // areas uncovered by VDev.
440  const Point aOutputPosition(
441  std::max( sal_Int32( 0 ),
442  static_cast< sal_Int32 >(rRequestedArea.getMinX()) ),
443  std::max( sal_Int32( 0 ),
444  static_cast< sal_Int32 >(rRequestedArea.getMinY()) ) );
445  // round output size towards +infty. Don't want to truncate a
446  // fraction of a sprite pixel... Limit size of VDev to output
447  // device's area.
448  const Size aOutputSize(
449  std::min( rSize.getX(),
450  ::canvas::tools::roundUp( rRequestedArea.getMaxX() - aOutputPosition.X()) ),
451  std::min( rSize.getY(),
452  ::canvas::tools::roundUp( rRequestedArea.getMaxY() - aOutputPosition.Y()) ) );
453 
454  cairo_rectangle( pCompositingCairo.get(), aOutputPosition.X(), aOutputPosition.Y(), aOutputSize.Width(), aOutputSize.Height() );
455  cairo_clip( pCompositingCairo.get() );
456 
457  // paint background
458  cairo_save( pCompositingCairo.get() );
459  cairo_set_source_surface( pCompositingCairo.get(),
460  mpOwningSpriteCanvas->getBufferSurface()->getCairoSurface().get(),
461  0, 0 );
462  cairo_set_operator( pCompositingCairo.get(), CAIRO_OPERATOR_SOURCE );
463  cairo_paint( pCompositingCairo.get() );
464  cairo_restore( pCompositingCairo.get() );
465 
466  // repaint all affected sprites on top of background into
467  // VDev.
468  for( const auto& rSprite : rSortedUpdateSprites )
469  {
470  if( rSprite.is() )
471  ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw(
472  pCompositingCairo, true );
473  }
474 
475  // flush to screen
476  cairo_rectangle( pWindowCairo.get(), aOutputPosition.X(), aOutputPosition.Y(), aOutputSize.Width(), aOutputSize.Height() );
477  cairo_clip( pWindowCairo.get() );
478  cairo_set_source_surface( pWindowCairo.get(),
479  pCompositingSurface->getCairoSurface().get(),
480  0, 0 );
481  cairo_set_operator( pWindowCairo.get(), CAIRO_OPERATOR_SOURCE );
482  cairo_paint( pWindowCairo.get() );
483  }
484 
485  ::cairo::SurfaceSharedPtr const & SpriteCanvasHelper::getCompositingSurface( const ::basegfx::B2ISize& rNeededSize )
486  {
487  if( rNeededSize.getX() > maCompositingSurfaceSize.getX() ||
488  rNeededSize.getY() > maCompositingSurfaceSize.getY() )
489  {
490  // need to give buffer more size
491  mpCompositingSurface.reset();
492  }
493 
494  if( !mpCompositingSurface )
495  {
496  mpCompositingSurface = createSurface( rNeededSize );
497  maCompositingSurfaceSize = rNeededSize;
499  mpTemporarySurface.reset();
500  }
501 
502  return mpCompositingSurface;
503  }
504 
506  {
507  if ( !mpTemporarySurface )
509  return mpTemporarySurface;
510  }
511 
512  ::cairo::SurfaceSharedPtr SpriteCanvasHelper::createSurface( const ::basegfx::B2ISize& rNeededSize ) const
513  {
514  return mpOwningSpriteCanvas->getWindowSurface()->getSimilar(
515  CAIRO_CONTENT_COLOR,
516  rNeededSize.getX(), rNeededSize.getY() );
517  }
518 }
519 
520 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void clearChangeRecords()
Clear sprite change records (typically directly after a screen update)
void backgroundPaint(const ::basegfx::B2DRange &rUpdateRect)
Gets called for simple background repaints.
void forEachSpriteArea(Functor &rFunc) const
Call given functor for each sprite area that needs an update.
signed char sal_Int8
double getX() const
#define max(a, b)
Definition: dx_winstuff.hxx:46
const ::basegfx::B2ISize & getSizePixel() const
double getY() const
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation)
css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(const css::geometry::RealSize2D &spriteSize)
void opaqueUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
void genericUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
void disposing()
Release all references.
::cairo::SurfaceSharedPtr mpCompositingSurface
a surface used to composite the frontbuffer image
std::shared_ptr< cairo_t > CairoSharedPtr
#define min(a, b)
Definition: dx_winstuff.hxx:49
This class manages smooth SpriteCanvas updates.
::basegfx::B2IRange spritePixelAreaFromB2DRange(const ::basegfx::B2DRange &rRange)
Clip a blit between two differently surfaces.
css::uno::Reference< css::rendering::XSprite > createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original)
bool updateScreen(const ::basegfx::B2IRange &rCurrArea, bool bUpdateAll, bool &io_bSurfaceDirty)
Actually perform the screen update.
std::shared_ptr< Surface > SurfaceSharedPtr
::canvas::SpriteRedrawManager * mpRedrawManager
Set from the SpriteCanvas: instance coordinating sprite redraw.
sal_Int32 getX() const
B2IPoint getMinimum() const
::cairo::SurfaceSharedPtr const & getCompositingSurface(const ::basegfx::B2ISize &rNeededSize)
void init(::canvas::SpriteRedrawManager &rManager, SpriteCanvas &rOwningSpriteCanvas, const ::basegfx::B2ISize &rSize)
void forEachSprite(const Functor &rFunc) const
Call given functor for each active sprite.
void scrollUpdate(const ::basegfx::B2DRange &rMoveStart, const ::basegfx::B2DRange &rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea &rUpdateArea)
Gets called when area can be handled by scrolling.
::cairo::SurfaceSharedPtr const & getWindowSurface() const
#define ENSURE_OR_THROW(c, m)
Product of this component's factory.
void init(const ::basegfx::B2ISize &rSizePixel, SurfaceProvider &rSurfaceProvider, css::rendering::XGraphicDevice *pDevice)
Initialize canvas helper.
::cairo::SurfaceSharedPtr createSurface(const ::basegfx::B2ISize &rNeededSize) const
#define SAL_INFO(area, stream)
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps, sal_Int8 interpolationMode)
bool clipScrollArea(::basegfx::B2IRange &io_rSourceArea,::basegfx::B2IPoint &io_rDestPoint, std::vector< ::basegfx::B2IRange > &o_ClippedAreas, const ::basegfx::B2IRange &rBounds)
sal_Int32 getY() const
SpriteCanvas * mpOwningSpriteCanvas
Set from the init method. used to generate sprites.
::cairo::SurfaceSharedPtr mpTemporarySurface
a temporary surface that is guaranteed to be the same size
::cairo::SurfaceSharedPtr const & getTemporarySurface()
void disposing()
Dispose all internal references.
::cairo::SurfaceSharedPtr const & getBufferSurface() const