LibreOffice Module canvas (master)  1
ogl_spritedevicehelper.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 
10 #include <sal/config.h>
11 #include <sal/log.hxx>
12 
16 #include <com/sun/star/awt/XTopWindow.hpp>
17 #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
18 #include <com/sun/star/uno/Reference.hxx>
20 #include <vcl/canvastools.hxx>
22 #include <vcl/syschild.hxx>
23 
25 #include "ogl_spritecanvas.hxx"
26 #include "ogl_canvasbitmap.hxx"
27 #include "ogl_canvastools.hxx"
29 #include "ogl_texturecache.hxx"
30 
31 #include <iterator>
32 
33 using namespace ::com::sun::star;
34 
35 static void initContext()
36 {
37  // need the backside for mirror effects
38  glDisable(GL_CULL_FACE);
39 
40  // no perspective, we're 2D
41  glMatrixMode(GL_PROJECTION);
42  glLoadIdentity();
43 
44  // misc preferences
45  glEnable(GL_POINT_SMOOTH);
46  glEnable(GL_LINE_SMOOTH);
47  glEnable(GL_POLYGON_SMOOTH);
48  glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
49  glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
50  glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
51  glShadeModel(GL_FLAT);
52 }
53 
54 static void initTransformation(const ::Size& rSize)
55 {
56  // use whole window
57  glViewport( 0,0,
58  static_cast<GLsizei>(rSize.Width()),
59  static_cast<GLsizei>(rSize.Height()) );
60 
61  // model coordinate system is already in device pixel
62  glMatrixMode(GL_MODELVIEW);
63  glLoadIdentity();
64  glTranslated(-1.0, 1.0, 0.0);
65  glScaled( 2.0 / rSize.Width(),
66  -2.0 / rSize.Height(),
67  1.0 );
68 
69  // clear to black
70  glClearColor(0,0,0,0);
71  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
72 }
73 
74 namespace oglcanvas
75 {
76 
78  mpSpriteCanvas(nullptr),
79  maActiveSprites(),
80  maLastUpdate(),
81  mpTextureCache(std::make_shared<TextureCache>()),
82  mnLinearTwoColorGradientProgram(0),
83  mnLinearMultiColorGradientProgram(0),
84  mnRadialTwoColorGradientProgram(0),
85  mnRadialMultiColorGradientProgram(0),
86  mnRectangularTwoColorGradientProgram(0),
87  mnRectangularMultiColorGradientProgram(0),
89  {}
90 
92  { mxContext->dispose(); }
93 
95  SpriteCanvas& rSpriteCanvas,
96  const awt::Rectangle& rViewArea )
97  {
98  mpSpriteCanvas = &rSpriteCanvas;
99 
100  rSpriteCanvas.setWindow(
101  uno::Reference<awt::XWindow2>(
102  VCLUnoHelper::GetInterface(&rWindow),
103  uno::UNO_QUERY_THROW) );
104 
105  mxContext->requestLegacyContext();
106  mxContext->init(&rWindow);
107  // init window context
108  initContext();
109 
111  OpenGLHelper::LoadShaders("dummyVertexShader", "linearMultiColorGradientFragmentShader");
112 
114  OpenGLHelper::LoadShaders("dummyVertexShader", "linearTwoColorGradientFragmentShader");
115 
117  OpenGLHelper::LoadShaders("dummyVertexShader", "radialMultiColorGradientFragmentShader");
118 
120  OpenGLHelper::LoadShaders("dummyVertexShader", "radialTwoColorGradientFragmentShader");
121 
123  OpenGLHelper::LoadShaders("dummyVertexShader", "rectangularMultiColorGradientFragmentShader");
124 
126  OpenGLHelper::LoadShaders("dummyVertexShader", "rectangularTwoColorGradientFragmentShader");
127 
128  mxContext->makeCurrent();
129 
130  notifySizeUpdate(rViewArea);
131  // TODO(E3): check for GL_ARB_imaging extension
132  }
133 
135  {
136  // release all references
137  mpSpriteCanvas = nullptr;
138  mpTextureCache.reset();
139 
140  if( mxContext->isInitialized() )
141  {
142  glDeleteProgram( mnRectangularTwoColorGradientProgram );
143  glDeleteProgram( mnRectangularMultiColorGradientProgram );
144  glDeleteProgram( mnRadialTwoColorGradientProgram );
145  glDeleteProgram( mnRadialMultiColorGradientProgram );
146  glDeleteProgram( mnLinearTwoColorGradientProgram );
147  glDeleteProgram( mnLinearMultiColorGradientProgram );
148  }
149  }
150 
152  {
153  if( !mxContext->isInitialized() )
155 
156  // Map a one-by-one millimeter box to pixel
157  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
158  const MapMode aOldMapMode( pChildWindow->GetMapMode() );
159  pChildWindow->SetMapMode( MapMode(MapUnit::MapMM) );
160  const Size aPixelSize( pChildWindow->LogicToPixel(Size(1,1)) );
161  pChildWindow->SetMapMode( aOldMapMode );
162 
163  return vcl::unotools::size2DFromSize( aPixelSize );
164  }
165 
166  geometry::RealSize2D SpriteDeviceHelper::getPhysicalSize()
167  {
168  if( !mxContext->isInitialized() )
170 
171  // Map the pixel dimensions of the output window to millimeter
172  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
173  const MapMode aOldMapMode( pChildWindow->GetMapMode() );
174  pChildWindow->SetMapMode( MapMode(MapUnit::MapMM) );
175  const Size aLogSize( pChildWindow->PixelToLogic(pChildWindow->GetOutputSizePixel()) );
176  pChildWindow->SetMapMode( aOldMapMode );
177 
178  return vcl::unotools::size2DFromSize( aLogSize );
179  }
180 
181  uno::Reference< rendering::XLinePolyPolygon2D > SpriteDeviceHelper::createCompatibleLinePolyPolygon(
182  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
183  const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points )
184  {
185  // disposed?
186  if( !mpSpriteCanvas )
187  return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed
188 
189  return uno::Reference< rendering::XLinePolyPolygon2D >(
190  new ::basegfx::unotools::UnoPolyPolygon(
192  }
193 
194  uno::Reference< rendering::XBezierPolyPolygon2D > SpriteDeviceHelper::createCompatibleBezierPolyPolygon(
195  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
196  const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points )
197  {
198  // disposed?
199  if( !mpSpriteCanvas )
200  return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed
201 
202  return uno::Reference< rendering::XBezierPolyPolygon2D >(
203  new ::basegfx::unotools::UnoPolyPolygon(
205  }
206 
207  uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleBitmap(
208  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
209  const geometry::IntegerSize2D& size )
210  {
211  // disposed?
212  if( !mpSpriteCanvas )
213  return uno::Reference< rendering::XBitmap >(); // we're disposed
214 
215  return uno::Reference< rendering::XBitmap >(
216  new CanvasBitmap( size,
218  *this ) );
219  }
220 
221  uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileBitmap(
222  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
223  const geometry::IntegerSize2D& /*size*/ )
224  {
225  return uno::Reference< rendering::XVolatileBitmap >();
226  }
227 
228  uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleAlphaBitmap(
229  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
230  const geometry::IntegerSize2D& size )
231  {
232  // disposed?
233  if( !mpSpriteCanvas )
234  return uno::Reference< rendering::XBitmap >(); // we're disposed
235 
236  return uno::Reference< rendering::XBitmap >(
237  new CanvasBitmap( size,
239  *this ) );
240  }
241 
242  uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileAlphaBitmap(
243  const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
244  const geometry::IntegerSize2D& /*size*/ )
245  {
246  return uno::Reference< rendering::XVolatileBitmap >();
247  }
248 
249  namespace
250  {
254  struct SpriteComparator
255  {
256  bool operator()( const ::rtl::Reference<CanvasCustomSprite>& rLHS,
257  const ::rtl::Reference<CanvasCustomSprite>& rRHS ) const
258  {
259  const double nPrioL( rLHS->getPriority() );
260  const double nPrioR( rRHS->getPriority() );
261 
262  // if prios are equal, tie-break on ptr value
263  return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
264  }
265  };
266  }
267 
268  bool SpriteDeviceHelper::showBuffer( bool bIsVisible, SAL_UNUSED_PARAMETER bool /*bUpdateAll*/ )
269  {
270  // hidden or disposed?
271  if( !bIsVisible || !mxContext->isInitialized() || !mpSpriteCanvas )
272  return false;
273 
274  mxContext->makeCurrent();
275 
276  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
277  const ::Size& rOutputSize = pChildWindow->GetSizePixel();
278  initTransformation(rOutputSize);
279 
280  // render the actual spritecanvas content
282 
283  // render all sprites (in order of priority) on top of that
284  std::vector< ::rtl::Reference<CanvasCustomSprite> > aSprites(
285  maActiveSprites.begin(),
286  maActiveSprites.end());
287  std::sort(aSprites.begin(),
288  aSprites.end(),
289  SpriteComparator());
290  for( const auto& rSprite : aSprites )
291  rSprite->renderSprite();
292 
293 
294  // frame counter, other info
295  glMatrixMode(GL_MODELVIEW);
296  glLoadIdentity();
297  glTranslated(-1.0, 1.0, 0.0);
298  glScaled( 2.0 / rOutputSize.Width(),
299  -2.0 / rOutputSize.Height(),
300  1.0 );
301 
302  const double denominator( maLastUpdate.getElapsedTime() );
304 
305  const double fps(denominator == 0.0 ? 100.0 : 1.0/denominator);
306  std::vector<double> aVec; aVec.push_back(fps);
307  aVec.push_back(maActiveSprites.size());
308  aVec.push_back(mpTextureCache->getCacheSize());
309  aVec.push_back(mpTextureCache->getCacheMissCount());
310  aVec.push_back(mpTextureCache->getCacheHitCount());
311  renderOSD( aVec, 20 );
312 
313  /*
314  * TODO: moggi: fix it!
315  // switch buffer, sync etc.
316  const unx::Window aXWindow=pChildWindow->GetSystemData()->aWindow;
317  unx::glXSwapBuffers(reinterpret_cast<unx::Display*>(mpDisplay),
318  aXWindow);
319  pChildWindow->Show();
320  unx::glXWaitGL();
321  XSync( reinterpret_cast<unx::Display*>(mpDisplay), false );
322  */
323  mxContext->swapBuffers();
324 
325  // flush texture cache, such that it does not build up
326  // indefinitely.
327  // TODO: have max cache size/LRU time in config, prune only on
328  // demand
329  mpTextureCache->prune();
330 
331  return true;
332  }
333 
334  bool SpriteDeviceHelper::switchBuffer( bool bIsVisible, bool bUpdateAll )
335  {
336  // no difference for VCL canvas
337  return showBuffer( bIsVisible, bUpdateAll );
338  }
339 
341  {
342  return css::uno::Any(false);
343  }
344 
346  {
347  const SystemChildWindow* pChildWindow = mxContext->getChildWindow();
348  return uno::Any( reinterpret_cast< sal_Int64 >(pChildWindow) );
349  }
350 
352  {
353  return uno::Any();
354  }
355 
356  uno::Reference<rendering::XColorSpace> SpriteDeviceHelper::getColorSpace() const
357  {
358  // always the same
360  }
361 
362  void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
363  {
364  if( mxContext->isInitialized() )
365  {
366  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
367  pChildWindow->setPosSizePixel(
368  0,0,rBounds.Width,rBounds.Height);
369  }
370  }
371 
373  {
374  SAL_INFO("canvas.ogl", OSL_THIS_FUNC );
375  }
376 
377  void SpriteDeviceHelper::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
378  {
379  maActiveSprites.insert(xSprite);
380  }
381 
382  void SpriteDeviceHelper::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
383  {
384  maActiveSprites.erase(xSprite);
385  }
386 
387  static void setupUniforms( unsigned int nProgramId,
388  const ::basegfx::B2DHomMatrix& rTexTransform )
389  {
390  const GLint nTransformLocation = glGetUniformLocation(nProgramId,
391  "m_transform" );
392  // OGL is column-major
393  float aTexTransform[] =
394  {
395  float(rTexTransform.get(0,0)), float(rTexTransform.get(1,0)),
396  float(rTexTransform.get(0,1)), float(rTexTransform.get(1,1)),
397  float(rTexTransform.get(0,2)), float(rTexTransform.get(1,2))
398  };
399  glUniformMatrix3x2fv(nTransformLocation,1,false,aTexTransform);
400  }
401 
402  static void setupUniforms( unsigned int nProgramId,
403  const rendering::ARGBColor* pColors,
404  const uno::Sequence< double >& rStops,
405  const ::basegfx::B2DHomMatrix& rTexTransform )
406  {
407  glUseProgram(nProgramId);
408 
409  GLuint nColorsTexture;
410  glActiveTexture(GL_TEXTURE0);
411  glGenTextures(1, &nColorsTexture);
412  glBindTexture(GL_TEXTURE_1D, nColorsTexture);
413 
414  const sal_Int32 nColors=rStops.getLength();
415  glTexImage1D( GL_TEXTURE_1D, 0, GL_RGBA, nColors, 0, GL_RGBA, GL_DOUBLE, pColors );
416  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
417  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
418 
419  GLuint nStopsTexture;
420  glActiveTexture(GL_TEXTURE1);
421  glGenTextures(1, &nStopsTexture);
422  glBindTexture(GL_TEXTURE_1D, nStopsTexture);
423 
424  glTexImage1D( GL_TEXTURE_1D, 0, GL_ALPHA, nColors, 0, GL_ALPHA, GL_DOUBLE, rStops.getConstArray() );
425  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
426  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
427 
428  const GLint nColorArrayLocation = glGetUniformLocation(nProgramId,
429  "t_colorArray4d" );
430  glUniform1i( nColorArrayLocation, 0 ); // unit 0
431 
432  const GLint nStopArrayLocation = glGetUniformLocation(nProgramId,
433  "t_stopArray1d" );
434  glUniform1i( nStopArrayLocation, 1 ); // unit 1
435 
436  const GLint nNumColorLocation = glGetUniformLocation(nProgramId,
437  "i_nColors" );
438  glUniform1i( nNumColorLocation, nColors-1 );
439 
440  setupUniforms(nProgramId,rTexTransform);
441  }
442 
443  static void setupUniforms( unsigned int nProgramId,
444  const rendering::ARGBColor& rStartColor,
445  const rendering::ARGBColor& rEndColor,
446  const ::basegfx::B2DHomMatrix& rTexTransform )
447  {
448  glUseProgram(nProgramId);
449 
450  const GLint nStartColorLocation = glGetUniformLocation(nProgramId,
451  "v_startColor4d" );
452  glUniform4f(nStartColorLocation,
453  rStartColor.Red,
454  rStartColor.Green,
455  rStartColor.Blue,
456  rStartColor.Alpha);
457 
458  const GLint nEndColorLocation = glGetUniformLocation(nProgramId,
459  "v_endColor4d" );
460  glUniform4f(nEndColorLocation,
461  rEndColor.Red,
462  rEndColor.Green,
463  rEndColor.Blue,
464  rEndColor.Alpha);
465 
466  setupUniforms(nProgramId,rTexTransform);
467  }
468 
469  void SpriteDeviceHelper::useLinearGradientShader( const rendering::ARGBColor* pColors,
470  const uno::Sequence< double >& rStops,
471  const ::basegfx::B2DHomMatrix& rTexTransform )
472  {
473  if( rStops.getLength() > 2 )
474  setupUniforms(mnLinearMultiColorGradientProgram, pColors, rStops, rTexTransform);
475  else
476  setupUniforms(mnLinearTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
477  }
478 
479  void SpriteDeviceHelper::useRadialGradientShader( const rendering::ARGBColor* pColors,
480  const uno::Sequence< double >& rStops,
481  const ::basegfx::B2DHomMatrix& rTexTransform )
482  {
483  if( rStops.getLength() > 2 )
484  setupUniforms(mnRadialMultiColorGradientProgram, pColors, rStops, rTexTransform);
485  else
486  setupUniforms(mnRadialTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
487  }
488 
489  void SpriteDeviceHelper::useRectangularGradientShader( const rendering::ARGBColor* pColors,
490  const uno::Sequence< double >& rStops,
491  const ::basegfx::B2DHomMatrix& rTexTransform )
492  {
493  if( rStops.getLength() > 2 )
494  setupUniforms(mnRectangularMultiColorGradientProgram, pColors, rStops, rTexTransform);
495  else
496  setupUniforms(mnRectangularTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
497  }
498 
499  namespace
500  {
501 
502  class BufferContextImpl : public IBufferContext
503  {
505  GLuint mnDepthId;
506  GLuint mnTextureId;
507 
508  virtual void startBufferRendering() override
509  {
510  glBindFramebuffer(GL_FRAMEBUFFER, mnFrambufferId);
511  }
512 
513  virtual void endBufferRendering() override
514  {
515  glBindFramebuffer(GL_FRAMEBUFFER, 0);
516  }
517 
518  virtual GLuint getTextureId() override
519  {
520  return mnTextureId;
521  }
522 
523  public:
524  explicit BufferContextImpl(const ::basegfx::B2IVector& rSize) :
525  mnFrambufferId(0),
526  mnDepthId(0),
527  mnTextureId(0)
528  {
529  OpenGLHelper::createFramebuffer(rSize.getX(), rSize.getY(), mnFrambufferId,
531  }
532 
533  virtual ~BufferContextImpl() override
534  {
535  glDeleteTextures(1, &mnTextureId);
536  glDeleteRenderbuffers(1, &mnDepthId);
537  glDeleteFramebuffers(1, &mnFrambufferId);
538  }
539  };
540  }
541 
542  IBufferContextSharedPtr SpriteDeviceHelper::createBufferContext(const ::basegfx::B2IVector& rSize) const
543  {
544  return std::make_shared<BufferContextImpl>(rSize);
545  }
546 
548  {
549  return *mpTextureCache;
550  }
551 }
552 
553 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GLuint mnTextureId
void disposing()
Dispose all internal references.
void useRadialGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable radial gradient shader "texture" with given parameters
void dumpScreenContent() const
called when DumpScreenContent property is enabled on XGraphicDevice, and writes out bitmaps of curren...
std::shared_ptr< TextureCache > mpTextureCache
css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileAlphaBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
GLuint mnDepthId
TextureCache & getTextureCache() const
Get instance of internal texture cache.
uno::Reference< uno::XComponentContext > mxContext
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void useRectangularGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable rectangular gradient shader "texture" with given parameters
const cppcanvas::SpriteCanvasSharedPtr mpSpriteCanvas
virtual Size GetSizePixel() const
css::uno::Reference< css::rendering::XVolatileBitmap > createVolatileBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
const MapMode & GetMapMode() const
void reset()
Reset the time.
Definition: elapsedtime.cxx:54
std::shared_ptr< T > make_shared(Args &&...args)
void SetMapMode()
void show(const ::rtl::Reference< CanvasCustomSprite > &)
static void initTransformation(const ::Size &rSize)
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
std::shared_ptr< IBufferContext > IBufferContextSharedPtr
::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence(const uno::Sequence< uno::Sequence< geometry::RealPoint2D > > &points)
::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence(const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > &curves)
css::geometry::RealSize2D getPhysicalSize()
bool showBuffer(bool bIsVisible, bool bUpdateAll)
static void initContext()
::canvas::tools::ElapsedTime maLastUpdate
For the frame counter timings.
IBufferContextSharedPtr createBufferContext(const ::basegfx::B2IVector &rSize) const
create a pbuffer context (for rendering into background surface)
void renderRecordedActions() const
Write out recorded actions.
bool switchBuffer(bool bIsVisible, bool bUpdateAll)
css::uno::Reference< css::rendering::XColorSpace > getColorSpace() const
geometry::RealSize2D size2DFromSize(const Size &rSize)
rtl::Reference< OpenGLContext > mxContext
static void createFramebuffer(long nWidth, long nHeight, GLuint &nFramebufferId, GLuint &nRenderbufferDepthId, GLuint &nRenderbufferColorId)
static GLint LoadShaders(const OUString &rVertexShaderName, const OUString &rFragmentShaderName, const OUString &rGeometryShaderName, const OString &preamble, const OString &rDigest)
Size GetOutputSizePixel() const
css::uno::Reference< css::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > > &points)
void notifySizeUpdate(const css::awt::Rectangle &rBounds)
static void setupUniforms(unsigned int nProgramId, const ::basegfx::B2DHomMatrix &rTexTransform)
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
css::uno::Reference< css::rendering::XBitmap > createCompatibleAlphaBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
void init(vcl::Window &rWindow, SpriteCanvas &rSpriteCanvas, const css::awt::Rectangle &rViewArea)
void renderOSD(const std::vector< double > &rNumbers, double scale)
Product of this component's factory.
geometry::RealSize2D createInfiniteSize2D()
Create a RealSize2D with both coordinate values set to +infinity.
Definition: canvastools.cxx:68
#define SAL_INFO(area, stream)
css::uno::Reference< css::rendering::XBitmap > createCompatibleBitmap(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::geometry::IntegerSize2D &size)
void hide(const ::rtl::Reference< CanvasCustomSprite > &)
GLuint mnFrambufferId
css::geometry::RealSize2D getPhysicalResolution()
double getElapsedTime() const
Query the elapsed time.
Definition: elapsedtime.cxx:80
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites
css::uno::Reference< css::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(const css::uno::Reference< css::rendering::XGraphicDevice > &rDevice, const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > > &points)
void useLinearGradientShader(const css::rendering::ARGBColor *pColors, const css::uno::Sequence< double > &rStops, const ::basegfx::B2DHomMatrix &rTexTransform)
enable linear gradient shader "texture" with given parameters
SpriteCanvas * mpSpriteCanvas
Pointer to sprite canvas (owner of this helper), needed to create bitmaps.
uno::Reference< rendering::XIntegerBitmapColorSpace > const & getStdColorSpace()
Return a color space for a default RGBA integer format.