From 0c6dfd680fa1e970c6bbb425cf05c9d42d70fe6f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 31 Aug 2009 15:55:19 +1000 Subject: Workaround possible webkit bug. (discussing with Simon) --- src/declarative/fx/qfxpainteditem.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp index 3d313c2..13f7e58 100644 --- a/src/declarative/fx/qfxpainteditem.cpp +++ b/src/declarative/fx/qfxpainteditem.cpp @@ -84,6 +84,10 @@ QT_BEGIN_NAMESPACE item in regards to height() and width(). */ +// XXX bug in WebKit - can call repaintRequested and other cache-changing functions from within render! +static int inpaint=0; +static int inpaint_clearcache=0; + /*! Marks areas of the cache that intersect with the given \a rect as dirty and in need of being refreshed. @@ -96,7 +100,7 @@ void QFxPaintedItem::dirtyCache(const QRect& rect) for (int i=0; i < d->imagecache.count(); ) { QFxPaintedItemPrivate::ImageCacheItem *c = d->imagecache[i]; QRect isect = (c->area & rect) | c->dirty; - if (isect == c->area) { + if (isect == c->area && !inpaint) { d->imagecache.removeAt(i); } else { c->dirty = isect; @@ -112,6 +116,10 @@ void QFxPaintedItem::dirtyCache(const QRect& rect) */ void QFxPaintedItem::clearCache() { + if (inpaint) { + inpaint_clearcache=1; + return; + } Q_D(QFxPaintedItem); qDeleteAll(d->imagecache); d->imagecache.clear(); @@ -189,6 +197,8 @@ void QFxPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidge if (content.width() <= 0 || content.height() <= 0) return; + ++inpaint; + bool oldAntiAliasing = p->testRenderHint(QPainter::Antialiasing); bool oldSmoothPixmap = p->testRenderHint(QPainter::SmoothPixmapTransform); if (oldAntiAliasing) @@ -274,6 +284,13 @@ void QFxPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidge p->setRenderHints(QPainter::Antialiasing, oldAntiAliasing); if (d->smooth) p->setRenderHints(QPainter::SmoothPixmapTransform, oldSmoothPixmap); + + if (inpaint_clearcache) { + clearCache(); + inpaint_clearcache = 0; + } + + --inpaint; } /*! -- cgit v0.12