Qt 4.8
qwindowsurface_vgegl.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtOpenVG module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qwindowsurface_vgegl_p.h"
43 #include "qpaintengine_vg_p.h"
44 #include "qpixmapdata_vg_p.h"
45 #include "qvgimagepool_p.h"
46 #include "qvg_p.h"
47 
48 #if !defined(QT_NO_EGL)
49 
51 
52 // Turn off "direct to window" rendering if EGL cannot support it.
53 #if !defined(EGL_RENDER_BUFFER) || !defined(EGL_SINGLE_BUFFER)
54 #if defined(QVG_DIRECT_TO_WINDOW)
55 #undef QVG_DIRECT_TO_WINDOW
56 #endif
57 #endif
58 
59 // Determine if preserved window contents should be used.
60 #if !defined(EGL_SWAP_BEHAVIOR) || !defined(EGL_BUFFER_PRESERVED)
61 #if !defined(QVG_NO_PRESERVED_SWAP)
62 #define QVG_NO_PRESERVED_SWAP 1
63 #endif
64 #endif
65 
66 VGImageFormat qt_vg_config_to_vg_format(QEglContext *context)
67 {
70 }
71 
73 {
74  EGLint red = context->configAttrib(EGL_RED_SIZE);
75  EGLint green = context->configAttrib(EGL_GREEN_SIZE);
76  EGLint blue = context->configAttrib(EGL_BLUE_SIZE);
77  EGLint alpha = context->configAttrib(EGL_ALPHA_SIZE);
78  QImage::Format argbFormat;
79 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
80  EGLint type = context->configAttrib(EGL_SURFACE_TYPE);
81  if ((type & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
83  else
84  argbFormat = QImage::Format_ARGB32;
85 #else
86  argbFormat = QImage::Format_ARGB32;
87 #endif
88  if (red == 8 && green == 8 && blue == 8 && alpha == 8)
89  return argbFormat;
90  else if (red == 8 && green == 8 && blue == 8 && alpha == 0)
91  return QImage::Format_RGB32;
92  else if (red == 5 && green == 6 && blue == 5 && alpha == 0)
93  return QImage::Format_RGB16;
94  else if (red == 4 && green == 4 && blue == 4 && alpha == 4)
96  else
97  return argbFormat; // XXX
98 }
99 
100 #if !defined(QVG_NO_SINGLE_CONTEXT)
101 
103 {
104 public:
107 
109  int refCount;
112  EGLSurface surface;
114 };
115 
117  : context(0)
118  , refCount(0)
119  , widgetRefCount(0)
120  , engine(0)
121  , surface(EGL_NO_SURFACE)
122  , firstPixmap(0)
123 {
124 }
125 
127 {
128  // Don't accidentally destroy the QEglContext if the reference
129  // count falls to zero while deleting the paint engine.
130  ++refCount;
131 
132  if (context)
134  delete engine;
135  if (context)
136  context->doneCurrent();
137  if (context && surface != EGL_NO_SURFACE)
139  delete context;
140 }
141 
142 Q_GLOBAL_STATIC(QVGSharedContext, sharedContext);
143 
145 {
146  QVGSharedContext *shared = sharedContext();
147  if (!shared->engine)
148  shared->engine = new QVGPaintEngine();
149  return shared->engine;
150 }
151 
153 {
154  Q_UNUSED(engine);
155 }
156 
158 {
159  QVGSharedContext *shared = sharedContext();
160  pd->next = shared->firstPixmap;
161  pd->prev = 0;
162  if (shared->firstPixmap)
163  shared->firstPixmap->prev = pd;
164  shared->firstPixmap = pd;
165 }
166 
168 {
169  if (pd->next)
170  pd->next->prev = pd->prev;
171  if (pd->prev) {
172  pd->prev->next = pd->next;
173  } else {
174  QVGSharedContext *shared = sharedContext();
175  if (shared)
176  shared->firstPixmap = pd->next;
177  }
178 }
179 
180 #else
181 
183 {
184  return new QVGPaintEngine();
185 }
186 
188 {
189  delete engine;
190 }
191 
193 {
194  Q_UNUSED(pd);
195 }
196 
198 {
199  Q_UNUSED(pd);
200 }
201 
202 #endif
203 
204 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
205 
206 static bool isPremultipliedContext(const QEglContext *context)
207 {
208  return context->configAttrib(EGL_SURFACE_TYPE) & EGL_VG_ALPHA_FORMAT_PRE_BIT;
209 }
210 
211 #endif
212 
214 {
216 
217  // Create the context object and open the display.
218  context = new QEglContext();
219  context->setApi(QEgl::OpenVG);
220 
221  // Set the swap interval for the display.
222  QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL");
223  if (!interval.isEmpty())
224  eglSwapInterval(QEgl::display(), interval.toInt());
225  else
226  eglSwapInterval(QEgl::display(), 1);
227 
228 #ifdef EGL_RENDERABLE_TYPE
229  // Has the user specified an explicit EGL configuration to use?
230  QByteArray configId = qgetenv("QT_VG_EGL_CONFIG");
231  if (!configId.isEmpty()) {
232  EGLint cfgId = configId.toInt();
233  EGLint properties[] = {
234  EGL_CONFIG_ID, cfgId,
235  EGL_NONE
236  };
237  EGLint matching = 0;
238  EGLConfig cfg;
239  if (eglChooseConfig
240  (QEgl::display(), properties, &cfg, 1, &matching) &&
241  matching > 0) {
242  // Check that the selected configuration actually supports OpenVG
243  // and then create the context with it.
244  EGLint id = 0;
245  EGLint type = 0;
246  eglGetConfigAttrib
247  (QEgl::display(), cfg, EGL_CONFIG_ID, &id);
248  eglGetConfigAttrib
249  (QEgl::display(), cfg, EGL_RENDERABLE_TYPE, &type);
250  if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) {
251  context->setConfig(cfg);
252  if (!context->createContext()) {
253  delete context;
254  return 0;
255  }
256  return context;
257  } else {
258  qWarning("QT_VG_EGL_CONFIG: %d is not a valid OpenVG configuration", int(cfgId));
259  }
260  }
261  }
262 #endif
263 
264  // Choose an appropriate configuration for rendering into the device.
265  QEglProperties configProps;
266  configProps.setPaintDeviceFormat(device);
267  int redSize = configProps.value(EGL_RED_SIZE);
268  if (redSize == EGL_DONT_CARE || redSize == 0)
269  configProps.setPixelFormat(QImage::Format_ARGB32); // XXX
270  configProps.setValue(EGL_ALPHA_MASK_SIZE, 1);
271 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
272  configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT
273  | EGL_SWAP_BEHAVIOR_PRESERVED_BIT
274  | EGL_VG_ALPHA_FORMAT_PRE_BIT);
275  configProps.setRenderableType(QEgl::OpenVG);
276  if (!context->chooseConfig(configProps)) {
277  // Try again without the "pre" bit.
278  configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT);
279  if (!context->chooseConfig(configProps)) {
280  delete context;
281  return 0;
282  }
283  }
284 #else
285  configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT);
286  configProps.setRenderableType(QEgl::OpenVG);
287  if (!context->chooseConfig(configProps)) {
288  delete context;
289  return 0;
290  }
291 #endif
292 
293  // Construct a new EGL context for the selected configuration.
294  if (!context->createContext()) {
295  delete context;
296  return 0;
297  }
298 
299  return context;
300 }
301 
302 #if !defined(QVG_NO_SINGLE_CONTEXT)
303 
305 {
306  QVGSharedContext *shared = sharedContext();
307  if (devType == QInternal::Widget)
308  ++(shared->widgetRefCount);
309  if (shared->context) {
310  ++(shared->refCount);
311  return shared->context;
312  } else {
313  shared->context = createContext(device);
314  shared->refCount = 1;
315  return shared->context;
316  }
317 }
318 
320 {
322  delete shared->engine;
323  shared->engine = 0;
324  shared->context->doneCurrent();
325  if (shared->surface != EGL_NO_SURFACE) {
326  eglDestroySurface(QEgl::display(), shared->surface);
327  shared->surface = EGL_NO_SURFACE;
328  }
329  delete shared->context;
330  shared->context = 0;
331 }
332 
334 {
335  // Artificially increase the reference count to prevent the
336  // context from being destroyed until after we have finished
337  // the hibernation process.
338  ++(shared->refCount);
339 
340  // We need a context current to hibernate the VGImage objects.
342 
343  // Scan all QVGPixmapData objects in the system and hibernate them.
344  QVGPixmapData *pd = shared->firstPixmap;
345  while (pd != 0) {
346  pd->hibernate();
347  pd = pd->next;
348  }
349 
350  // Hibernate any remaining VGImage's in the image pool.
352 
353  // Don't need the current context any more.
354  shared->context->lazyDoneCurrent();
355 
356  // Decrease the reference count and destroy the context if necessary.
357  if (--(shared->refCount) <= 0)
359 }
360 
361 void qt_vg_destroy_context(QEglContext *context, int devType)
362 {
363  QVGSharedContext *shared = sharedContext();
364  if (shared->context != context) {
365  // This is not the shared context. Shouldn't happen!
366  delete context;
367  return;
368  }
369  if (devType == QInternal::Widget)
370  --(shared->widgetRefCount);
371  if (--(shared->refCount) <= 0) {
373  } else if (shared->widgetRefCount <= 0 && devType == QInternal::Widget) {
374  // All of the widget window surfaces have been destroyed
375  // but we still have VG pixmaps active. Ask them to hibernate
376  // to free up GPU resources until a widget is shown again.
377  // This may eventually cause the EGLContext to be destroyed
378  // because nothing in the system needs a context, which will
379  // free up even more GPU resources.
380  qt_vg_hibernate_pixmaps(shared);
381  }
382 }
383 
384 EGLSurface qt_vg_shared_surface(void)
385 {
386  QVGSharedContext *shared = sharedContext();
387  if (shared->surface == EGL_NO_SURFACE) {
388  EGLint attribs[7];
389  attribs[0] = EGL_WIDTH;
390  attribs[1] = 16;
391  attribs[2] = EGL_HEIGHT;
392  attribs[3] = 16;
393 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
394  if (isPremultipliedContext(shared->context)) {
395  attribs[4] = EGL_VG_ALPHA_FORMAT;
396  attribs[5] = EGL_VG_ALPHA_FORMAT_PRE;
397  attribs[6] = EGL_NONE;
398  } else
399 #endif
400  {
401  attribs[4] = EGL_NONE;
402  }
403  shared->surface = eglCreatePbufferSurface
404  (QEgl::display(), shared->context->config(), attribs);
405  }
406  return shared->surface;
407 }
408 
409 #else
410 
411 QEglContext *qt_vg_create_context(QPaintDevice *device, int devType)
412 {
413  Q_UNUSED(devType);
414  return createContext(device);
415 }
416 
417 void qt_vg_destroy_context(QEglContext *context, int devType)
418 {
419  Q_UNUSED(devType);
420  delete context;
421 }
422 
423 EGLSurface qt_vg_shared_surface(void)
424 {
425  return EGL_NO_SURFACE;
426 }
427 
428 #endif
429 
431 {
432  winSurface = win;
433  engine = 0;
434 }
435 
437 {
438  // Destroy the paint engine if it hasn't been destroyed already.
439  destroyPaintEngine();
440 }
441 
443 {
444  if (!engine)
445  engine = qt_vg_create_paint_engine();
446  return engine;
447 }
448 
450 {
451  return VG_INVALID_HANDLE;
452 }
453 
455 {
456  if (engine) {
458  engine = 0;
459  }
460 }
461 
463 {
464  Q_UNUSED(widget);
465 
466  QRect rect = winSurface->geometry();
467  QSize newSize = rect.size();
468 
469 #if defined(Q_WS_QWS)
470  // Account for the widget mask, if any.
471  if (widget && !widget->mask().isEmpty()) {
472  const QRegion region = widget->mask()
473  & rect.translated(-widget->geometry().topLeft());
474  newSize = region.boundingRect().size();
475  }
476 #endif
477 
478  return newSize;
479 }
480 
481 #if defined(QVG_VGIMAGE_BACKBUFFERS)
482 
483 QVGEGLWindowSurfaceVGImage::QVGEGLWindowSurfaceVGImage(QWindowSurface *win)
485  , context(0)
486  , backBuffer(VG_INVALID_HANDLE)
487  , backBufferSurface(EGL_NO_SURFACE)
488  , recreateBackBuffer(false)
489  , isPaintingActive(false)
490  , windowSurface(EGL_NO_SURFACE)
491 {
492 }
493 
494 QVGEGLWindowSurfaceVGImage::~QVGEGLWindowSurfaceVGImage()
495 {
496  destroyPaintEngine();
497  if (context) {
498  if (backBufferSurface != EGL_NO_SURFACE) {
499  // We need a current context to be able to destroy the image.
500  // We use the shared surface because the native window handle
501  // associated with "windowSurface" may have been destroyed already.
502  context->makeCurrent(qt_vg_shared_surface());
503  context->destroySurface(backBufferSurface);
504  vgDestroyImage(backBuffer);
505  context->doneCurrent();
506  }
507  if (windowSurface != EGL_NO_SURFACE)
508  context->destroySurface(windowSurface);
510  }
511 }
512 
513 QEglContext *QVGEGLWindowSurfaceVGImage::ensureContext(QWidget *widget)
514 {
515  QSize newSize = windowSurfaceSize(widget);
516  if (context && size != newSize) {
517  // The surface size has changed, so we need to recreate
518  // the back buffer. Keep the same context and paint engine.
519  size = newSize;
520  if (isPaintingActive)
521  context->doneCurrent();
522  isPaintingActive = false;
523  recreateBackBuffer = true;
524  }
525  if (!context) {
526  // Create a new EGL context. We create the surface in beginPaint().
527  size = newSize;
528  context = qt_vg_create_context(widget, QInternal::Widget);
529  if (!context)
530  return 0;
531  isPaintingActive = false;
532  }
533  return context;
534 }
535 
536 void QVGEGLWindowSurfaceVGImage::beginPaint(QWidget *widget)
537 {
538  QEglContext *context = ensureContext(widget);
539  if (context) {
540  if (recreateBackBuffer || backBufferSurface == EGL_NO_SURFACE) {
541  // Create a VGImage object to act as the back buffer
542  // for this window. We have to create the VGImage with a
543  // current context, so activate the main surface for the window.
544  context->makeCurrent(mainSurface());
545  recreateBackBuffer = false;
546  if (backBufferSurface != EGL_NO_SURFACE) {
547  eglDestroySurface(QEgl::display(), backBufferSurface);
548  backBufferSurface = EGL_NO_SURFACE;
549  }
550  if (backBuffer != VG_INVALID_HANDLE) {
551  vgDestroyImage(backBuffer);
552  }
553  VGImageFormat format = qt_vg_config_to_vg_format(context);
554  backBuffer = vgCreateImage
555  (format, size.width(), size.height(),
556  VG_IMAGE_QUALITY_FASTER);
557  if (backBuffer != VG_INVALID_HANDLE) {
558  // Create an EGL surface for rendering into the VGImage.
559  backBufferSurface = eglCreatePbufferFromClientBuffer
560  (QEgl::display(), EGL_OPENVG_IMAGE,
561  (EGLClientBuffer)(backBuffer),
562  context->config(), NULL);
563  if (backBufferSurface == EGL_NO_SURFACE) {
564  vgDestroyImage(backBuffer);
565  backBuffer = VG_INVALID_HANDLE;
566  }
567  }
568  }
569  if (backBufferSurface != EGL_NO_SURFACE)
570  context->makeCurrent(backBufferSurface);
571  else
572  context->makeCurrent(mainSurface());
573  isPaintingActive = true;
574  }
575 }
576 
577 void QVGEGLWindowSurfaceVGImage::endPaint
578  (QWidget *widget, const QRegion& region, QImage *image)
579 {
580  Q_UNUSED(region);
581  Q_UNUSED(image);
582  QEglContext *context = ensureContext(widget);
583  if (context) {
584  if (backBufferSurface != EGL_NO_SURFACE) {
585  if (isPaintingActive)
586  vgFlush();
587  context->lazyDoneCurrent();
588  }
589  isPaintingActive = false;
590  }
591 }
592 
593 VGImage QVGEGLWindowSurfaceVGImage::surfaceImage() const
594 {
595  return backBuffer;
596 }
597 
598 EGLSurface QVGEGLWindowSurfaceVGImage::mainSurface() const
599 {
600  if (windowSurface != EGL_NO_SURFACE)
601  return windowSurface;
602  else
603  return qt_vg_shared_surface();
604 }
605 
606 #endif // QVG_VGIMAGE_BACKBUFFERS
607 
610  , context(0)
611  , isPaintingActive(false)
612  , needToSwap(false)
613  , windowSurface(EGL_NO_SURFACE)
614 {
615 }
616 
618 {
620  if (context) {
621  if (windowSurface != EGL_NO_SURFACE)
622  context->destroySurface(windowSurface);
624  }
625 }
626 
628 {
629  QSize newSize = windowSurfaceSize(widget);
630  QEglProperties surfaceProps;
631 
632 #if defined(QVG_RECREATE_ON_SIZE_CHANGE)
633 #if !defined(QVG_NO_SINGLE_CONTEXT)
634  if (context && size != newSize) {
635  // The surface size has changed, so we need to recreate it.
636  // We can keep the same context and paint engine.
637  size = newSize;
638  if (isPaintingActive)
639  context->doneCurrent();
640  context->destroySurface(windowSurface);
641 #if defined(EGL_VG_ALPHA_FORMAT_PRE_BIT)
642  if (isPremultipliedContext(context)) {
643  surfaceProps.setValue
644  (EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
645  } else {
646  surfaceProps.removeValue(EGL_VG_ALPHA_FORMAT);
647  }
648 #endif
649  windowSurface = context->createSurface(widget, &surfaceProps);
650  isPaintingActive = false;
651  needToSwap = true;
652  }
653 #else
654  if (context && size != newSize) {
655  // The surface size has changed, so we need to recreate
656  // the EGL context for the widget. We also need to recreate
657  // the surface's paint engine if context sharing is not
658  // enabled because we cannot reuse the existing paint objects
659  // in the new context.
661  engine = 0;
662  context->destroySurface(windowSurface);
664  context = 0;
665  windowSurface = EGL_NO_SURFACE;
666  }
667 #endif
668 #endif
669  if (!context) {
670  // Create a new EGL context and bind it to the widget surface.
671  size = newSize;
672  context = qt_vg_create_context(widget, QInternal::Widget);
673  if (!context)
674  return 0;
675  // We want a direct to window rendering surface if possible.
676 #if defined(QVG_DIRECT_TO_WINDOW)
677  surfaceProps.setValue(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
678 #endif
679 #if defined(EGL_VG_ALPHA_FORMAT_PRE_BIT)
680  if (isPremultipliedContext(context)) {
681  surfaceProps.setValue
682  (EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
683  } else {
684  surfaceProps.removeValue(EGL_VG_ALPHA_FORMAT);
685  }
686 #endif
687  EGLSurface surface = context->createSurface(widget, &surfaceProps);
688  if (surface == EGL_NO_SURFACE) {
690  engine = 0;
692  context = 0;
693  return 0;
694  }
695  needToSwap = true;
696 #if defined(QVG_DIRECT_TO_WINDOW)
697  // Did we get a direct to window rendering surface?
698  EGLint buffer = 0;
699  if (eglQueryContext(QEgl::display(), context->context(),
700  EGL_RENDER_BUFFER, &buffer) &&
701  buffer == EGL_SINGLE_BUFFER) {
702  needToSwap = false;
703  }
704 #endif
705  windowSurface = surface;
706  isPaintingActive = false;
707  }
708 
709 #if !defined(QVG_NO_PRESERVED_SWAP)
710  // Try to force the surface back buffer to preserve its contents.
711  if (needToSwap) {
712  bool succeeded = eglSurfaceAttrib(QEgl::display(), windowSurface,
713  EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
714  if (!succeeded && eglGetError() != EGL_SUCCESS) {
715  qWarning("QVG: could not enable preserved swap");
716  }
717  }
718 #endif
719  return context;
720 }
721 
723 {
724  QEglContext *context = ensureContext(widget);
725  if (context) {
726  context->makeCurrent(windowSurface);
727  isPaintingActive = true;
728  }
729 }
730 
732  (QWidget *widget, const QRegion& region, QImage *image)
733 {
734  Q_UNUSED(region);
735  Q_UNUSED(image);
736  QEglContext *context = ensureContext(widget);
737  if (context) {
738  if (needToSwap) {
739  if (!isPaintingActive)
740  context->makeCurrent(windowSurface);
741  context->swapBuffers(windowSurface);
742  context->lazyDoneCurrent();
743  } else if (isPaintingActive) {
744  vgFlush();
745  context->lazyDoneCurrent();
746  }
747  isPaintingActive = false;
748  }
749 }
750 
752 {
753 #if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP)
754  return true;
755 #else
757 #endif
758 }
759 
760 bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy)
761 {
762 #ifdef QVG_BUFFER_SCROLLING
763  QEglContext *context = ensureContext(widget);
764  if (context) {
765  context->makeCurrent(windowSurface);
766  QRect scrollRect = area.boundingRect();
767  int sx = scrollRect.x();
768  int sy = size.height() - scrollRect.y() - scrollRect.height();
769  vgSeti(VG_SCISSORING, VG_FALSE);
770  vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height());
771  context->lazyDoneCurrent();
772  return true;
773  }
774 #else
775  Q_UNUSED(widget);
776  Q_UNUSED(area);
777  Q_UNUSED(dx);
778  Q_UNUSED(dy);
779 #endif
780  return false;
781 }
782 
784 
785 #endif
Format
The following image formats are available in Qt.
Definition: qimage.h:91
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
VGImageFormat qt_vg_image_to_vg_format(QImage::Format format)
EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties=0)
Definition: qegl.cpp:354
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool createContext(QEglContext *shareContext=0, const QEglProperties *properties=0)
Definition: qegl.cpp:361
QPointer< QWidget > widget
void qt_vg_hibernate_pixmaps(QVGSharedContext *shared)
QVGPaintEngine * qt_vg_create_paint_engine(void)
bool removeValue(int name)
QVGEGLWindowSurfacePrivate(QWindowSurface *win)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
EGLSurface qt_vg_shared_surface(void)
void qt_vg_destroy_paint_engine(QVGPaintEngine *engine)
QVGPixmapData * next
int value(int name) const
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
bool chooseConfig(const QEglProperties &properties, QEgl::PixelFormatMatch match=QEgl::ExactPixelFormat)
Definition: qegl.cpp:348
QVGPixmapData * prev
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void setValue(int name, int value)
bool swapBuffers(EGLSurface surface)
Definition: qegl.cpp:525
QImage::Format qt_vg_config_to_image_format(QEglContext *context)
EGLConfig config() const
Definition: qeglcontext_p.h:96
QVGPixmapData * firstPixmap
QEglContext * qt_vg_create_context(QPaintDevice *device, int devType)
EGLContext context() const
Definition: qeglcontext_p.h:91
void setApi(QEgl::API api)
Definition: qeglcontext_p.h:75
bool doneCurrent()
Definition: qegl.cpp:485
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
void endPaint(QWidget *widget, const QRegion &region, QImage *image)
void setRenderableType(QEgl::API api)
Q_GLOBAL_STATIC(QVGSharedContext, sharedContext)
virtual VGImage surfaceImage() const
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
void qt_vg_destroy_context(QEglContext *context, int devType)
Q_CORE_EXPORT void qWarning(const char *,...)
void * EGLClientBuffer
Definition: qegl_p.h:70
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static void qt_vg_destroy_shared_context(QVGSharedContext *shared)
static QEglContext * createContext(QPaintDevice *device)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QSize windowSurfaceSize(QWidget *widget) const
QRegion mask() const
Returns the mask currently set on a widget.
Definition: qwidget.cpp:10058
QVGEGLWindowSurfaceDirect(QWindowSurface *win)
The QWindowSurface class provides the drawing area for top-level windows.
int configAttrib(int name) const
Definition: qegl.cpp:568
QEglContext * ensureContext(QWidget *widget)
static QVGImagePool * instance()
bool lazyDoneCurrent()
Definition: qegl.cpp:519
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
bool makeCurrent(EGLSurface surface)
Definition: qegl.cpp:433
VGImageFormat qt_vg_config_to_vg_format(QEglContext *context)
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
void destroySurface(EGLSurface surface)
Definition: qegl.cpp:415
void setConfig(EGLConfig config)
Definition: qeglcontext_p.h:97
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void setPaintDeviceFormat(QPaintDevice *dev)
Definition: qegl_qpa.cpp:93
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
virtual void hibernate()
void setPixelFormat(QImage::Format pixelFormat)
void beginPaint(QWidget *widget)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
virtual void hibernate()
QVGPaintEngine * engine
void qt_vg_unregister_pixmap(QVGPixmapData *pd)
virtual bool supportsStaticContents() const
void qt_vg_register_pixmap(QVGPixmapData *pd)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
bool scroll(QWidget *widget, const QRegion &area, int dx, int dy)
static int area(const QSize &s)
Definition: qicon.cpp:155
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288