diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-11-19 09:58:03 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-11-19 09:58:03 +0100 |
commit | 879e2ea7d15510ec5f94d6d7a005b157b115f69f (patch) | |
tree | 73aedd0bffe7ab39387229a9417aa50cecbbf0aa /src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | |
parent | 8fc2eec5b3282665f76f1e0313a03608bf4e7bc1 (diff) | |
parent | 80cd617b05ad3e647c87dc063d40cde0617344ca (diff) |
Merge remote branch 'origin/4.6' into lighthouse
Conflicts:
configure
src/plugins/graphicssystems/graphicssystems.pro
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 094054b293..57a481ae71 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -422,7 +422,7 @@ void GraphicsContext::drawRect(const IntRect& rect) IntRect shadowRect = rect; shadowRect.move(shadowSize.width(), shadowSize.height()); shadowRect.inflate(static_cast<int>(p->pen().widthF())); - p->fillRect(shadowRect, shadowColor); + p->fillRect(shadowRect, QColor(shadowColor)); } p->drawRect(rect); @@ -482,11 +482,11 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) // Do a rect fill of our endpoints. This ensures we always have the // appearance of being a border. We then draw the actual dotted/dashed line. if (isVerticalLine) { - p->fillRect(FloatRect(p1.x() - width / 2, p1.y() - width, width, width), color); - p->fillRect(FloatRect(p2.x() - width / 2, p2.y(), width, width), color); + p->fillRect(FloatRect(p1.x() - width / 2, p1.y() - width, width, width), QColor(color)); + p->fillRect(FloatRect(p2.x() - width / 2, p2.y(), width, width), QColor(color)); } else { - p->fillRect(FloatRect(p1.x() - width, p1.y() - width / 2, width, width), color); - p->fillRect(FloatRect(p2.x(), p2.y() - width / 2, width, width), color); + p->fillRect(FloatRect(p1.x() - width, p1.y() - width / 2, width, width), QColor(color)); + p->fillRect(FloatRect(p2.x(), p2.y() - width / 2, width, width), QColor(color)); } // Example: 80 pixels with a width of 30 pixels. @@ -718,7 +718,7 @@ static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { FloatRect shadowRect(rect); shadowRect.move(shadowSize.width(), shadowSize.height()); - p->fillRect(shadowRect, shadowColor); + p->fillRect(shadowRect, QColor(shadowColor)); } } @@ -1053,20 +1053,29 @@ void GraphicsContext::clip(const Path& path) m_data->p()->setClipPath(*path.platformPath(), Qt::IntersectClip); } +void GraphicsContext::canvasClip(const Path& path) +{ + clip(path); +} + void GraphicsContext::clipOut(const Path& path) { if (paintingDisabled()) 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 +1134,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 +1156,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*) |