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  std::copy(maActiveSprites.begin(),
286  maActiveSprites.end(),
287  std::back_insert_iterator<
288  std::vector< ::rtl::Reference< CanvasCustomSprite > > >(aSprites));
289  std::sort(aSprites.begin(),
290  aSprites.end(),
291  SpriteComparator());
292  for( const auto& rSprite : aSprites )
293  rSprite->renderSprite();
294 
295 
296  // frame counter, other info
297  glMatrixMode(GL_MODELVIEW);
298  glLoadIdentity();
299  glTranslated(-1.0, 1.0, 0.0);
300  glScaled( 2.0 / rOutputSize.Width(),
301  -2.0 / rOutputSize.Height(),
302  1.0 );
303 
304  const double denominator( maLastUpdate.getElapsedTime() );
306 
307  const double fps(denominator == 0.0 ? 100.0 : 1.0/denominator);
308  std::vector<double> aVec; aVec.push_back(fps);
309  aVec.push_back(maActiveSprites.size());
310  aVec.push_back(mpTextureCache->getCacheSize());
311  aVec.push_back(mpTextureCache->getCacheMissCount());
312  aVec.push_back(mpTextureCache->getCacheHitCount());
313  renderOSD( aVec, 20 );
314 
315  /*
316  * TODO: moggi: fix it!
317  // switch buffer, sync etc.
318  const unx::Window aXWindow=pChildWindow->GetSystemData()->aWindow;
319  unx::glXSwapBuffers(reinterpret_cast<unx::Display*>(mpDisplay),
320  aXWindow);
321  pChildWindow->Show();
322  unx::glXWaitGL();
323  XSync( reinterpret_cast<unx::Display*>(mpDisplay), false );
324  */
325  mxContext->swapBuffers();
326 
327  // flush texture cache, such that it does not build up
328  // indefinitely.
329  // TODO: have max cache size/LRU time in config, prune only on
330  // demand
331  mpTextureCache->prune();
332 
333  return true;
334  }
335 
336  bool SpriteDeviceHelper::switchBuffer( bool bIsVisible, bool bUpdateAll )
337  {
338  // no difference for VCL canvas
339  return showBuffer( bIsVisible, bUpdateAll );
340  }
341 
343  {
344  return css::uno::Any(false);
345  }
346 
348  {
349  const SystemChildWindow* pChildWindow = mxContext->getChildWindow();
350  return uno::Any( reinterpret_cast< sal_Int64 >(pChildWindow) );
351  }
352 
354  {
355  return uno::Any();
356  }
357 
358  uno::Reference<rendering::XColorSpace> SpriteDeviceHelper::getColorSpace() const
359  {
360  // always the same
362  }
363 
364  void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
365  {
366  if( mxContext->isInitialized() )
367  {
368  SystemChildWindow* pChildWindow = mxContext->getChildWindow();
369  pChildWindow->setPosSizePixel(
370  0,0,rBounds.Width,rBounds.Height);
371  }
372  }
373 
375  {
376  SAL_INFO("canvas.ogl", OSL_THIS_FUNC );
377  }
378 
379  void SpriteDeviceHelper::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
380  {
381  maActiveSprites.insert(xSprite);
382  }
383 
384  void SpriteDeviceHelper::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
385  {
386  maActiveSprites.erase(xSprite);
387  }
388 
389  static void setupUniforms( unsigned int nProgramId,
390  const ::basegfx::B2DHomMatrix& rTexTransform )
391  {
392  const GLint nTransformLocation = glGetUniformLocation(nProgramId,
393  "m_transform" );
394  // OGL is column-major
395  float aTexTransform[] =
396  {
397  float(rTexTransform.get(0,0)), float(rTexTransform.get(1,0)),
398  float(rTexTransform.get(0,1)), float(rTexTransform.get(1,1)),
399  float(rTexTransform.get(0,2)), float(rTexTransform.get(1,2))
400  };
401  glUniformMatrix3x2fv(nTransformLocation,1,false,aTexTransform);
402  }
403 
404  static void setupUniforms( unsigned int nProgramId,
405  const rendering::ARGBColor* pColors,
406  const uno::Sequence< double >& rStops,
407  const ::basegfx::B2DHomMatrix& rTexTransform )
408  {
409  glUseProgram(nProgramId);
410 
411  GLuint nColorsTexture;
412  glActiveTexture(GL_TEXTURE0);
413  glGenTextures(1, &nColorsTexture);
414  glBindTexture(GL_TEXTURE_1D, nColorsTexture);
415 
416  const sal_Int32 nColors=rStops.getLength();
417  glTexImage1D( GL_TEXTURE_1D, 0, GL_RGBA, nColors, 0, GL_RGBA, GL_DOUBLE, pColors );
418  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
419  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
420 
421  GLuint nStopsTexture;
422  glActiveTexture(GL_TEXTURE1);
423  glGenTextures(1, &nStopsTexture);
424  glBindTexture(GL_TEXTURE_1D, nStopsTexture);
425 
426  glTexImage1D( GL_TEXTURE_1D, 0, GL_ALPHA, nColors, 0, GL_ALPHA, GL_DOUBLE, rStops.getConstArray() );
427  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
428  glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
429 
430  const GLint nColorArrayLocation = glGetUniformLocation(nProgramId,
431  "t_colorArray4d" );
432  glUniform1i( nColorArrayLocation, 0 ); // unit 0
433 
434  const GLint nStopArrayLocation = glGetUniformLocation(nProgramId,
435  "t_stopArray1d" );
436  glUniform1i( nStopArrayLocation, 1 ); // unit 1
437 
438  const GLint nNumColorLocation = glGetUniformLocation(nProgramId,
439  "i_nColors" );
440  glUniform1i( nNumColorLocation, nColors-1 );
441 
442  setupUniforms(nProgramId,rTexTransform);
443  }
444 
445  static void setupUniforms( unsigned int nProgramId,
446  const rendering::ARGBColor& rStartColor,
447  const rendering::ARGBColor& rEndColor,
448  const ::basegfx::B2DHomMatrix& rTexTransform )
449  {
450  glUseProgram(nProgramId);
451 
452  const GLint nStartColorLocation = glGetUniformLocation(nProgramId,
453  "v_startColor4d" );
454  glUniform4f(nStartColorLocation,
455  rStartColor.Red,
456  rStartColor.Green,
457  rStartColor.Blue,
458  rStartColor.Alpha);
459 
460  const GLint nEndColorLocation = glGetUniformLocation(nProgramId,
461  "v_endColor4d" );
462  glUniform4f(nEndColorLocation,
463  rEndColor.Red,
464  rEndColor.Green,
465  rEndColor.Blue,
466  rEndColor.Alpha);
467 
468  setupUniforms(nProgramId,rTexTransform);
469  }
470 
471  void SpriteDeviceHelper::useLinearGradientShader( const rendering::ARGBColor* pColors,
472  const uno::Sequence< double >& rStops,
473  const ::basegfx::B2DHomMatrix& rTexTransform )
474  {
475  if( rStops.getLength() > 2 )
476  setupUniforms(mnLinearMultiColorGradientProgram, pColors, rStops, rTexTransform);
477  else
478  setupUniforms(mnLinearTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
479  }
480 
481  void SpriteDeviceHelper::useRadialGradientShader( const rendering::ARGBColor* pColors,
482  const uno::Sequence< double >& rStops,
483  const ::basegfx::B2DHomMatrix& rTexTransform )
484  {
485  if( rStops.getLength() > 2 )
486  setupUniforms(mnRadialMultiColorGradientProgram, pColors, rStops, rTexTransform);
487  else
488  setupUniforms(mnRadialTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
489  }
490 
491  void SpriteDeviceHelper::useRectangularGradientShader( const rendering::ARGBColor* pColors,
492  const uno::Sequence< double >& rStops,
493  const ::basegfx::B2DHomMatrix& rTexTransform )
494  {
495  if( rStops.getLength() > 2 )
496  setupUniforms(mnRectangularMultiColorGradientProgram, pColors, rStops, rTexTransform);
497  else
498  setupUniforms(mnRectangularTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
499  }
500 
501  namespace
502  {
503 
504  class BufferContextImpl : public IBufferContext
505  {
507  GLuint mnDepthId;
508  GLuint mnTextureId;
509 
510  virtual void startBufferRendering() override
511  {
512  glBindFramebuffer(GL_FRAMEBUFFER, mnFrambufferId);
513  }
514 
515  virtual void endBufferRendering() override
516  {
517  glBindFramebuffer(GL_FRAMEBUFFER, 0);
518  }
519 
520  virtual GLuint getTextureId() override
521  {
522  return mnTextureId;
523  }
524 
525  public:
526  explicit BufferContextImpl(const ::basegfx::B2IVector& rSize) :
527  mnFrambufferId(0),
528  mnDepthId(0),
529  mnTextureId(0)
530  {
531  OpenGLHelper::createFramebuffer(rSize.getX(), rSize.getY(), mnFrambufferId,
533  }
534 
535  virtual ~BufferContextImpl() override
536  {
537  glDeleteTextures(1, &mnTextureId);
538  glDeleteRenderbuffers(1, &mnDepthId);
539  glDeleteFramebuffers(1, &mnFrambufferId);
540  }
541  };
542  }
543 
544  IBufferContextSharedPtr SpriteDeviceHelper::createBufferContext(const ::basegfx::B2IVector& rSize) const
545  {
546  return std::make_shared<BufferContextImpl>(rSize);
547  }
548 
550  {
551  return *mpTextureCache;
552  }
553 }
554 
555 /* 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.
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
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:67
#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)
Reference< XComponentContext > mxContext
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.