[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
andreas.kling at nokia.com
andreas.kling at nokia.com
Wed Dec 22 18:24:22 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 390783121fa58729747230261d1f19ccadc8f763
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 10 16:05:12 2010 +0000
2010-12-10 Andreas Kling <kling at webkit.org>
Reviewed by Eric Seidel.
Don't do GraphicsContext save/restore just to preserve the CompositeOperator
https://bugs.webkit.org/show_bug.cgi?id=50070
Add GraphicsContext::compositeOperation() so we don't have to do a full
save/restore if the only context-tainting call is setCompositeOperation().
GraphicsContext::setCompositeOperation() now stores the op in its state
and calls a port-specific setPlatformCompositeOperation().
No new tests, this is an optimization.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::setCompositeOperation):
(WebCore::GraphicsContext::compositeOperation):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextPrivate.h:
(WebCore::GraphicsContextState::GraphicsContextState):
* platform/graphics/Image.cpp:
(WebCore::Image::fillWithSolidColor):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/haiku/GraphicsContextHaiku.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/skia/SkiaUtils.cpp:
(WebCore::WebCoreCompositeToSkiaComposite):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderView.cpp:
(WebCore::RenderView::paintBoxDecorations):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 73d21ee..6d61018 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,51 @@
+2010-12-10 Andreas Kling <kling at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Don't do GraphicsContext save/restore just to preserve the CompositeOperator
+ https://bugs.webkit.org/show_bug.cgi?id=50070
+
+ Add GraphicsContext::compositeOperation() so we don't have to do a full
+ save/restore if the only context-tainting call is setCompositeOperation().
+
+ GraphicsContext::setCompositeOperation() now stores the op in its state
+ and calls a port-specific setPlatformCompositeOperation().
+
+ No new tests, this is an optimization.
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::setCompositeOperation):
+ (WebCore::GraphicsContext::compositeOperation):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/GraphicsContextPrivate.h:
+ (WebCore::GraphicsContextState::GraphicsContextState):
+ * platform/graphics/Image.cpp:
+ (WebCore::Image::fillWithSolidColor):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/mac/GraphicsContextMac.mm:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/skia/GraphicsContextSkia.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/skia/SkiaUtils.cpp:
+ (WebCore::WebCoreCompositeToSkiaComposite):
+ * platform/graphics/wince/GraphicsContextWinCE.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * platform/graphics/wx/GraphicsContextWx.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::paintBoxDecorations):
+
2010-12-10 Renata Hodovan <reni at webkit.org>
Reviewed by Andreas Kling.
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index 5ee8bf8..6d32161 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -551,6 +551,17 @@ void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator)
generator.fill(this, rect);
}
+void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation)
+{
+ m_state.compositeOperator = compositeOperation;
+ setPlatformCompositeOperation(compositeOperation);
+}
+
+CompositeOperator GraphicsContext::compositeOperation() const
+{
+ return m_state.compositeOperator;
+}
+
#if !PLATFORM(SKIA)
void GraphicsContext::setPlatformFillGradient(Gradient*)
{
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index eee8b94..6872d8a 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -162,6 +162,7 @@ namespace WebCore {
, fillRule(RULE_NONZERO)
, strokeColorSpace(ColorSpaceDeviceRGB)
, fillColorSpace(ColorSpaceDeviceRGB)
+ , compositeOperator(CompositeSourceOver)
, shouldAntialias(true)
, paintingDisabled(false)
, shadowsIgnoreTransforms(false)
@@ -194,6 +195,8 @@ namespace WebCore {
ColorSpace strokeColorSpace;
ColorSpace fillColorSpace;
+ CompositeOperator compositeOperator;
+
bool shouldAntialias;
bool paintingDisabled;
bool shadowsIgnoreTransforms;
@@ -352,6 +355,7 @@ namespace WebCore {
#endif
void setCompositeOperation(CompositeOperator);
+ CompositeOperator compositeOperation() const;
#if PLATFORM(SKIA)
void beginPath();
@@ -498,6 +502,8 @@ namespace WebCore {
void setPlatformShadow(const FloatSize&, float blur, const Color&, ColorSpace);
void clearPlatformShadow();
+ void setPlatformCompositeOperation(CompositeOperator);
+
static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&);
GraphicsContextPlatformPrivate* m_data;
diff --git a/WebCore/platform/graphics/Image.cpp b/WebCore/platform/graphics/Image.cpp
index 6f2311c..3096680 100644
--- a/WebCore/platform/graphics/Image.cpp
+++ b/WebCore/platform/graphics/Image.cpp
@@ -81,10 +81,10 @@ void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect,
if (color.alpha() <= 0)
return;
- ctxt->save();
+ CompositeOperator previousOperator = ctxt->compositeOperation();
ctxt->setCompositeOperation(!color.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
ctxt->fillRect(dstRect, color, styleColorSpace);
- ctxt->restore();
+ ctxt->setCompositeOperation(previousOperator);
}
static inline FloatSize calculatePatternScale(const FloatRect& dstRect, const FloatRect& srcRect, Image::TileRule hRule, Image::TileRule vRule)
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 6c1c0df..5032f97 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -997,7 +997,7 @@ float GraphicsContext::getAlpha()
return m_state.globalAlpha;
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 0562b03..3d70fc2 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -1188,8 +1188,8 @@ void GraphicsContext::setPlatformShouldAntialias(bool enable)
CGContextSetShouldAntialias(platformContext(), enable);
}
-#ifndef BUILDING_ON_TIGER // Tiger's setCompositeOperation() is defined in GraphicsContextMac.mm.
-void GraphicsContext::setCompositeOperation(CompositeOperator mode)
+#ifndef BUILDING_ON_TIGER // Tiger's setPlatformCompositeOperation() is defined in GraphicsContextMac.mm.
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator mode)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index f634a98..38c1fb7 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -343,7 +343,7 @@ void GraphicsContext::setAlpha(float opacity)
notImplemented();
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
@@ -358,7 +358,7 @@ void GraphicsContext::setCompositeOperation(CompositeOperator op)
mode = B_OP_OVER;
break;
default:
- printf("GraphicsContext::setCompositeOperation: Unsupported composite operation %s\n",
+ printf("GraphicsContext::setPlatformCompositeOperation: Unsupported composite operation %s\n",
compositeOperatorName(op).utf8().data());
}
m_data->m_view->SetDrawingMode(mode);
diff --git a/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
index c149d70..6a4fa03 100644
--- a/WebCore/platform/graphics/mac/GraphicsContextMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
@@ -87,8 +87,8 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
drawFocusRingToContext(platformContext(), focusRingPath.get(), colorRef, radius);
}
-#ifdef BUILDING_ON_TIGER // Post-Tiger's setCompositeOperation() is defined in GraphicsContextCG.cpp.
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+#ifdef BUILDING_ON_TIGER // Post-Tiger's setPlatformCompositeOperation() is defined in GraphicsContextCG.cpp.
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index a0a62fb..633ca75 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -364,7 +364,7 @@ void GraphicsContext::setAlpha(float opacity)
m_data->setOpacity(opacity);
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 812b753..254235e 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -1130,13 +1130,17 @@ void GraphicsContext::setAlpha(float opacity)
p->setOpacity(opacity);
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
- if (m_data->p()->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
- m_data->p()->setCompositionMode(toQtCompositionMode(op));
+ QPainter* painter = m_data->p();
+
+ if (!painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
+ return;
+
+ painter->setCompositionMode(toQtCompositionMode(op));
}
void GraphicsContext::clip(const Path& path)
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 717664f..2113fd6 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -926,7 +926,7 @@ void GraphicsContext::setAlpha(float alpha)
platformContext()->setAlpha(alpha);
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/skia/SkiaUtils.cpp b/WebCore/platform/graphics/skia/SkiaUtils.cpp
index 7473e7a..bf34c2e 100644
--- a/WebCore/platform/graphics/skia/SkiaUtils.cpp
+++ b/WebCore/platform/graphics/skia/SkiaUtils.cpp
@@ -70,7 +70,7 @@ SkXfermode::Mode WebCoreCompositeToSkiaComposite(CompositeOperator op)
return (SkXfermode::Mode)table[i].m_xfermodeMode;
}
- SkDEBUGF(("GraphicsContext::setCompositeOperation uknown CompositeOperator %d\n", op));
+ SkDEBUGF(("GraphicsContext::setPlatformCompositeOperation unknown CompositeOperator %d\n", op));
return SkXfermode::kSrcOver_Mode; // fall-back
}
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 0328330..b01fff5 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -1173,7 +1173,7 @@ void GraphicsContext::setAlpha(float alpha)
m_data->m_opacity = alpha;
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
notImplemented();
}
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 755b138..cee6aee 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -442,7 +442,7 @@ void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
notImplemented();
}
-void GraphicsContext::setCompositeOperation(CompositeOperator op)
+void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
{
if (m_data->context)
{
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index bd19165..f985a20 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -671,10 +671,10 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
if (isOpaqueRoot) {
Color baseColor = view()->frameView()->baseBackgroundColor();
if (baseColor.alpha() > 0) {
- context->save();
+ CompositeOperator previousOperator = context->compositeOperation();
context->setCompositeOperation(CompositeCopy);
context->fillRect(rect, baseColor, style()->colorSpace());
- context->restore();
+ context->setCompositeOperation(previousOperator);
} else
context->clearRect(rect);
}
diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp
index 7ae1a5f..520664d 100644
--- a/WebCore/rendering/RenderView.cpp
+++ b/WebCore/rendering/RenderView.cpp
@@ -221,10 +221,10 @@ void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int, int)
else {
Color baseColor = frameView()->baseBackgroundColor();
if (baseColor.alpha() > 0) {
- paintInfo.context->save();
+ CompositeOperator previousOperator = paintInfo.context->compositeOperation();
paintInfo.context->setCompositeOperation(CompositeCopy);
paintInfo.context->fillRect(paintInfo.rect, baseColor, style()->colorSpace());
- paintInfo.context->restore();
+ paintInfo.context->setCompositeOperation(previousOperator);
} else
paintInfo.context->clearRect(paintInfo.rect);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list