diff options
Diffstat (limited to 'Source/WebCore/platform/graphics')
5 files changed, 61 insertions, 31 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h b/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h index 4a27fe9..978e087 100644 --- a/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h +++ b/Source/WebCore/platform/graphics/android/context/GraphicsOperation.h @@ -105,7 +105,7 @@ public: virtual ~Operation() {} virtual OperationType type() { return UndefinedOperation; } virtual String parameters() { return ""; } - String name() + const char* name() { switch (type()) { TYPE_CASE(UndefinedOperation) diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp index 3b37693..f9d7f21 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp @@ -246,22 +246,31 @@ void PlatformGraphicsContext::setCompositeOperation(CompositeOperator op) m_state->mode = WebCoreCompositeToSkiaComposite(op); } -void PlatformGraphicsContext::setFillColor(const Color& c) +bool PlatformGraphicsContext::setFillColor(const Color& c) { - m_state->fillColor = c.rgb(); - setFillShader(0); + bool dirty = false; + if (m_state->fillColor != c.rgb()) { + m_state->fillColor = c.rgb(); + dirty = true; + } + return setFillShader(0) || dirty; } -void PlatformGraphicsContext::setFillShader(SkShader* fillShader) +bool PlatformGraphicsContext::setFillShader(SkShader* fillShader) { - if (fillShader) + bool dirty = false; + if (fillShader && m_state->fillColor != Color::black) { m_state->fillColor = Color::black; + dirty = true; + } if (fillShader != m_state->fillShader) { SkSafeUnref(m_state->fillShader); m_state->fillShader = fillShader; SkSafeRef(m_state->fillShader); + dirty = true; } + return dirty; } void PlatformGraphicsContext::setLineCap(LineCap cap) @@ -333,22 +342,31 @@ void PlatformGraphicsContext::setShouldAntialias(bool useAA) m_state->useAA = useAA; } -void PlatformGraphicsContext::setStrokeColor(const Color& c) +bool PlatformGraphicsContext::setStrokeColor(const Color& c) { - m_state->strokeColor = c.rgb(); - setStrokeShader(0); + bool dirty = false; + if (m_state->strokeColor != c.rgb()) { + m_state->strokeColor = c.rgb(); + dirty = true; + } + return setStrokeShader(0) || dirty; } -void PlatformGraphicsContext::setStrokeShader(SkShader* strokeShader) +bool PlatformGraphicsContext::setStrokeShader(SkShader* strokeShader) { - if (strokeShader) + bool dirty = false; + if (strokeShader && m_state->strokeColor != Color::black) { m_state->strokeColor = Color::black; + dirty = true; + } if (strokeShader != m_state->strokeShader) { SkSafeUnref(m_state->strokeShader); m_state->strokeShader = strokeShader; SkSafeRef(m_state->strokeShader); + dirty = true; } + return dirty; } void PlatformGraphicsContext::setStrokeStyle(StrokeStyle style) diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h index 1916014..69ccdaf 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h @@ -61,16 +61,16 @@ public: virtual void setAlpha(float alpha); int getNormalizedAlpha() const; virtual void setCompositeOperation(CompositeOperator op); - virtual void setFillColor(const Color& c); - virtual void setFillShader(SkShader* fillShader); + virtual bool setFillColor(const Color& c); + virtual bool setFillShader(SkShader* fillShader); virtual void setLineCap(LineCap cap); virtual void setLineDash(const DashArray& dashes, float dashOffset); virtual void setLineJoin(LineJoin join); virtual void setMiterLimit(float limit); virtual void setShadow(int radius, int dx, int dy, SkColor c); virtual void setShouldAntialias(bool useAA); - virtual void setStrokeColor(const Color& c); - virtual void setStrokeShader(SkShader* strokeShader); + virtual bool setStrokeColor(const Color& c); + virtual bool setStrokeShader(SkShader* strokeShader); virtual void setStrokeStyle(StrokeStyle style); virtual void setStrokeThickness(float f); diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp index d96124d..39194a0 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp @@ -88,16 +88,22 @@ void PlatformGraphicsContextRecording::setCompositeOperation(CompositeOperator o mGraphicsOperationCollection->append(new GraphicsOperation::SetCompositeOperation(op)); } -void PlatformGraphicsContextRecording::setFillColor(const Color& c) +bool PlatformGraphicsContextRecording::setFillColor(const Color& c) { - PlatformGraphicsContext::setFillColor(c); - mGraphicsOperationCollection->append(new GraphicsOperation::SetFillColor(c)); + if (PlatformGraphicsContext::setFillColor(c)) { + mGraphicsOperationCollection->append(new GraphicsOperation::SetFillColor(c)); + return true; + } + return false; } -void PlatformGraphicsContextRecording::setFillShader(SkShader* fillShader) +bool PlatformGraphicsContextRecording::setFillShader(SkShader* fillShader) { - PlatformGraphicsContext::setFillShader(fillShader); - mGraphicsOperationCollection->append(new GraphicsOperation::SetFillShader(fillShader)); + if (PlatformGraphicsContext::setFillShader(fillShader)) { + mGraphicsOperationCollection->append(new GraphicsOperation::SetFillShader(fillShader)); + return true; + } + return false; } void PlatformGraphicsContextRecording::setLineCap(LineCap cap) @@ -137,16 +143,22 @@ void PlatformGraphicsContextRecording::setShouldAntialias(bool useAA) mGraphicsOperationCollection->append(new GraphicsOperation::SetShouldAntialias(useAA)); } -void PlatformGraphicsContextRecording::setStrokeColor(const Color& c) +bool PlatformGraphicsContextRecording::setStrokeColor(const Color& c) { - PlatformGraphicsContext::setStrokeColor(c); - mGraphicsOperationCollection->append(new GraphicsOperation::SetStrokeColor(c)); + if (PlatformGraphicsContext::setStrokeColor(c)) { + mGraphicsOperationCollection->append(new GraphicsOperation::SetStrokeColor(c)); + return true; + } + return false; } -void PlatformGraphicsContextRecording::setStrokeShader(SkShader* strokeShader) +bool PlatformGraphicsContextRecording::setStrokeShader(SkShader* strokeShader) { - PlatformGraphicsContext::setStrokeShader(strokeShader); - mGraphicsOperationCollection->append(new GraphicsOperation::SetStrokeShader(strokeShader)); + if (PlatformGraphicsContext::setStrokeShader(strokeShader)) { + mGraphicsOperationCollection->append(new GraphicsOperation::SetStrokeShader(strokeShader)); + return true; + } + return false; } void PlatformGraphicsContextRecording::setStrokeStyle(StrokeStyle style) diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h index ebb0075..82f9446 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h @@ -55,16 +55,16 @@ public: // State values virtual void setAlpha(float alpha); virtual void setCompositeOperation(CompositeOperator op); - virtual void setFillColor(const Color& c); - virtual void setFillShader(SkShader* fillShader); + virtual bool setFillColor(const Color& c); + virtual bool setFillShader(SkShader* fillShader); virtual void setLineCap(LineCap cap); virtual void setLineDash(const DashArray& dashes, float dashOffset); virtual void setLineJoin(LineJoin join); virtual void setMiterLimit(float limit); virtual void setShadow(int radius, int dx, int dy, SkColor c); virtual void setShouldAntialias(bool useAA); - virtual void setStrokeColor(const Color& c); - virtual void setStrokeShader(SkShader* strokeShader); + virtual bool setStrokeColor(const Color& c); + virtual bool setStrokeShader(SkShader* strokeShader); virtual void setStrokeStyle(StrokeStyle style); virtual void setStrokeThickness(float f); |