[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
bdakin at apple.com
bdakin at apple.com
Thu Dec 3 13:28:40 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit d44b4683b2f95550c0b49e77109073c8d617913b
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Nov 7 08:00:12 2009 +0000
Fix for https://bugs.webkit.org/show_bug.cgi?id=31219 Clean up
GraphicsContext's current concept of ColorSpace
Reviewed by Adele Peterson.
ColorSpace is now called ColorType. The variables on the state we
appropriately re-named as well. I removed strokeColorSpace() and
fillColorSpace() from GraphicsContext since they were never called.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::setStrokeColor):
(WebCore::GraphicsContext::setFillColor):
(WebCore::GraphicsContext::setStrokePattern):
(WebCore::GraphicsContext::setFillPattern):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillGradient):
* platform/graphics/GraphicsContext.h:
(WebCore::):
* platform/graphics/GraphicsContextPrivate.h:
(WebCore::GraphicsContextState::GraphicsContextState):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::calculateDrawingMode):
(WebCore::GraphicsContext::drawPath):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::strokeRect):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
* platform/graphics/wince/GraphicsContextWince.cpp:
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRect):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 53e93e4..0708ff3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,43 @@
+2009-11-06 Beth Dakin <bdakin at apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=31219 Clean up
+ GraphicsContext's current concept of ColorSpace
+
+ ColorSpace is now called ColorType. The variables on the state we
+ appropriately re-named as well. I removed strokeColorSpace() and
+ fillColorSpace() from GraphicsContext since they were never called.
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::setStrokeColor):
+ (WebCore::GraphicsContext::setFillColor):
+ (WebCore::GraphicsContext::setStrokePattern):
+ (WebCore::GraphicsContext::setFillPattern):
+ (WebCore::GraphicsContext::setStrokeGradient):
+ (WebCore::GraphicsContext::setFillGradient):
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::):
+ * platform/graphics/GraphicsContextPrivate.h:
+ (WebCore::GraphicsContextState::GraphicsContextState):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::calculateDrawingMode):
+ (WebCore::GraphicsContext::drawPath):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::strokeRect):
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ * platform/graphics/wince/GraphicsContextWince.cpp:
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::fillRect):
+
2009-11-06 Brian Weinstein <bweinstein at apple.com>
Reviewed by Tim Hatcher.
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index ccdce08..523264e 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -122,16 +122,11 @@ void GraphicsContext::setStrokeStyle(const StrokeStyle& style)
void GraphicsContext::setStrokeColor(const Color& color)
{
- m_common->state.strokeColorSpace = SolidColorSpace;
+ m_common->state.strokeType = SolidColorType;
m_common->state.strokeColor = color;
setPlatformStrokeColor(color);
}
-ColorSpace GraphicsContext::strokeColorSpace() const
-{
- return m_common->state.strokeColorSpace;
-}
-
void GraphicsContext::setShadow(const IntSize& size, int blur, const Color& color)
{
m_common->state.shadowSize = size;
@@ -184,7 +179,7 @@ void GraphicsContext::setFillRule(WindRule fillRule)
void GraphicsContext::setFillColor(const Color& color)
{
- m_common->state.fillColorSpace = SolidColorSpace;
+ m_common->state.fillType = SolidColorType;
m_common->state.fillColor = color;
setPlatformFillColor(color);
}
@@ -212,7 +207,7 @@ void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
setStrokeColor(Color::black);
return;
}
- m_common->state.strokeColorSpace = PatternColorSpace;
+ m_common->state.strokeType = PatternType;
m_common->state.strokePattern = pattern;
setPlatformStrokePattern(m_common->state.strokePattern.get());
}
@@ -224,7 +219,7 @@ void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
setFillColor(Color::black);
return;
}
- m_common->state.fillColorSpace = PatternColorSpace;
+ m_common->state.fillType = PatternType;
m_common->state.fillPattern = pattern;
setPlatformFillPattern(m_common->state.fillPattern.get());
}
@@ -236,7 +231,7 @@ void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
setStrokeColor(Color::black);
return;
}
- m_common->state.strokeColorSpace = GradientColorSpace;
+ m_common->state.strokeType = GradientType;
m_common->state.strokeGradient = gradient;
setPlatformStrokeGradient(m_common->state.strokeGradient.get());
}
@@ -248,7 +243,7 @@ void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
setFillColor(Color::black);
return;
}
- m_common->state.fillColorSpace = GradientColorSpace;
+ m_common->state.fillType = GradientType;
m_common->state.fillGradient = gradient;
setPlatformFillGradient(m_common->state.fillGradient.get());
}
@@ -258,11 +253,6 @@ Gradient* GraphicsContext::fillGradient() const
return m_common->state.fillGradient.get();
}
-ColorSpace GraphicsContext::fillColorSpace() const
-{
- return m_common->state.fillColorSpace;
-}
-
Gradient* GraphicsContext::strokeGradient() const
{
return m_common->state.strokeGradient.get();
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index c6bb20c..86659cf 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -130,16 +130,10 @@ namespace WebCore {
DashedStroke
};
- // FIXME: This is a place-holder until we decide to add
- // real color space support to WebCore. At that time, ColorSpace will be a
- // class and instances will be held off of Colors. There will be
- // special singleton Gradient and Pattern color spaces to mark when
- // a fill or stroke is using a gradient or pattern instead of a solid color.
- // https://bugs.webkit.org/show_bug.cgi?id=20558
- enum ColorSpace {
- SolidColorSpace,
- PatternColorSpace,
- GradientColorSpace
+ enum FillOrStrokeType {
+ SolidColorType,
+ PatternType,
+ GradientType
};
enum InterpolationQuality {
@@ -166,8 +160,6 @@ namespace WebCore {
Color strokeColor() const;
void setStrokeColor(const Color&);
- ColorSpace strokeColorSpace() const;
-
void setStrokePattern(PassRefPtr<Pattern>);
Pattern* strokePattern() const;
@@ -185,8 +177,6 @@ namespace WebCore {
void setFillGradient(PassRefPtr<Gradient>);
Gradient* fillGradient() const;
- ColorSpace fillColorSpace() const;
-
void setShadowsIgnoreTransforms(bool);
void setShouldAntialias(bool);
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
index 98baab1..b08b3fb 100644
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -38,18 +38,18 @@ namespace WebCore {
: textDrawingMode(cTextFill)
, strokeStyle(SolidStroke)
, strokeThickness(0)
-#if PLATFORM(CAIRO)
- , globalAlpha(1.0f)
-#endif
- , strokeColorSpace(SolidColorSpace)
+ , strokeType(SolidColorType)
, strokeColor(Color::black)
, fillRule(RULE_NONZERO)
- , fillColorSpace(SolidColorSpace)
+ , fillType(SolidColorType)
, fillColor(Color::black)
, shouldAntialias(true)
, paintingDisabled(false)
, shadowBlur(0)
, shadowsIgnoreTransforms(false)
+#if PLATFORM(CAIRO)
+ , globalAlpha(1.0f)
+#endif
{
}
@@ -57,18 +57,13 @@ namespace WebCore {
StrokeStyle strokeStyle;
float strokeThickness;
-#if PLATFORM(CAIRO)
- float globalAlpha;
-#elif PLATFORM(QT)
- TransformationMatrix pathTransform;
-#endif
- ColorSpace strokeColorSpace;
+ FillOrStrokeType strokeType;
Color strokeColor;
RefPtr<Gradient> strokeGradient;
RefPtr<Pattern> strokePattern;
WindRule fillRule;
- ColorSpace fillColorSpace;
+ FillOrStrokeType fillType;
Color fillColor;
RefPtr<Gradient> fillGradient;
RefPtr<Pattern> fillPattern;
@@ -82,6 +77,11 @@ namespace WebCore {
Color shadowColor;
bool shadowsIgnoreTransforms;
+#if PLATFORM(CAIRO)
+ float globalAlpha;
+#elif PLATFORM(QT)
+ TransformationMatrix pathTransform;
+#endif
};
class GraphicsContextPrivate {
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 9b09e16..a9200f1 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -390,20 +390,20 @@ void GraphicsContext::fillPath()
cairo_save(cr);
cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
- switch (m_common->state.fillColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.fillType) {
+ case SolidColorType:
setColor(cr, fillColor());
cairo_clip(cr);
cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
break;
- case PatternColorSpace: {
+ case PatternType: {
TransformationMatrix affine;
cairo_set_source(cr, m_common->state.fillPattern->createPlatformPattern(affine));
cairo_clip(cr);
cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
break;
}
- case GradientColorSpace:
+ case GradientType:
cairo_pattern_t* pattern = m_common->state.fillGradient->platformGradient();
cairo_set_source(cr, pattern);
cairo_clip(cr);
@@ -420,8 +420,8 @@ void GraphicsContext::strokePath()
cairo_t* cr = m_data->cr;
cairo_save(cr);
- switch (m_common->state.strokeColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.strokeType) {
+ case SolidColorType:
float red, green, blue, alpha;
strokeColor().getRGBA(red, green, blue, alpha);
if (m_common->state.globalAlpha < 1.0f)
@@ -429,7 +429,7 @@ void GraphicsContext::strokePath()
cairo_set_source_rgba(cr, red, green, blue, alpha);
cairo_stroke(cr);
break;
- case PatternColorSpace: {
+ case PatternType: {
TransformationMatrix affine;
cairo_set_source(cr, m_common->state.strokePattern->createPlatformPattern(affine));
if (m_common->state.globalAlpha < 1.0f) {
@@ -440,7 +440,7 @@ void GraphicsContext::strokePath()
cairo_stroke(cr);
break;
}
- case GradientColorSpace:
+ case GradientType:
cairo_pattern_t* pattern = m_common->state.strokeGradient->platformGradient();
cairo_set_source(cr, pattern);
if (m_common->state.globalAlpha < 1.0f) {
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index bd1a018..306b24f 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -430,8 +430,8 @@ void GraphicsContext::applyFillPattern()
static inline bool calculateDrawingMode(const GraphicsContextState& state, CGPathDrawingMode& mode)
{
- bool shouldFill = state.fillColorSpace == PatternColorSpace || state.fillColor.alpha();
- bool shouldStroke = state.strokeColorSpace == PatternColorSpace || (state.strokeStyle != NoStroke && state.strokeColor.alpha());
+ bool shouldFill = state.fillType == PatternType || state.fillColor.alpha();
+ bool shouldStroke = state.strokeType == PatternType || (state.strokeStyle != NoStroke && state.strokeColor.alpha());
bool useEOFill = state.fillRule == RULE_EVENODD;
if (shouldFill) {
@@ -463,16 +463,16 @@ void GraphicsContext::drawPath()
CGContextRef context = platformContext();
const GraphicsContextState& state = m_common->state;
- if (state.fillColorSpace == GradientColorSpace || state.strokeColorSpace == GradientColorSpace) {
+ if (state.fillType == GradientType || state.strokeType == GradientType) {
// We don't have any optimized way to fill & stroke a path using gradients
fillPath();
strokePath();
return;
}
- if (state.fillColorSpace == PatternColorSpace)
+ if (state.fillType == PatternType)
applyFillPattern();
- if (state.strokeColorSpace == PatternColorSpace)
+ if (state.strokeType == PatternType)
applyStrokePattern();
CGPathDrawingMode drawingMode;
@@ -494,15 +494,15 @@ void GraphicsContext::fillPath()
return;
CGContextRef context = platformContext();
- switch (m_common->state.fillColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.fillType) {
+ case SolidColorType:
fillPathWithFillRule(context, fillRule());
break;
- case PatternColorSpace:
+ case PatternType:
applyFillPattern();
fillPathWithFillRule(context, fillRule());
break;
- case GradientColorSpace:
+ case GradientType:
CGContextSaveGState(context);
if (fillRule() == RULE_EVENODD)
CGContextEOClip(context);
@@ -521,15 +521,15 @@ void GraphicsContext::strokePath()
return;
CGContextRef context = platformContext();
- switch (m_common->state.strokeColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.strokeType) {
+ case SolidColorType:
CGContextStrokePath(context);
break;
- case PatternColorSpace:
+ case PatternType:
applyStrokePattern();
CGContextStrokePath(context);
break;
- case GradientColorSpace:
+ case GradientType:
CGContextSaveGState(context);
CGContextReplacePathWithStrokedPath(context);
CGContextClip(context);
@@ -545,15 +545,15 @@ void GraphicsContext::fillRect(const FloatRect& rect)
if (paintingDisabled())
return;
CGContextRef context = platformContext();
- switch (m_common->state.fillColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.fillType) {
+ case SolidColorType:
CGContextFillRect(context, rect);
break;
- case PatternColorSpace:
+ case PatternType:
applyFillPattern();
CGContextFillRect(context, rect);
break;
- case GradientColorSpace:
+ case GradientType:
CGContextSaveGState(context);
CGContextClipToRect(context, rect);
CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
@@ -779,15 +779,15 @@ void GraphicsContext::strokeRect(const FloatRect& r, float lineWidth)
return;
CGContextRef context = platformContext();
- switch (m_common->state.strokeColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.strokeType) {
+ case SolidColorType:
CGContextStrokeRectWithWidth(context, r, lineWidth);
break;
- case PatternColorSpace:
+ case PatternType:
applyStrokePattern();
CGContextStrokeRectWithWidth(context, r, lineWidth);
break;
- case GradientColorSpace:
+ case GradientType:
CGContextSaveGState(context);
setStrokeThickness(lineWidth);
CGContextAddRect(context, r);
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 57a481a..e4f75e6 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -639,20 +639,20 @@ void GraphicsContext::fillPath()
QPainterPath path = m_data->currentPath;
path.setFillRule(toQtFillRule(fillRule()));
- if ((m_common->state.fillColorSpace != SolidColorSpace)
+ if ((m_common->state.fillType != SolidColorType)
|| (fillColor().alpha())) {
drawFilledShadowPath(this, p, &path);
- switch (m_common->state.fillColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.fillType) {
+ case SolidColorType:
if (fillColor().alpha())
p->fillPath(path, p->brush());
break;
- case PatternColorSpace: {
+ case PatternType: {
TransformationMatrix affine;
p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
break;
}
- case GradientColorSpace:
+ case GradientType:
QBrush brush(*m_common->state.fillGradient->platformGradient());
brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
p->fillPath(path, brush);
@@ -672,7 +672,7 @@ void GraphicsContext::strokePath()
QPainterPath path = m_data->currentPath;
path.setFillRule(toQtFillRule(fillRule()));
- if ((m_common->state.strokeColorSpace != SolidColorSpace)
+ if ((m_common->state.strokeType != SolidColorType)
|| (strokeColor().alpha())) {
IntSize shadowSize;
int shadowBlur;
@@ -685,19 +685,19 @@ void GraphicsContext::strokePath()
p->strokePath(path, shadowPen);
p->setWorldTransform(t);
}
- switch (m_common->state.strokeColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.strokeType) {
+ case SolidColorType:
if (strokeColor().alpha())
p->strokePath(path, pen);
break;
- case PatternColorSpace: {
+ case PatternType: {
TransformationMatrix affine;
pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
p->setPen(pen);
p->strokePath(path, pen);
break;
}
- case GradientColorSpace: {
+ case GradientType: {
QBrush brush(*m_common->state.strokeGradient->platformGradient());
brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
pen.setBrush(brush);
@@ -729,20 +729,20 @@ void GraphicsContext::fillRect(const FloatRect& rect)
QPainter* p = m_data->p();
- if ((m_common->state.fillColorSpace != SolidColorSpace)
+ if ((m_common->state.fillType != SolidColorType)
|| (fillColor().alpha())) {
drawBorderlessRectShadow(this, p, rect);
- switch (m_common->state.fillColorSpace) {
- case SolidColorSpace:
+ switch (m_common->state.fillType) {
+ case SolidColorType:
if (fillColor().alpha())
p->fillRect(rect, p->brush());
break;
- case PatternColorSpace: {
+ case PatternType: {
TransformationMatrix affine;
p->fillRect(rect, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
break;
}
- case GradientColorSpace:
+ case GradientType:
QBrush brush(*m_common->state.fillGradient->platformGradient());
brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
p->fillRect(rect, brush);
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
index f308840..182f528 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
@@ -1355,7 +1355,7 @@ Color gradientAverageColor(const Gradient* gradient)
void GraphicsContext::fillPath()
{
- Color c = m_common->state.fillColorSpace == GradientColorSpace && m_common->state.fillGradient
+ Color c = m_common->state.fillType == GradientType && m_common->state.fillGradient
? gradientAverageColor(m_common->state.fillGradient.get())
: fillColor();
@@ -1539,7 +1539,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
void GraphicsContext::fillRect(const FloatRect& rect)
{
- if (m_common->state.fillColorSpace == GradientColorSpace && m_common->state.fillGradient)
+ if (m_common->state.fillType == GradientType && m_common->state.fillGradient)
fillRect(rect, m_common->state.fillGradient.get());
else
fillRect(rect, fillColor());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list