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