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/qpaintengine_vg.cpp | |
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/qpaintengine_vg.cpp')
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 35 |
1 files changed, 33 insertions, 2 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) { |