[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
yutak at chromium.org
yutak at chromium.org
Wed Dec 22 18:09:59 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit a046e9c64fd9905764052822bd62ee4f764c94e0
Author: yutak at chromium.org <yutak at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 8 09:35:04 2010 +0000
2010-12-08 Yuta Kitamura <yutak at chromium.org>
Unreviewed, rolling out r73492.
http://trac.webkit.org/changeset/73492
https://bugs.webkit.org/show_bug.cgi?id=49914
Caused a lot of pixel test failures and broke Windows build.
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::createGraphicsContextPrivate):
(WebCore::GraphicsContext::destroyGraphicsContextPrivate):
(WebCore::GraphicsContext::save):
(WebCore::GraphicsContext::restore):
(WebCore::GraphicsContext::setStrokeThickness):
(WebCore::GraphicsContext::setStrokeStyle):
(WebCore::GraphicsContext::setStrokeColor):
(WebCore::GraphicsContext::setShadow):
(WebCore::GraphicsContext::clearShadow):
(WebCore::GraphicsContext::getShadow):
(WebCore::GraphicsContext::strokeThickness):
(WebCore::GraphicsContext::strokeStyle):
(WebCore::GraphicsContext::strokeColor):
(WebCore::GraphicsContext::strokeColorSpace):
(WebCore::GraphicsContext::fillRule):
(WebCore::GraphicsContext::setFillRule):
(WebCore::GraphicsContext::setFillColor):
(WebCore::GraphicsContext::fillColor):
(WebCore::GraphicsContext::fillColorSpace):
(WebCore::GraphicsContext::setShouldAntialias):
(WebCore::GraphicsContext::shouldAntialias):
(WebCore::GraphicsContext::setStrokePattern):
(WebCore::GraphicsContext::setFillPattern):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillGradient):
(WebCore::GraphicsContext::fillGradient):
(WebCore::GraphicsContext::strokeGradient):
(WebCore::GraphicsContext::fillPattern):
(WebCore::GraphicsContext::strokePattern):
(WebCore::GraphicsContext::setShadowsIgnoreTransforms):
(WebCore::GraphicsContext::updatingControlTints):
(WebCore::GraphicsContext::setUpdatingControlTints):
(WebCore::GraphicsContext::setPaintingDisabled):
(WebCore::GraphicsContext::paintingDisabled):
(WebCore::GraphicsContext::textDrawingMode):
(WebCore::GraphicsContext::setTextDrawingMode):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextPrivate.h: Added.
(WebCore::GraphicsContextState::GraphicsContextState):
(WebCore::GraphicsContextPrivate::GraphicsContextPrivate):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::setPlatformFill):
(WebCore::setPlatformStroke):
(WebCore::drawPathShadow):
(WebCore::fillCurrentCairoPath):
(WebCore::strokeCurrentCairoPath):
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::setAlpha):
(WebCore::GraphicsContext::getAlpha):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::applyStrokePattern):
(WebCore::GraphicsContext::applyFillPattern):
(WebCore::GraphicsContext::drawPath):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::strokeRect):
* platform/graphics/haiku/GraphicsContextHaiku.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::addInnerRoundedRectClip):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::setPlatformShadow):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::setPlatformShadow):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::GraphicsContext):
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContext::GraphicsContext):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRect):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f9dd043..8cec9aa 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,115 @@
+2010-12-08 Yuta Kitamura <yutak at chromium.org>
+
+ Unreviewed, rolling out r73492.
+ http://trac.webkit.org/changeset/73492
+ https://bugs.webkit.org/show_bug.cgi?id=49914
+
+ Caused a lot of pixel test failures and broke Windows build.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::createGraphicsContextPrivate):
+ (WebCore::GraphicsContext::destroyGraphicsContextPrivate):
+ (WebCore::GraphicsContext::save):
+ (WebCore::GraphicsContext::restore):
+ (WebCore::GraphicsContext::setStrokeThickness):
+ (WebCore::GraphicsContext::setStrokeStyle):
+ (WebCore::GraphicsContext::setStrokeColor):
+ (WebCore::GraphicsContext::setShadow):
+ (WebCore::GraphicsContext::clearShadow):
+ (WebCore::GraphicsContext::getShadow):
+ (WebCore::GraphicsContext::strokeThickness):
+ (WebCore::GraphicsContext::strokeStyle):
+ (WebCore::GraphicsContext::strokeColor):
+ (WebCore::GraphicsContext::strokeColorSpace):
+ (WebCore::GraphicsContext::fillRule):
+ (WebCore::GraphicsContext::setFillRule):
+ (WebCore::GraphicsContext::setFillColor):
+ (WebCore::GraphicsContext::fillColor):
+ (WebCore::GraphicsContext::fillColorSpace):
+ (WebCore::GraphicsContext::setShouldAntialias):
+ (WebCore::GraphicsContext::shouldAntialias):
+ (WebCore::GraphicsContext::setStrokePattern):
+ (WebCore::GraphicsContext::setFillPattern):
+ (WebCore::GraphicsContext::setStrokeGradient):
+ (WebCore::GraphicsContext::setFillGradient):
+ (WebCore::GraphicsContext::fillGradient):
+ (WebCore::GraphicsContext::strokeGradient):
+ (WebCore::GraphicsContext::fillPattern):
+ (WebCore::GraphicsContext::strokePattern):
+ (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
+ (WebCore::GraphicsContext::updatingControlTints):
+ (WebCore::GraphicsContext::setUpdatingControlTints):
+ (WebCore::GraphicsContext::setPaintingDisabled):
+ (WebCore::GraphicsContext::paintingDisabled):
+ (WebCore::GraphicsContext::textDrawingMode):
+ (WebCore::GraphicsContext::setTextDrawingMode):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/GraphicsContextPrivate.h: Added.
+ (WebCore::GraphicsContextState::GraphicsContextState):
+ (WebCore::GraphicsContextPrivate::GraphicsContextPrivate):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::setPlatformFill):
+ (WebCore::setPlatformStroke):
+ (WebCore::drawPathShadow):
+ (WebCore::fillCurrentCairoPath):
+ (WebCore::strokeCurrentCairoPath):
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ (WebCore::GraphicsContext::strokeRect):
+ (WebCore::GraphicsContext::setAlpha):
+ (WebCore::GraphicsContext::getAlpha):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ (WebCore::GraphicsContext::applyStrokePattern):
+ (WebCore::GraphicsContext::applyFillPattern):
+ (WebCore::GraphicsContext::drawPath):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ (WebCore::GraphicsContext::strokeRect):
+ * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::clip):
+ (WebCore::GraphicsContext::clipOut):
+ (WebCore::GraphicsContext::addInnerRoundedRectClip):
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ * platform/graphics/skia/GraphicsContextSkia.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ * platform/graphics/win/GraphicsContextCGWin.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ * platform/graphics/win/GraphicsContextCairoWin.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ * platform/graphics/wince/GraphicsContextWinCE.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::fillRect):
+ * platform/graphics/wx/GraphicsContextWx.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::~GraphicsContext):
+
2010-12-08 Dai Mikurube <dmikurube at google.com>
Reviewed by Kent Tamura.
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index c30b0e8..4f1616c 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3926,7 +3926,7 @@
A8F4FB960C169E85002AFED5 /* SVGRenderSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F4FB950C169E85002AFED5 /* SVGRenderSupport.cpp */; };
A8F5C0B80F9285AC0098E06B /* RenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */; };
A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F5C0B70F9285AC0098E06B /* RenderSVGModelObject.cpp */; };
- A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; };
A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */; };
A9C6E4E30D745E05006442E9 /* DOMMimeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */; };
A9C6E4E40D745E05006442E9 /* DOMMimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = A9C6E4E20D745E05006442E9 /* DOMMimeType.h */; };
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index c05ac0b..2edcc6d 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -29,6 +29,7 @@
#include "BidiResolver.h"
#include "Font.h"
#include "Generator.h"
+#include "GraphicsContextPrivate.h"
#include "ImageBuffer.h"
using namespace std;
@@ -73,14 +74,14 @@ private:
int m_offset;
};
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContext)
+GraphicsContextPrivate* GraphicsContext::createGraphicsContextPrivate()
{
- platformInit(platformGraphicsContext);
+ return new GraphicsContextPrivate;
}
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::destroyGraphicsContextPrivate(GraphicsContextPrivate* deleteMe)
{
- platformDestroy();
+ delete deleteMe;
}
void GraphicsContext::save()
@@ -88,7 +89,7 @@ void GraphicsContext::save()
if (paintingDisabled())
return;
- m_stack.append(m_state);
+ m_common->stack.append(m_common->state);
savePlatformState();
}
@@ -98,125 +99,120 @@ void GraphicsContext::restore()
if (paintingDisabled())
return;
- if (m_stack.isEmpty()) {
+ if (m_common->stack.isEmpty()) {
LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty");
return;
}
- m_state = m_stack.last();
- m_stack.removeLast();
+ m_common->state = m_common->stack.last();
+ m_common->stack.removeLast();
restorePlatformState();
}
void GraphicsContext::setStrokeThickness(float thickness)
{
- m_state.strokeThickness = thickness;
+ m_common->state.strokeThickness = thickness;
setPlatformStrokeThickness(thickness);
}
void GraphicsContext::setStrokeStyle(const StrokeStyle& style)
{
- m_state.strokeStyle = style;
+ m_common->state.strokeStyle = style;
setPlatformStrokeStyle(style);
}
void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace)
{
- m_state.strokeColor = color;
- m_state.strokeColorSpace = colorSpace;
- m_state.strokeGradient.clear();
- m_state.strokePattern.clear();
+ m_common->state.strokeColor = color;
+ m_common->state.strokeColorSpace = colorSpace;
+ m_common->state.strokeGradient.clear();
+ m_common->state.strokePattern.clear();
setPlatformStrokeColor(color, colorSpace);
}
void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace)
{
- m_state.shadowOffset = offset;
- m_state.shadowBlur = blur;
- m_state.shadowColor = color;
+ m_common->state.shadowOffset = offset;
+ m_common->state.shadowBlur = blur;
+ m_common->state.shadowColor = color;
setPlatformShadow(offset, blur, color, colorSpace);
}
void GraphicsContext::clearShadow()
{
- m_state.shadowOffset = FloatSize();
- m_state.shadowBlur = 0;
- m_state.shadowColor = Color();
+ m_common->state.shadowOffset = FloatSize();
+ m_common->state.shadowBlur = 0;
+ m_common->state.shadowColor = Color();
clearPlatformShadow();
}
bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color) const
{
- offset = m_state.shadowOffset;
- blur = m_state.shadowBlur;
- color = m_state.shadowColor;
+ offset = m_common->state.shadowOffset;
+ blur = m_common->state.shadowBlur;
+ color = m_common->state.shadowColor;
return color.isValid() && color.alpha() && (blur || offset.width() || offset.height());
}
float GraphicsContext::strokeThickness() const
{
- return m_state.strokeThickness;
+ return m_common->state.strokeThickness;
}
StrokeStyle GraphicsContext::strokeStyle() const
{
- return m_state.strokeStyle;
+ return m_common->state.strokeStyle;
}
Color GraphicsContext::strokeColor() const
{
- return m_state.strokeColor;
+ return m_common->state.strokeColor;
}
ColorSpace GraphicsContext::strokeColorSpace() const
{
- return m_state.strokeColorSpace;
+ return m_common->state.strokeColorSpace;
}
WindRule GraphicsContext::fillRule() const
{
- return m_state.fillRule;
+ return m_common->state.fillRule;
}
void GraphicsContext::setFillRule(WindRule fillRule)
{
- m_state.fillRule = fillRule;
+ m_common->state.fillRule = fillRule;
}
void GraphicsContext::setFillColor(const Color& color, ColorSpace colorSpace)
{
- m_state.fillColor = color;
- m_state.fillColorSpace = colorSpace;
- m_state.fillGradient.clear();
- m_state.fillPattern.clear();
+ m_common->state.fillColor = color;
+ m_common->state.fillColorSpace = colorSpace;
+ m_common->state.fillGradient.clear();
+ m_common->state.fillPattern.clear();
setPlatformFillColor(color, colorSpace);
}
Color GraphicsContext::fillColor() const
{
- return m_state.fillColor;
+ return m_common->state.fillColor;
}
ColorSpace GraphicsContext::fillColorSpace() const
{
- return m_state.fillColorSpace;
+ return m_common->state.fillColorSpace;
}
void GraphicsContext::setShouldAntialias(bool b)
{
- m_state.shouldAntialias = b;
+ m_common->state.shouldAntialias = b;
setPlatformShouldAntialias(b);
}
bool GraphicsContext::shouldAntialias() const
{
- return m_state.shouldAntialias;
-}
-
-const GraphicsContextState& GraphicsContext::state() const
-{
- return m_state;
+ return m_common->state.shouldAntialias;
}
void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
@@ -226,9 +222,9 @@ void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
setStrokeColor(Color::black, ColorSpaceDeviceRGB);
return;
}
- m_state.strokeGradient.clear();
- m_state.strokePattern = pattern;
- setPlatformStrokePattern(m_state.strokePattern.get());
+ m_common->state.strokeGradient.clear();
+ m_common->state.strokePattern = pattern;
+ setPlatformStrokePattern(m_common->state.strokePattern.get());
}
void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
@@ -238,9 +234,9 @@ void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
setFillColor(Color::black, ColorSpaceDeviceRGB);
return;
}
- m_state.fillGradient.clear();
- m_state.fillPattern = pattern;
- setPlatformFillPattern(m_state.fillPattern.get());
+ m_common->state.fillGradient.clear();
+ m_common->state.fillPattern = pattern;
+ setPlatformFillPattern(m_common->state.fillPattern.get());
}
void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
@@ -250,9 +246,9 @@ void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
setStrokeColor(Color::black, ColorSpaceDeviceRGB);
return;
}
- m_state.strokeGradient = gradient;
- m_state.strokePattern.clear();
- setPlatformStrokeGradient(m_state.strokeGradient.get());
+ m_common->state.strokeGradient = gradient;
+ m_common->state.strokePattern.clear();
+ setPlatformStrokeGradient(m_common->state.strokeGradient.get());
}
void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
@@ -262,55 +258,55 @@ void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
setFillColor(Color::black, ColorSpaceDeviceRGB);
return;
}
- m_state.fillGradient = gradient;
- m_state.fillPattern.clear();
- setPlatformFillGradient(m_state.fillGradient.get());
+ m_common->state.fillGradient = gradient;
+ m_common->state.fillPattern.clear();
+ setPlatformFillGradient(m_common->state.fillGradient.get());
}
Gradient* GraphicsContext::fillGradient() const
{
- return m_state.fillGradient.get();
+ return m_common->state.fillGradient.get();
}
Gradient* GraphicsContext::strokeGradient() const
{
- return m_state.strokeGradient.get();
+ return m_common->state.strokeGradient.get();
}
Pattern* GraphicsContext::fillPattern() const
{
- return m_state.fillPattern.get();
+ return m_common->state.fillPattern.get();
}
Pattern* GraphicsContext::strokePattern() const
{
- return m_state.strokePattern.get();
+ return m_common->state.strokePattern.get();
}
void GraphicsContext::setShadowsIgnoreTransforms(bool ignoreTransforms)
{
- m_state.shadowsIgnoreTransforms = ignoreTransforms;
+ m_common->state.shadowsIgnoreTransforms = ignoreTransforms;
}
bool GraphicsContext::updatingControlTints() const
{
- return m_updatingControlTints;
+ return m_common->m_updatingControlTints;
}
void GraphicsContext::setUpdatingControlTints(bool b)
{
setPaintingDisabled(b);
- m_updatingControlTints = b;
+ m_common->m_updatingControlTints = b;
}
void GraphicsContext::setPaintingDisabled(bool f)
{
- m_state.paintingDisabled = f;
+ m_common->state.paintingDisabled = f;
}
bool GraphicsContext::paintingDisabled() const
{
- return m_state.paintingDisabled;
+ return m_common->state.paintingDisabled;
}
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
@@ -532,12 +528,12 @@ void GraphicsContext::clipToImageBuffer(ImageBuffer* buffer, const FloatRect& re
TextDrawingModeFlags GraphicsContext::textDrawingMode() const
{
- return m_state.textDrawingMode;
+ return m_common->state.textDrawingMode;
}
void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
{
- m_state.textDrawingMode = mode;
+ m_common->state.textDrawingMode = mode;
if (paintingDisabled())
return;
setPlatformTextDrawingMode(mode);
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 9c2cdd5..3bda553 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -30,11 +30,9 @@
#include "ColorSpace.h"
#include "DashArray.h"
#include "FloatRect.h"
-#include "Gradient.h"
#include "Image.h"
#include "IntRect.h"
#include "Path.h"
-#include "Pattern.h"
#include "TextDirection.h"
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
@@ -119,9 +117,12 @@ namespace WebCore {
class DrawingBuffer;
class Font;
class Generator;
+ class Gradient;
class GraphicsContextPlatformPrivate;
+ class GraphicsContextPrivate;
class ImageBuffer;
class KURL;
+ class Pattern;
class SharedGraphicsContext3D;
class TextRun;
@@ -148,57 +149,6 @@ namespace WebCore {
InterpolationHigh
};
- struct GraphicsContextState {
- GraphicsContextState()
- : strokeThickness(0)
- , shadowBlur(0)
-#if PLATFORM(CAIRO)
- , globalAlpha(1)
-#endif
- , textDrawingMode(TextModeFill)
- , strokeColor(Color::black)
- , fillColor(Color::black)
- , strokeStyle(SolidStroke)
- , fillRule(RULE_NONZERO)
- , strokeColorSpace(ColorSpaceDeviceRGB)
- , fillColorSpace(ColorSpaceDeviceRGB)
- , shouldAntialias(true)
- , paintingDisabled(false)
- , shadowsIgnoreTransforms(false)
- {
- }
-
- RefPtr<Gradient> strokeGradient;
- RefPtr<Pattern> strokePattern;
-
- RefPtr<Gradient> fillGradient;
- RefPtr<Pattern> fillPattern;
-
- FloatSize shadowOffset;
-
- float strokeThickness;
- float shadowBlur;
-
-#if PLATFORM(CAIRO)
- float globalAlpha;
-#endif
- TextDrawingModeFlags textDrawingMode;
-
- Color strokeColor;
- Color fillColor;
- Color shadowColor;
-
- StrokeStyle strokeStyle;
- WindRule fillRule;
-
- ColorSpace strokeColorSpace;
- ColorSpace fillColorSpace;
-
- bool shouldAntialias;
- bool paintingDisabled;
- bool shadowsIgnoreTransforms;
- };
-
class GraphicsContext : public Noncopyable {
public:
GraphicsContext(PlatformGraphicsContext*);
@@ -239,8 +189,6 @@ namespace WebCore {
void setShouldAntialias(bool);
bool shouldAntialias() const;
- const GraphicsContextState& state() const;
-
#if PLATFORM(CG)
void applyStrokePattern();
void applyFillPattern();
@@ -393,7 +341,7 @@ namespace WebCore {
void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext.
void drawRoundCorner(bool newClip, RECT clipRect, RECT rectWin, HDC dc, int width, int height);
#elif PLATFORM(WIN)
- void platformInit(HDC, bool hasAlpha = false);
+ GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed.
bool inTransparencyLayer() const;
HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext.
@@ -470,9 +418,6 @@ namespace WebCore {
void markDirtyRect(const IntRect&); // Hints that a portion of the backing store is dirty.
private:
- void platformInit(PlatformGraphicsContext*);
- void platformDestroy();
-
void savePlatformState();
void restorePlatformState();
@@ -496,11 +441,11 @@ namespace WebCore {
static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&);
- GraphicsContextPlatformPrivate* m_data;
+ static GraphicsContextPrivate* createGraphicsContextPrivate();
+ static void destroyGraphicsContextPrivate(GraphicsContextPrivate*);
- GraphicsContextState m_state;
- Vector<GraphicsContextState> m_stack;
- bool m_updatingControlTints;
+ GraphicsContextPrivate* m_common;
+ GraphicsContextPlatformPrivate* m_data; // Deprecated; m_commmon can just be downcasted. To be removed.
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
new file mode 100644
index 0000000..9288df4
--- /dev/null
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsContextPrivate_h
+#define GraphicsContextPrivate_h
+
+#include "Gradient.h"
+#include "GraphicsContext.h"
+#include "Pattern.h"
+
+namespace WebCore {
+
+ struct GraphicsContextState {
+ GraphicsContextState()
+ : strokeThickness(0)
+ , shadowBlur(0)
+#if PLATFORM(CAIRO)
+ , globalAlpha(1)
+#endif
+ , textDrawingMode(TextModeFill)
+ , strokeColor(Color::black)
+ , fillColor(Color::black)
+ , strokeStyle(SolidStroke)
+ , fillRule(RULE_NONZERO)
+ , strokeColorSpace(ColorSpaceDeviceRGB)
+ , fillColorSpace(ColorSpaceDeviceRGB)
+ , shouldAntialias(true)
+ , paintingDisabled(false)
+ , shadowsIgnoreTransforms(false)
+ {
+ }
+
+ RefPtr<Gradient> strokeGradient;
+ RefPtr<Pattern> strokePattern;
+
+ RefPtr<Gradient> fillGradient;
+ RefPtr<Pattern> fillPattern;
+
+ FloatSize shadowOffset;
+
+ float strokeThickness;
+ float shadowBlur;
+
+#if PLATFORM(CAIRO)
+ float globalAlpha;
+#endif
+ TextDrawingModeFlags textDrawingMode;
+
+ Color strokeColor;
+ Color fillColor;
+ Color shadowColor;
+
+ StrokeStyle strokeStyle;
+ WindRule fillRule;
+
+ ColorSpace strokeColorSpace;
+ ColorSpace fillColorSpace;
+
+ bool shouldAntialias;
+ bool paintingDisabled;
+ bool shadowsIgnoreTransforms;
+ };
+
+ class GraphicsContextPrivate : public Noncopyable {
+ public:
+ GraphicsContextPrivate()
+ : m_updatingControlTints(false)
+ {
+ }
+
+ GraphicsContextState state;
+ Vector<GraphicsContextState> stack;
+ bool m_updatingControlTints;
+ };
+
+} // namespace WebCore
+
+#endif // GraphicsContextPrivate_h
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 6c1c0df..2548c5e 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -41,6 +41,7 @@
#include "FloatRect.h"
#include "Font.h"
#include "GraphicsContextPlatformPrivateCairo.h"
+#include "GraphicsContextPrivate.h"
#include "OwnPtrCairo.h"
#include "IntRect.h"
#include "NotImplemented.h"
@@ -68,46 +69,42 @@ using namespace std;
namespace WebCore {
-static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr)
+static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
{
cairo_pattern_t* pattern = 0;
cairo_save(cr);
-
- const GraphicsContextState& state = context->state();
- if (state.fillPattern) {
+ if (gcp->state.fillPattern) {
AffineTransform affine;
- pattern = state.fillPattern->createPlatformPattern(affine);
+ pattern = gcp->state.fillPattern->createPlatformPattern(affine);
cairo_set_source(cr, pattern);
- } else if (state.fillGradient)
- cairo_set_source(cr, state.fillGradient->platformGradient());
+ } else if (gcp->state.fillGradient)
+ cairo_set_source(cr, gcp->state.fillGradient->platformGradient());
else
setSourceRGBAFromColor(cr, context->fillColor());
cairo_clip_preserve(cr);
- cairo_paint_with_alpha(cr, state.globalAlpha);
+ cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
cairo_restore(cr);
if (pattern)
cairo_pattern_destroy(pattern);
}
-static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr)
+static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
{
cairo_pattern_t* pattern = 0;
cairo_save(cr);
-
- const GraphicsContextState& state = context->state();
- if (state.strokePattern) {
+ if (gcp->state.strokePattern) {
AffineTransform affine;
- pattern = state.strokePattern->createPlatformPattern(affine);
+ pattern = gcp->state.strokePattern->createPlatformPattern(affine);
cairo_set_source(cr, pattern);
- } else if (state.strokeGradient)
- cairo_set_source(cr, state.strokeGradient->platformGradient());
+ } else if (gcp->state.strokeGradient)
+ cairo_set_source(cr, gcp->state.strokeGradient->platformGradient());
else {
- Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * state.globalAlpha);
+ Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * gcp->state.globalAlpha);
setSourceRGBAFromColor(cr, strokeColor);
}
- if (state.globalAlpha < 1.0f && (state.strokePattern || state.strokeGradient)) {
+ if (gcp->state.globalAlpha < 1.0f && (gcp->state.strokePattern || gcp->state.strokeGradient)) {
cairo_push_group(cr);
- cairo_paint_with_alpha(cr, state.globalAlpha);
+ cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
cairo_pop_group_to_source(cr);
}
cairo_stroke_preserve(cr);
@@ -139,7 +136,7 @@ enum PathDrawingStyle {
FillAndStroke = Fill + Stroke
};
-static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle drawingStyle)
+static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPrivate* contextPrivate, PathDrawingStyle drawingStyle)
{
ContextShadow* shadow = context->contextShadow();
ASSERT(shadow);
@@ -175,39 +172,41 @@ static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle dra
cairo_append_path(shadowContext, path.get());
if (drawingStyle & Fill)
- setPlatformFill(context, shadowContext);
+ setPlatformFill(context, shadowContext, contextPrivate);
if (drawingStyle & Stroke)
- setPlatformStroke(context, shadowContext);
+ setPlatformStroke(context, shadowContext, contextPrivate);
shadow->endShadowLayer(cairoContext);
}
-static void fillCurrentCairoPath(GraphicsContext* context, cairo_t* cairoContext)
+static void fillCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
{
cairo_set_fill_rule(cairoContext, context->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
- drawPathShadow(context, Fill);
+ drawPathShadow(context, gcp, Fill);
- setPlatformFill(context, cairoContext);
+ setPlatformFill(context, cairoContext, gcp);
cairo_new_path(cairoContext);
}
-static void strokeCurrentCairoPath(GraphicsContext* context, cairo_t* cairoContext)
+static void strokeCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
{
- drawPathShadow(context, Stroke);
- setPlatformStroke(context, cairoContext);
+ drawPathShadow(context, gcp, Stroke);
+ setPlatformStroke(context, cairoContext, gcp);
cairo_new_path(cairoContext);
}
-void GraphicsContext::platformInit(PlatformGraphicsContext* cr)
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* cr)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate)
{
- m_data = new GraphicsContextPlatformPrivate;
m_data->cr = cairo_reference(cr);
m_data->syncContext(cr);
setPaintingDisabled(!cr);
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
@@ -533,7 +532,7 @@ void GraphicsContext::fillPath(const Path& path)
cairo_t* cr = m_data->cr;
setPathOnCairoContext(cr, path.platformPath()->context());
- fillCurrentCairoPath(this, cr);
+ fillCurrentCairoPath(this, m_common, cr);
}
void GraphicsContext::strokePath(const Path& path)
@@ -543,7 +542,7 @@ void GraphicsContext::strokePath(const Path& path)
cairo_t* cr = m_data->cr;
setPathOnCairoContext(cr, path.platformPath()->context());
- strokeCurrentCairoPath(this, cr);
+ strokeCurrentCairoPath(this, m_common, cr);
}
void GraphicsContext::fillRect(const FloatRect& rect)
@@ -554,7 +553,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
cairo_t* cr = m_data->cr;
cairo_save(cr);
cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
- fillCurrentCairoPath(this, cr);
+ fillCurrentCairoPath(this, m_common, cr);
cairo_restore(cr);
}
@@ -864,10 +863,10 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
void GraphicsContext::setPlatformShadow(FloatSize const& size, float blur, Color const& color, ColorSpace)
{
// Cairo doesn't support shadows natively, they are drawn manually in the draw* functions
- if (m_state.shadowsIgnoreTransforms) {
+ if (m_common->state.shadowsIgnoreTransforms) {
// Meaning that this graphics context is associated with a CanvasRenderingContext
// We flip the height since CG and HTML5 Canvas have opposite Y axis
- m_state.shadowOffset = FloatSize(size.width(), -size.height());
+ m_common->state.shadowOffset = FloatSize(size.width(), -size.height());
m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height()));
} else
m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), size.height()));
@@ -930,7 +929,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width)
cairo_save(cr);
cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
cairo_set_line_width(cr, width);
- strokeCurrentCairoPath(this, cr);
+ strokeCurrentCairoPath(this, m_common, cr);
cairo_restore(cr);
}
@@ -989,12 +988,12 @@ void GraphicsContext::setMiterLimit(float miter)
void GraphicsContext::setAlpha(float alpha)
{
- m_state.globalAlpha = alpha;
+ m_common->state.globalAlpha = alpha;
}
float GraphicsContext::getAlpha()
{
- return m_state.globalAlpha;
+ return m_common->state.globalAlpha;
}
void GraphicsContext::setCompositeOperation(CompositeOperator op)
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 0562b03..01773bb 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -31,6 +31,7 @@
#include "AffineTransform.h"
#include "FloatConversion.h"
#include "GraphicsContextPlatformPrivateCG.h"
+#include "GraphicsContextPrivate.h"
#include "ImageBuffer.h"
#include "KURL.h"
#include "Path.h"
@@ -107,9 +108,10 @@ CGColorSpaceRef linearRGBColorSpaceRef()
#endif
}
-void GraphicsContext::platformInit(CGContextRef cgContext)
+GraphicsContext::GraphicsContext(CGContextRef cgContext)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate(cgContext))
{
- m_data = new GraphicsContextPlatformPrivate(cgContext);
setPaintingDisabled(!cgContext);
if (cgContext) {
// Make sure the context starts in sync with our state.
@@ -118,8 +120,9 @@ void GraphicsContext::platformInit(CGContextRef cgContext)
}
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
@@ -450,7 +453,7 @@ void GraphicsContext::applyStrokePattern()
{
CGContextRef cgContext = platformContext();
- RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(getCTM()));
+ RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.strokePattern->createPlatformPattern(getCTM()));
if (!platformPattern)
return;
@@ -465,7 +468,7 @@ void GraphicsContext::applyFillPattern()
{
CGContextRef cgContext = platformContext();
- RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(getCTM()));
+ RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.fillPattern->createPlatformPattern(getCTM()));
if (!platformPattern)
return;
@@ -509,7 +512,7 @@ void GraphicsContext::drawPath(const Path& path)
return;
CGContextRef context = platformContext();
- const GraphicsContextState& state = m_state;
+ const GraphicsContextState& state = m_common->state;
if (state.fillGradient || state.strokeGradient) {
// We don't have any optimized way to fill & stroke a path using gradients
@@ -550,19 +553,19 @@ void GraphicsContext::fillPath(const Path& path)
CGContextBeginPath(context);
CGContextAddPath(context, path.platformPath());
- if (m_state.fillGradient) {
+ if (m_common->state.fillGradient) {
CGContextSaveGState(context);
if (fillRule() == RULE_EVENODD)
CGContextEOClip(context);
else
CGContextClip(context);
- CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
- m_state.fillGradient->paint(this);
+ CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
+ m_common->state.fillGradient->paint(this);
CGContextRestoreGState(context);
return;
}
- if (m_state.fillPattern)
+ if (m_common->state.fillPattern)
applyFillPattern();
fillPathWithFillRule(context, fillRule());
}
@@ -577,17 +580,17 @@ void GraphicsContext::strokePath(const Path& path)
CGContextBeginPath(context);
CGContextAddPath(context, path.platformPath());
- if (m_state.strokeGradient) {
+ if (m_common->state.strokeGradient) {
CGContextSaveGState(context);
CGContextReplacePathWithStrokedPath(context);
CGContextClip(context);
- CGContextConcatCTM(context, m_state.strokeGradient->gradientSpaceTransform());
- m_state.strokeGradient->paint(this);
+ CGContextConcatCTM(context, m_common->state.strokeGradient->gradientSpaceTransform());
+ m_common->state.strokeGradient->paint(this);
CGContextRestoreGState(context);
return;
}
- if (m_state.strokePattern)
+ if (m_common->state.strokePattern)
applyStrokePattern();
CGContextStrokePath(context);
}
@@ -599,16 +602,16 @@ void GraphicsContext::fillRect(const FloatRect& rect)
CGContextRef context = platformContext();
- if (m_state.fillGradient) {
+ if (m_common->state.fillGradient) {
CGContextSaveGState(context);
CGContextClipToRect(context, rect);
- CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
- m_state.fillGradient->paint(this);
+ CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
+ m_common->state.fillGradient->paint(this);
CGContextRestoreGState(context);
return;
}
- if (m_state.fillPattern)
+ if (m_common->state.fillPattern)
applyFillPattern();
CGContextFillRect(context, rect);
}
@@ -738,7 +741,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, con
CGFloat blurRadius = blur;
CGContextRef context = platformContext();
- if (!m_state.shadowsIgnoreTransforms) {
+ if (!m_common->state.shadowsIgnoreTransforms) {
CGAffineTransform userToBaseCTM = wkGetUserToBaseCTM(context);
CGFloat A = userToBaseCTM.a * userToBaseCTM.a + userToBaseCTM.b * userToBaseCTM.b;
@@ -813,18 +816,18 @@ void GraphicsContext::strokeRect(const FloatRect& r, float lineWidth)
CGContextRef context = platformContext();
- if (m_state.strokeGradient) {
+ if (m_common->state.strokeGradient) {
CGContextSaveGState(context);
setStrokeThickness(lineWidth);
CGContextAddRect(context, r);
CGContextReplacePathWithStrokedPath(context);
CGContextClip(context);
- m_state.strokeGradient->paint(this);
+ m_common->state.strokeGradient->paint(this);
CGContextRestoreGState(context);
return;
}
- if (m_state.strokePattern)
+ if (m_common->state.strokePattern)
applyStrokePattern();
CGContextStrokeRectWithWidth(context, r, lineWidth);
}
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index f634a98..7dda245 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -62,14 +62,16 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
{
}
-void GraphicsContext::platformInit(PlatformGraphicsContext* context)
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate(context))
{
- m_data = new GraphicsContextPlatformPrivate(context);
setPaintingDisabled(!context);
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index a0a62fb..5b1eb1d 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -21,6 +21,7 @@
#include "GraphicsContext.h"
#include "AffineTransform.h"
+#include "GraphicsContextPrivate.h"
#include "KURL.h"
#include "NotImplemented.h"
#include "PainterOpenVG.h"
@@ -48,14 +49,16 @@ public:
}
};
-void GraphicsContext::platformInit(SurfaceOpenVG* surface)
+GraphicsContext::GraphicsContext(SurfaceOpenVG* surface)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(surface ? new GraphicsContextPlatformPrivate(surface) : 0)
{
- m_data = surface ? new GraphicsContextPlatformPrivate(surface) : 0;
setPaintingDisabled(!surface);
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
@@ -141,7 +144,7 @@ void GraphicsContext::fillPath(const Path& path)
if (paintingDisabled())
return;
- m_data->drawPath(path, VG_FILL_PATH, m_state.fillRule);
+ m_data->drawPath(path, VG_FILL_PATH, m_common->state.fillRule);
}
void GraphicsContext::strokePath(const Path& path)
@@ -149,7 +152,7 @@ void GraphicsContext::strokePath(const Path& path)
if (paintingDisabled())
return;
- m_data->drawPath(path, VG_STROKE_PATH, m_state.fillRule);
+ m_data->drawPath(path, VG_STROKE_PATH, m_common->state.fillRule);
}
void GraphicsContext::fillRect(const FloatRect& rect)
@@ -377,7 +380,7 @@ void GraphicsContext::clip(const Path& path)
if (paintingDisabled())
return;
- m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
}
void GraphicsContext::canvasClip(const Path& path)
@@ -390,7 +393,7 @@ void GraphicsContext::clipOut(const Path& path)
if (paintingDisabled())
return;
- m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
}
void GraphicsContext::scale(const FloatSize& scaleFactors)
@@ -424,7 +427,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
Path path;
path.addRect(rect);
- m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
}
void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer* imageBuffer)
@@ -447,7 +450,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
path.addEllipse(FloatRect(rect.x() + thickness, rect.y() + thickness,
rect.width() - (thickness * 2), rect.height() - (thickness * 2)));
- m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
+ m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
}
void GraphicsContext::concatCTM(const AffineTransform& transformation)
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 812b753..727fbf1 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -46,6 +46,7 @@
#include "ContextShadow.h"
#include "FloatConversion.h"
#include "Font.h"
+#include "GraphicsContextPrivate.h"
#include "ImageBuffer.h"
#include "NotImplemented.h"
#include "Path.h"
@@ -223,6 +224,7 @@ private:
bool platformContextIsOwned;
};
+
GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, const QColor& initialSolidColor)
: antiAliasingForRectsAndLines(false)
, layerCount(0)
@@ -251,10 +253,10 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
delete device;
}
-void GraphicsContext::platformInit(PlatformGraphicsContext* painter)
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate(painter, fillColor()))
{
- m_data = new GraphicsContextPlatformPrivate(painter, fillColor());
-
setPaintingDisabled(!painter);
if (!painter)
@@ -269,11 +271,12 @@ void GraphicsContext::platformInit(PlatformGraphicsContext* painter)
painter->setPen(pen);
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
while (!m_data->layers.isEmpty())
endTransparencyLayer();
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
@@ -507,7 +510,7 @@ void GraphicsContext::fillPath(const Path& path)
if (m_data->hasShadow()) {
ContextShadow* shadow = contextShadow();
if (shadow->m_type != ContextShadow::BlurShadow
- && !m_state.fillPattern && !m_state.fillGradient)
+ && !m_common->state.fillPattern && !m_common->state.fillGradient)
{
QPointF offset = shadow->offset();
const QTransform& transform = p->transform();
@@ -534,12 +537,12 @@ void GraphicsContext::fillPath(const Path& path)
}
}
- if (m_state.fillPattern) {
+ if (m_common->state.fillPattern) {
AffineTransform affine;
- p->fillPath(platformPath, QBrush(m_state.fillPattern->createPlatformPattern(affine)));
- } else if (m_state.fillGradient) {
- QBrush brush(*m_state.fillGradient->platformGradient());
- brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
+ p->fillPath(platformPath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
+ } else if (m_common->state.fillGradient) {
+ QBrush brush(*m_common->state.fillGradient->platformGradient());
+ brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
p->fillPath(platformPath, brush);
} else
p->fillPath(platformPath, p->brush());
@@ -559,7 +562,7 @@ void GraphicsContext::strokePath(const Path& path)
ContextShadow* shadow = contextShadow();
if (shadow->m_type != ContextShadow::BlurShadow
- && !m_state.strokePattern && !m_state.strokeGradient)
+ && !m_common->state.strokePattern && !m_common->state.strokeGradient)
{
QPen shadowPen(pen);
shadowPen.setColor(m_data->shadow.m_color);
@@ -590,14 +593,14 @@ void GraphicsContext::strokePath(const Path& path)
}
}
- if (m_state.strokePattern) {
+ if (m_common->state.strokePattern) {
AffineTransform affine;
- pen.setBrush(QBrush(m_state.strokePattern->createPlatformPattern(affine)));
+ pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
p->setPen(pen);
p->strokePath(platformPath, pen);
- } else if (m_state.strokeGradient) {
- QBrush brush(*m_state.strokeGradient->platformGradient());
- brush.setTransform(m_state.strokeGradient->gradientSpaceTransform());
+ } else if (m_common->state.strokeGradient) {
+ QBrush brush(*m_common->state.strokeGradient->platformGradient());
+ brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
pen.setBrush(brush);
p->setPen(pen);
p->strokePath(platformPath, pen);
@@ -681,21 +684,21 @@ void GraphicsContext::fillRect(const FloatRect& rect)
QRectF normalizedRect = rect.normalized();
ContextShadow* shadow = contextShadow();
- if (m_state.fillPattern) {
+ if (m_common->state.fillPattern) {
AffineTransform affine;
- QBrush brush(m_state.fillPattern->createPlatformPattern(affine));
- QPixmap* image = m_state.fillPattern->tileImage()->nativeImageForCurrentFrame();
+ QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine));
+ QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame();
QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
if (shadowPainter) {
- drawRepeatPattern(shadowPainter, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
+ drawRepeatPattern(shadowPainter, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
shadowPainter->fillRect(normalizedRect, shadow->m_color);
shadow->endShadowLayer(p);
}
- drawRepeatPattern(p, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
- } else if (m_state.fillGradient) {
- QBrush brush(*m_state.fillGradient->platformGradient());
- brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
+ drawRepeatPattern(p, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
+ } else if (m_common->state.fillGradient) {
+ QBrush brush(*m_common->state.fillGradient->platformGradient());
+ brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
if (shadowPainter) {
shadowPainter->fillRect(normalizedRect, brush);
@@ -966,10 +969,10 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const
// Qt doesn't support shadows natively, they are drawn manually in the draw*
// functions
- if (m_state.shadowsIgnoreTransforms) {
+ if (m_common->state.shadowsIgnoreTransforms) {
// Meaning that this graphics context is associated with a CanvasRenderingContext
// We flip the height since CG and HTML5 Canvas have opposite Y axis
- m_state.shadowOffset = FloatSize(size.width(), -size.height());
+ m_common->state.shadowOffset = FloatSize(size.width(), -size.height());
m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height()));
} else {
m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), size.height()));
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 717664f..84b42ff 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -37,6 +37,7 @@
#include "GLES2Canvas.h"
#include "Gradient.h"
#include "GraphicsContextPlatformPrivate.h"
+#include "GraphicsContextPrivate.h"
#include "ImageBuffer.h"
#include "IntRect.h"
#include "NativeImageSkia.h"
@@ -218,15 +219,17 @@ void addCornerArc(SkPath* path, const SkRect& rect, const IntSize& size, int sta
// This may be called with a NULL pointer to create a graphics context that has
// no painting.
-void GraphicsContext::platformInit(PlatformGraphicsContext* gc)
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* gc)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate(gc))
{
- m_data = new GraphicsContextPlatformPrivate(gc);
setPaintingDisabled(!gc || !platformContext()->canvas());
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
delete m_data;
+ this->destroyGraphicsContextPrivate(m_common);
}
PlatformGraphicsContext* GraphicsContext::platformContext() const
@@ -739,7 +742,7 @@ void GraphicsContext::fillPath(const Path& pathToFill)
platformContext()->prepareForSoftwareDraw();
- const GraphicsContextState& state = m_state;
+ const GraphicsContextState& state = m_common->state;
path.setFillType(state.fillRule == RULE_EVENODD ?
SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
@@ -1068,7 +1071,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size,
// TODO(tc): This still does not address the issue that shadows
// within canvas elements should ignore transforms.
- if (m_state.shadowsIgnoreTransforms) {
+ if (m_common->state.shadowsIgnoreTransforms) {
// Currently only the GraphicsContext associated with the
// CanvasRenderingContext for HTMLCanvasElement have shadows ignore
// Transforms. So with this flag set, we know this state is associated
diff --git a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
index 0e2fe69..1ad6bc1 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
@@ -61,9 +61,10 @@ static CGContextRef CGContextWithHDC(HDC hdc, bool hasAlpha)
return context;
}
-void GraphicsContext::platformInit(HDC hdc, bool hasAlpha)
+GraphicsContext::GraphicsContext(HDC hdc, bool hasAlpha)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha)))
{
- m_data = new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha));
CGContextRelease(m_data->m_cgContext.get());
m_data->m_hdc = hdc;
setPaintingDisabled(!m_data->m_cgContext);
diff --git a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
index ae4c9b7..a989c24 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
@@ -64,10 +64,10 @@ static cairo_t* createCairoContextWithHDC(HDC hdc, bool hasAlpha)
return context;
}
-void GraphicsContext::platformInit(HDC dc, bool hasAlpha)
+GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate)
{
- m_data = new GraphicsContextPlatformPrivate;
-
if (dc) {
m_data->cr = createCairoContextWithHDC(dc, hasAlpha);
m_data->m_hdc = dc;
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 0328330..a52658f 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -28,6 +28,7 @@
#include "GDIExtras.h"
#include "GlyphBuffer.h"
#include "Gradient.h"
+#include "GraphicsContextPrivate.h"
#include "NotImplemented.h"
#include "Path.h"
#include "PlatformPathWinCE.h"
@@ -579,13 +580,15 @@ private:
};
-void GraphicsContext::platformInit(PlatformGraphicsContext* dc)
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* dc)
+: m_common(createGraphicsContextPrivate())
+, m_data(new GraphicsContextPlatformPrivate(dc))
{
- m_data = new GraphicsContextPlatformPrivate(dc);
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
@@ -1313,8 +1316,8 @@ Color gradientAverageColor(const Gradient* gradient)
void GraphicsContext::fillPath(const Path& path)
{
- Color c = m_state.fillGradient
- ? gradientAverageColor(m_state.fillGradient.get())
+ Color c = m_common->state.fillGradient
+ ? gradientAverageColor(m_common->state.fillGradient.get())
: fillColor();
if (!c.alpha() || !m_data->m_opacity)
@@ -1484,8 +1487,8 @@ void GraphicsContext::fillRect(const FloatRect& rect)
{
savePlatformState();
- if (m_state.fillGradient)
- fillRect(rect, m_state.fillGradient.get());
+ if (m_common->state.fillGradient)
+ fillRect(rect, m_common->state.fillGradient.get());
else
fillRect(rect, fillColor(), ColorSpaceDeviceRGB);
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 755b138..3428969 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -112,11 +112,11 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
}
-void GraphicsContext::platformInit(PlatformGraphicsContext* context)
-{
- m_data = new GraphicsContextPlatformPrivate;
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
+ : m_common(createGraphicsContextPrivate())
+ , m_data(new GraphicsContextPlatformPrivate)
+{
setPaintingDisabled(!context);
-
if (context) {
// Make sure the context starts in sync with our state.
setPlatformFillColor(fillColor(), ColorSpaceDeviceRGB);
@@ -129,8 +129,9 @@ void GraphicsContext::platformInit(PlatformGraphicsContext* context)
#endif
}
-void GraphicsContext::platformDestroy()
+GraphicsContext::~GraphicsContext()
{
+ destroyGraphicsContextPrivate(m_common);
delete m_data;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list