Skip to content
Permalink
Browse files
2009-10-06 Carol Szabo <carol.szabo@nokia.com>
        Reviewed by Ariya Hidayat.

        [Qt] Some functions in GraphicsContext do not work
        as expected if the associated painter has no clipping.
        https://bugs.webkit.org/show_bug.cgi?id=29691

        No new tests are associated with this because DumpRenderTree
        always sets clipping on the painter, thus it would never hit
        the test case, but fast/box-shadow/basic-shadows.html is a
        good example of what happens if the clipping is not set by
        the user of QtWebKit.

        * platform/graphics/qt/GraphicsContextQt.cpp:
        (WebCore::GraphicsContext::clipOut):
        (WebCore::GraphicsContext::clipOutEllipseInRect):
        Fixed to handle the case that there is no clipping
        before the call.

Canonical link: https://commits.webkit.org/40754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@49195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Oct 6, 2009
1 parent 052c639 commit 4897aed09fe55f68f2697459a2c1317409784dc5
Showing 2 changed files with 53 additions and 15 deletions.
@@ -1,3 +1,23 @@
2009-10-06 Carol Szabo <carol.szabo@nokia.com>

Reviewed by Ariya Hidayat.

[Qt] Some functions in GraphicsContext do not work
as expected if the associated painter has no clipping.
https://bugs.webkit.org/show_bug.cgi?id=29691

No new tests are associated with this because DumpRenderTree
always sets clipping on the painter, thus it would never hit
the test case, but fast/box-shadow/basic-shadows.html is a
good example of what happens if the clipping is not set by
the user of QtWebKit.

* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::clipOutEllipseInRect):
Fixed to handle the case that there is no clipping
before the call.

2009-10-06 Dave Hyatt <hyatt@apple.com>

Reviewed by Adam Roben.
@@ -1059,14 +1059,18 @@ void GraphicsContext::clipOut(const Path& path)
return;

QPainter* p = m_data->p();
QRectF clipBounds = p->clipPath().boundingRect();
QPainterPath clippedOut = *path.platformPath();
QPainterPath newClip;
newClip.setFillRule(Qt::OddEvenFill);
newClip.addRect(clipBounds);
newClip.addPath(clippedOut);

p->setClipPath(newClip, Qt::IntersectClip);
if (p->hasClipping()) {
newClip.addRect(p->clipPath().boundingRect());
newClip.addPath(clippedOut);
p->setClipPath(newClip, Qt::IntersectClip);
} else {
newClip.addRect(p->window());
newClip.addPath(clippedOut & newClip);
p->setClipPath(newClip);
}
}

void GraphicsContext::translate(float x, float y)
@@ -1125,13 +1129,20 @@ void GraphicsContext::clipOut(const IntRect& rect)
return;

QPainter* p = m_data->p();
QRectF clipBounds = p->clipPath().boundingRect();
QPainterPath newClip;
newClip.setFillRule(Qt::OddEvenFill);
newClip.addRect(clipBounds);
newClip.addRect(QRect(rect));

p->setClipPath(newClip, Qt::IntersectClip);
if (p->hasClipping()) {
newClip.addRect(p->clipPath().boundingRect());
newClip.addRect(QRect(rect));
p->setClipPath(newClip, Qt::IntersectClip);
} else {
QRect clipOutRect(rect);
QRect window(p->window());
clipOutRect &= window;
newClip.addRect(window);
newClip.addRect(clipOutRect);
p->setClipPath(newClip);
}
}

void GraphicsContext::clipOutEllipseInRect(const IntRect& rect)
@@ -1140,13 +1151,20 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect)
return;

QPainter* p = m_data->p();
QRectF clipBounds = p->clipPath().boundingRect();
QPainterPath newClip;
newClip.setFillRule(Qt::OddEvenFill);
newClip.addRect(clipBounds);
newClip.addEllipse(QRect(rect));

p->setClipPath(newClip, Qt::IntersectClip);
if (p->hasClipping()) {
newClip.addRect(p->clipPath().boundingRect());
newClip.addEllipse(QRect(rect));
p->setClipPath(newClip, Qt::IntersectClip);
} else {
QRect clipOutRect(rect);
QRect window(p->window());
clipOutRect &= window;
newClip.addRect(window);
newClip.addEllipse(clipOutRect);
p->setClipPath(newClip);
}
}

void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)

0 comments on commit 4897aed

Please sign in to comment.