[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 12:04:56 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 1e5db7716517b5b0f654f6b713971f228f60bf64
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Aug 13 18:05:23 2010 +0000
2010-08-13 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r65331.
http://trac.webkit.org/changeset/65331
https://bugs.webkit.org/show_bug.cgi?id=43980
This patch breaks some shadow tests on Qt Linux release
(Requested by ariya on #webkit).
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::strokeArc):
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::drawFilledShadowPath):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::drawBorderlessRectShadow):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::clearPlatformShadow):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6acb859..4f69af6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-08-13 Sheriff Bot <webkit.review.bot at gmail.com>
+
+ Unreviewed, rolling out r65331.
+ http://trac.webkit.org/changeset/65331
+ https://bugs.webkit.org/show_bug.cgi?id=43980
+
+ This patch breaks some shadow tests on Qt Linux release
+ (Requested by ariya on #webkit).
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContext::drawRect):
+ (WebCore::GraphicsContext::drawLine):
+ (WebCore::GraphicsContext::strokeArc):
+ (WebCore::GraphicsContext::drawConvexPolygon):
+ (WebCore::drawFilledShadowPath):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::drawBorderlessRectShadow):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::fillRoundedRect):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ (WebCore::GraphicsContext::clearPlatformShadow):
+
2010-08-13 Kinuko Yasuda <kinuko at chromium.org>
Reviewed by David Levin.
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index a409328..cc331bc 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -199,21 +199,6 @@ public:
// Only used by SVG for now.
QPainterPath currentPath;
- enum {
- NoShadow,
- OpaqueSolidShadow,
- AlphaSolidShadow,
- BlurShadow
- } shadowType;
- QColor shadowColor;
- int shadowBlurRadius;
- QPointF shadowOffset;
-
- bool hasShadow() const
- {
- return shadowType != NoShadow;
- }
-
private:
QPainter* painter;
};
@@ -237,9 +222,6 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p)
painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
} else
antiAliasingForRectsAndLines = false;
-
- shadowType = NoShadow;
- shadowBlurRadius = 0;
}
GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
@@ -310,11 +292,16 @@ void GraphicsContext::drawRect(const IntRect& rect)
const bool antiAlias = p->testRenderHint(QPainter::Antialiasing);
p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines);
- if (m_data->hasShadow()) {
- IntRect shadowRect = rect;
- shadowRect.move(m_data->shadowOffset.x(), m_data->shadowOffset.y());
- shadowRect.inflate(static_cast<int>(p->pen().widthF()));
- p->fillRect(shadowRect, m_data->shadowColor);
+ if (m_common->state.shadowColor.isValid()) {
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (getShadow(shadowSize, shadowBlur, shadowColor)) {
+ IntRect shadowRect = rect;
+ shadowRect.move(shadowSize.width(), shadowSize.height());
+ shadowRect.inflate(static_cast<int>(p->pen().widthF()));
+ p->fillRect(shadowRect, QColor(shadowColor));
+ }
}
p->drawRect(rect);
@@ -344,14 +331,15 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines);
adjustLineToPixelBoundaries(p1, p2, width, style);
- if (m_data->hasShadow()) {
- if (textDrawingMode() == cTextFill) {
- p->save();
- p->translate(m_data->shadowOffset);
- p->setPen(m_data->shadowColor);
- p->drawLine(p1, p2);
- p->restore();
- }
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) {
+ p->save();
+ p->translate(shadowSize.width(), shadowSize.height());
+ p->setPen(shadowColor);
+ p->drawLine(p1, p2);
+ p->restore();
}
int patWidth = 0;
@@ -445,14 +433,16 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
const bool antiAlias = p->testRenderHint(QPainter::Antialiasing);
p->setRenderHint(QPainter::Antialiasing, true);
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
startAngle *= 16;
angleSpan *= 16;
-
- if (m_data->hasShadow()) {
+ if (getShadow(shadowSize, shadowBlur, shadowColor)) {
p->save();
- p->translate(m_data->shadowOffset);
+ p->translate(shadowSize.width(), shadowSize.height());
QPen pen(p->pen());
- pen.setColor(m_data->shadowColor);
+ pen.setColor(shadowColor);
p->setPen(pen);
p->drawArc(rect, startAngle, angleSpan);
p->restore();
@@ -478,14 +468,17 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
QPainter* p = m_data->p();
p->save();
p->setRenderHint(QPainter::Antialiasing, shouldAntialias);
- if (m_data->hasShadow()) {
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (getShadow(shadowSize, shadowBlur, shadowColor)) {
p->save();
- p->translate(m_data->shadowOffset);
+ p->translate(shadowSize.width(), shadowSize.height());
if (p->brush().style() != Qt::NoBrush)
- p->setBrush(QBrush(m_data->shadowColor));
+ p->setBrush(QBrush(shadowColor));
QPen pen(p->pen());
if (pen.style() != Qt::NoPen) {
- pen.setColor(m_data->shadowColor);
+ pen.setColor(shadowColor);
p->setPen(pen);
}
p->drawConvexPolygon(polygon);
@@ -519,6 +512,18 @@ QPen GraphicsContext::pen()
return p->pen();
}
+static void inline drawFilledShadowPath(GraphicsContext* context, QPainter* p, const QPainterPath& path)
+{
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (context->getShadow(shadowSize, shadowBlur, shadowColor)) {
+ p->translate(shadowSize.width(), shadowSize.height());
+ p->fillPath(path, QBrush(shadowColor));
+ p->translate(-shadowSize.width(), -shadowSize.height());
+ }
+}
+
void GraphicsContext::fillPath()
{
if (paintingDisabled())
@@ -528,11 +533,7 @@ void GraphicsContext::fillPath()
QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath
path.setFillRule(toQtFillRule(fillRule()));
- if (m_data->hasShadow()) {
- p->translate(m_data->shadowOffset);
- p->fillPath(path, m_data->shadowColor);
- p->translate(-m_data->shadowOffset);
- }
+ drawFilledShadowPath(this, p, path);
if (m_common->state.fillPattern) {
AffineTransform affine;
p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
@@ -556,12 +557,16 @@ void GraphicsContext::strokePath()
QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath
path.setFillRule(toQtFillRule(fillRule()));
- if (m_data->hasShadow()) {
- p->translate(m_data->shadowOffset);
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (getShadow(shadowSize, shadowBlur, shadowColor)) {
+ QTransform t(p->worldTransform());
+ p->translate(shadowSize.width(), shadowSize.height());
QPen shadowPen(pen);
- shadowPen.setColor(m_data->shadowColor);
+ shadowPen.setColor(shadowColor);
p->strokePath(path, shadowPen);
- p->translate(-m_data->shadowOffset);
+ p->setWorldTransform(t);
}
if (m_common->state.strokePattern) {
AffineTransform affine;
@@ -579,6 +584,18 @@ void GraphicsContext::strokePath()
m_data->currentPath = QPainterPath();
}
+static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* p, const FloatRect& rect)
+{
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (context->getShadow(shadowSize, shadowBlur, shadowColor)) {
+ FloatRect shadowRect(rect);
+ shadowRect.move(shadowSize.width(), shadowSize.height());
+ p->fillRect(shadowRect, QColor(shadowColor));
+ }
+}
+
static inline void drawRepeatPattern(QPainter* p, QPixmap* image, const FloatRect& rect, const bool repeatX, const bool repeatY)
{
// Patterns must be painted so that the top left of the first image is anchored at
@@ -654,18 +671,22 @@ void GraphicsContext::fillRect(const FloatRect& rect)
QPainter* p = m_data->p();
FloatRect normalizedRect = rect.normalized();
- QRectF shadowDestRect;
+ FloatSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ bool hasShadow = getShadow(shadowSize, shadowBlur, shadowColor);
+ FloatRect shadowDestRect;
QImage* shadowImage = 0;
QPainter* pShadow = 0;
- if (m_data->hasShadow()) {
+ if (hasShadow) {
shadowImage = new QImage(roundedIntSize(normalizedRect.size()), QImage::Format_ARGB32_Premultiplied);
pShadow = new QPainter(shadowImage);
shadowDestRect = normalizedRect;
- shadowDestRect.translate(m_data->shadowOffset);
+ shadowDestRect.move(shadowSize.width(), shadowSize.height());
pShadow->setCompositionMode(QPainter::CompositionMode_Source);
- pShadow->fillRect(shadowDestRect, m_data->shadowColor);
+ pShadow->fillRect(shadowImage->rect(), shadowColor);
pShadow->setCompositionMode(QPainter::CompositionMode_DestinationIn);
}
@@ -675,7 +696,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine));
QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame();
- if (m_data->hasShadow()) {
+ if (hasShadow) {
drawRepeatPattern(pShadow, image, FloatRect(static_cast<QRectF>(shadowImage->rect())), m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
pShadow->end();
p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect());
@@ -685,14 +706,14 @@ void GraphicsContext::fillRect(const FloatRect& rect)
QBrush brush(*m_common->state.fillGradient->platformGradient());
brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
- if (m_data->hasShadow()) {
+ if (hasShadow) {
pShadow->fillRect(shadowImage->rect(), brush);
pShadow->end();
p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect());
}
p->fillRect(normalizedRect, brush);
} else {
- if (m_data->hasShadow()) {
+ if (hasShadow) {
pShadow->fillRect(shadowImage->rect(), p->brush());
pShadow->end();
p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect());
@@ -712,10 +733,8 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS
m_data->solidColor.setColor(color);
QPainter* p = m_data->p();
-
- if (m_data->hasShadow())
- p->fillRect(QRectF(rect).translated(m_data->shadowOffset), m_data->shadowColor);
-
+ if (m_common->state.shadowColor.isValid())
+ drawBorderlessRectShadow(this, p, rect);
p->fillRect(rect, m_data->solidColor);
}
@@ -726,11 +745,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
Path path = Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight);
QPainter* p = m_data->p();
- if (m_data->hasShadow()) {
- p->translate(m_data->shadowOffset);
- p->fillPath(path.platformPath(), m_data->shadowColor);
- p->translate(-m_data->shadowOffset);
- }
+ drawFilledShadowPath(this, p, path.platformPath());
p->fillPath(path.platformPath(), QColor(color));
}
@@ -872,7 +887,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect)
return FloatRect(roundedOrigin, roundedLowerRight - roundedOrigin);
}
-void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const Color& color, ColorSpace)
+void GraphicsContext::setPlatformShadow(const FloatSize& size, float, const Color&, ColorSpace)
{
// Qt doesn't support shadows natively, they are drawn manually in the draw*
// functions
@@ -882,39 +897,12 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const
// We flip the height since CG and HTML5 Canvas have opposite Y axis
m_common->state.shadowSize = FloatSize(size.width(), -size.height());
}
-
- // Here we just store important shadow states.
-
- m_data->shadowBlurRadius = qRound(blur);
- m_data->shadowOffset = QPointF(m_common->state.shadowSize.width(), m_common->state.shadowSize.height());
- m_data->shadowColor = color;
-
- // The type of shadow is decided by the blur radius, shadow offset, and shadow color.
-
- if (!color.isValid() || !color.alpha()) {
- // Can't paint the shadow with invalid or invisible color.
- m_data->shadowType = GraphicsContextPlatformPrivate::NoShadow;
- } else {
- if (blur >= 1) {
- // Shadow is always blurred, even the offset is zero.
- m_data->shadowType = GraphicsContextPlatformPrivate::BlurShadow;
- } else {
- if (m_data->shadowOffset.isNull()) {
- // Without blur and zero offset means the shadow is fully hidden.
- m_data->shadowType = GraphicsContextPlatformPrivate::NoShadow;
- } else {
- if (color.hasAlpha())
- m_data->shadowType = GraphicsContextPlatformPrivate::AlphaSolidShadow;
- else
- m_data->shadowType = GraphicsContextPlatformPrivate::OpaqueSolidShadow;
- }
- }
- }
}
void GraphicsContext::clearPlatformShadow()
{
- m_data->shadowType = GraphicsContextPlatformPrivate::NoShadow;
+ // Qt doesn't support shadows natively, they are drawn manually in the draw*
+ // functions
}
void GraphicsContext::beginTransparencyLayer(float opacity)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list