diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-02-10 20:28:12 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-02-15 07:11:29 (GMT) |
commit | 0a84c39a92c4d4d7f2a5e19e949116df24219aa1 (patch) | |
tree | 8278c5c9d3c1acca044428f822af663a0084ed0f /src/openvg | |
parent | 04ddaa986504e3842920770927cb7247e5e0fb78 (diff) | |
download | Qt-0a84c39a92c4d4d7f2a5e19e949116df24219aa1.zip Qt-0a84c39a92c4d4d7f2a5e19e949116df24219aa1.tar.gz Qt-0a84c39a92c4d4d7f2a5e19e949116df24219aa1.tar.bz2 |
Fix for clipping failure in OpenVG paint engine.
OpenVG implementation for Broadcom chip has limited scissor rect
count to 32. Because of that Qt OpenVG paint engine fails to clip
correctly if clip rect count exceeds 32. This patch makes Qt
OpenVG paint engine to use mask instead of scissors in such cases.
Task-number: QTBUG-16932
Reviewed-by: Jason Barron
Diffstat (limited to 'src/openvg')
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 35 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vgegl.cpp | 3 |
2 files changed, 33 insertions, 5 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index a15f0c3..22cbbf5 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -2201,6 +2201,12 @@ void QVGPaintEngine::updateScissor() #if defined(QVG_SCISSOR_CLIP) // Using the scissor to do clipping, so combine the systemClip // with the current painting clipRegion. + + if (d->maskValid) { + vgSeti(VG_MASKING, VG_FALSE); + d->maskValid = false; + } + QVGPainterState *s = state(); if (s->clipEnabled) { if (region.isEmpty()) @@ -2250,8 +2256,33 @@ void QVGPaintEngine::updateScissor() QVector<QRect> rects = region.rects(); int count = rects.count(); - if (count > d->maxScissorRects) - count = d->maxScissorRects; + if (count > d->maxScissorRects) { +#if !defined(QVG_SCISSOR_CLIP) + count = d->maxScissorRects; +#else + // Use masking + int width = paintDevice()->width(); + int height = paintDevice()->height(); + vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, + 0, 0, width, height); + for (int i = 0; i < rects.size(); ++i) { + vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, + rects[i].x(), height - rects[i].y() - rects[i].height(), + rects[i].width(), rects[i].height()); + } + + vgSeti(VG_SCISSORING, VG_FALSE); + vgSeti(VG_MASKING, VG_TRUE); + d->maskValid = true; + d->maskIsSet = false; + d->scissorMask = false; + d->scissorActive = false; + d->scissorDirty = false; + d->scissorRegion = region; + return; +#endif + } + QVarLengthArray<VGint> params(count * 4); int height = paintDevice()->height(); for (int i = 0; i < count; ++i) { diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index c6db869..ca80886 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -267,10 +267,7 @@ static QEglContext *createContext(QPaintDevice *device) int redSize = configProps.value(EGL_RED_SIZE); if (redSize == EGL_DONT_CARE || redSize == 0) configProps.setPixelFormat(QImage::Format_ARGB32); // XXX -#ifndef QVG_SCISSOR_CLIP - // If we are using the mask to clip, then explicitly request a mask. configProps.setValue(EGL_ALPHA_MASK_SIZE, 1); -#endif #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT); |