summaryrefslogtreecommitdiffstats
path: root/WebCore/html/canvas/CanvasStyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/canvas/CanvasStyle.cpp')
-rw-r--r--WebCore/html/canvas/CanvasStyle.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/WebCore/html/canvas/CanvasStyle.cpp b/WebCore/html/canvas/CanvasStyle.cpp
index 67e8201..1ae5236 100644
--- a/WebCore/html/canvas/CanvasStyle.cpp
+++ b/WebCore/html/canvas/CanvasStyle.cpp
@@ -33,6 +33,7 @@
#include "CanvasGradient.h"
#include "CanvasPattern.h"
#include "GraphicsContext.h"
+#include <wtf/Assertions.h>
#include <wtf/PassRefPtr.h>
#if PLATFORM(CG)
@@ -120,6 +121,29 @@ PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasPattern> pattern)
return adoptRef(new CanvasStyle(pattern));
}
+bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const
+{
+ if (m_type != other.m_type)
+ return false;
+
+ switch (m_type) {
+ case CanvasStyle::RGBA:
+ return m_rgba == other.m_rgba;
+ case CanvasStyle::CMYKA:
+ return m_cmyka.c == other.m_cmyka.c
+ && m_cmyka.m == other.m_cmyka.m
+ && m_cmyka.y == other.m_cmyka.y
+ && m_cmyka.k == other.m_cmyka.k
+ && m_cmyka.a == other.m_cmyka.a;
+ case CanvasStyle::Gradient:
+ case CanvasStyle::ImagePattern:
+ return false;
+ }
+
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
void CanvasStyle::applyStrokeColor(GraphicsContext* context)
{
if (!context)