diff options
Diffstat (limited to 'src/openvg')
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 69 | ||||
-rw-r--r-- | src/openvg/qpixmapfilter_vg_p.h | 8 | ||||
-rw-r--r-- | src/openvg/qvgcompositionhelper_p.h | 1 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vgegl.cpp | 7 |
4 files changed, 44 insertions, 41 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 94e0793..8a485a0 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3574,51 +3574,48 @@ void QVGCompositionHelper::fillBackground } } -void QVGCompositionHelper::drawCursorImage - (const QImage& image, const QPoint& offset) +void QVGCompositionHelper::drawCursorPixmap + (const QPixmap& pixmap, const QPoint& offset) { - QImage img = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + VGImage vgImage = VG_INVALID_HANDLE; - VGImage vgImg = vgCreateImage - (VG_sARGB_8888_PRE, img.width(), img.height(), - VG_IMAGE_QUALITY_FASTER); - vgImageSubData - (vgImg, img.bits() + img.bytesPerLine() * (img.height() - 1), - -(img.bytesPerLine()), VG_sARGB_8888_PRE, 0, 0, - img.width(), img.height()); + // Fetch the VGImage from the pixmap if possible. + QPixmapData *pd = pixmap.pixmapData(); + if (pd->classId() == QPixmapData::OpenVGClass) { + QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); + if (vgpd->isValid()) + vgImage = vgpd->toVGImage(); + } - QTransform transform; - int y = screenSize.height() - (offset.y() + img.height()); - transform.translate(offset.x() + 0.5f, y + 0.5f); + // Set the image transformation and modes. + VGfloat devh = screenSize.height() - 1; + QTransform transform(1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + -0.5f, devh + 0.5f, 1.0f); + transform.translate(offset.x(), offset.y()); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - d->setImageMode(VG_DRAW_IMAGE_NORMAL); - vgDrawImage(vgImg); - vgDestroyImage(vgImg); -} + // Draw the VGImage. + if (vgImage != VG_INVALID_HANDLE) { + vgDrawImage(vgImage); + } else { + QImage img = pixmap.toImage().convertToFormat + (QImage::Format_ARGB32_Premultiplied); -void QVGCompositionHelper::drawCursorPixmap - (const QPixmap& pixmap, const QPoint& offset) -{ - QPixmapData *pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::OpenVGClass) { - QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); - if (vgpd->isValid()) { - VGfloat devh = screenSize.height() - 1; - QTransform transform(1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - -0.5f, devh + 0.5f, 1.0f); - transform.translate(offset.x(), offset.y()); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - d->setImageMode(VG_DRAW_IMAGE_NORMAL); - vgDrawImage(vgpd->toVGImage()); + vgImage = vgCreateImage + (VG_sARGB_8888_PRE, img.width(), img.height(), + VG_IMAGE_QUALITY_FASTER); + if (vgImage == VG_INVALID_HANDLE) return; - } - } + vgImageSubData + (vgImage, img.bits() + img.bytesPerLine() * (img.height() - 1), + -(img.bytesPerLine()), VG_sARGB_8888_PRE, 0, 0, + img.width(), img.height()); - drawCursorImage(pixmap.toImage(), offset); + vgDrawImage(vgImage); + vgDestroyImage(vgImage); + } } void QVGCompositionHelper::setScissor(const QRegion& region) diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h index efbbc7b..29dd37e 100644 --- a/src/openvg/qpixmapfilter_vg_p.h +++ b/src/openvg/qpixmapfilter_vg_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE #if !defined(QT_SHIVAVG) -class Q_OPENVG_EXPORT QVGPixmapConvolutionFilter : public QPixmapConvolutionFilter +class QVGPixmapConvolutionFilter : public QPixmapConvolutionFilter { Q_OBJECT public: @@ -71,7 +71,7 @@ public: void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const; }; -class Q_OPENVG_EXPORT QVGPixmapColorizeFilter : public QPixmapColorizeFilter +class QVGPixmapColorizeFilter : public QPixmapColorizeFilter { Q_OBJECT public: @@ -81,7 +81,7 @@ public: void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const; }; -class Q_OPENVG_EXPORT QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter +class QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter { Q_OBJECT public: @@ -91,7 +91,7 @@ public: void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src) const; }; -class Q_OPENVG_EXPORT QVGPixmapBlurFilter : public QPixmapBlurFilter +class QVGPixmapBlurFilter : public QPixmapBlurFilter { Q_OBJECT public: diff --git a/src/openvg/qvgcompositionhelper_p.h b/src/openvg/qvgcompositionhelper_p.h index 6317c3f..3afe31e 100644 --- a/src/openvg/qvgcompositionhelper_p.h +++ b/src/openvg/qvgcompositionhelper_p.h @@ -74,7 +74,6 @@ public: void blitWindow(QVGEGLWindowSurfacePrivate *surface, const QRect& rect, const QPoint& topLeft, int opacity); void fillBackground(const QRegion& region, const QBrush& brush); - void drawCursorImage(const QImage& image, const QPoint& offset); void drawCursorPixmap(const QPixmap& pixmap, const QPoint& offset); void setScissor(const QRegion& region); void clearScissor(); diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 103f84d..29d82c8 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -193,6 +193,13 @@ static QEglContext *createContext(QPaintDevice *device) return 0; } + // Set the swap interval for the display. + QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL"); + if (!interval.isEmpty()) + eglSwapInterval(context->display(), interval.toInt()); + else + eglSwapInterval(context->display(), 1); + // Choose an appropriate configuration for rendering into the device. QEglProperties configProps; configProps.setPaintDeviceFormat(device); |