[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andreas.kling at nokia.com
andreas.kling at nokia.com
Wed Dec 22 11:50:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 9b933a3e56be6f19be9f2882dc52452b6b48192f
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Aug 9 13:56:48 2010 +0000
2010-08-09 Andreas Kling <andreas.kling at nokia.com>
Reviewed by Antonio Gomes.
Canvas: Fast-path for setting the already set color with setStrokeColor() and setFillColor()
https://bugs.webkit.org/show_bug.cgi?id=43718
Avoid creating CanvasStyle objects when setting the same fill or stroke color using
the WebKit-specific setters of CanvasRenderingContext2D.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setStrokeColor):
(WebCore::CanvasRenderingContext2D::setFillColor):
* html/canvas/CanvasStyle.cpp:
(WebCore::CanvasStyle::isEquivalentColor):
* html/canvas/CanvasStyle.h: Added CanvasStyle::isEquivalentColor() overloads
for RGBA and CMYKA channel values.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b1a3253..2102f04 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-09 Andreas Kling <andreas.kling at nokia.com>
+
+ Reviewed by Antonio Gomes.
+
+ Canvas: Fast-path for setting the already set color with setStrokeColor() and setFillColor()
+ https://bugs.webkit.org/show_bug.cgi?id=43718
+
+ Avoid creating CanvasStyle objects when setting the same fill or stroke color using
+ the WebKit-specific setters of CanvasRenderingContext2D.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::setStrokeColor):
+ (WebCore::CanvasRenderingContext2D::setFillColor):
+ * html/canvas/CanvasStyle.cpp:
+ (WebCore::CanvasStyle::isEquivalentColor):
+ * html/canvas/CanvasStyle.h: Added CanvasStyle::isEquivalentColor() overloads
+ for RGBA and CMYKA channel values.
+
2010-08-09 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 0dac6af..559ddda 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -556,6 +556,8 @@ void CanvasRenderingContext2D::setStrokeColor(const String& color)
void CanvasRenderingContext2D::setStrokeColor(float grayLevel)
{
+ if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, 1.0f))
+ return;
setStrokeStyle(CanvasStyle::create(grayLevel, 1));
}
@@ -566,16 +568,22 @@ void CanvasRenderingContext2D::setStrokeColor(const String& color, float alpha)
void CanvasRenderingContext2D::setStrokeColor(float grayLevel, float alpha)
{
+ if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, alpha))
+ return;
setStrokeStyle(CanvasStyle::create(grayLevel, alpha));
}
void CanvasRenderingContext2D::setStrokeColor(float r, float g, float b, float a)
{
+ if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(r, g, b, a))
+ return;
setStrokeStyle(CanvasStyle::create(r, g, b, a));
}
void CanvasRenderingContext2D::setStrokeColor(float c, float m, float y, float k, float a)
{
+ if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(c, m, y, k, a))
+ return;
setStrokeStyle(CanvasStyle::create(c, m, y, k, a));
}
@@ -589,6 +597,8 @@ void CanvasRenderingContext2D::setFillColor(const String& color)
void CanvasRenderingContext2D::setFillColor(float grayLevel)
{
+ if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, 1.0f))
+ return;
setFillStyle(CanvasStyle::create(grayLevel, 1));
}
@@ -599,16 +609,22 @@ void CanvasRenderingContext2D::setFillColor(const String& color, float alpha)
void CanvasRenderingContext2D::setFillColor(float grayLevel, float alpha)
{
+ if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, alpha))
+ return;
setFillStyle(CanvasStyle::create(grayLevel, alpha));
}
void CanvasRenderingContext2D::setFillColor(float r, float g, float b, float a)
{
+ if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(r, g, b, a))
+ return;
setFillStyle(CanvasStyle::create(r, g, b, a));
}
void CanvasRenderingContext2D::setFillColor(float c, float m, float y, float k, float a)
{
+ if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(c, m, y, k, a))
+ return;
setFillStyle(CanvasStyle::create(c, m, y, k, a));
}
diff --git a/WebCore/html/canvas/CanvasStyle.cpp b/WebCore/html/canvas/CanvasStyle.cpp
index 1ae5236..52b31c8 100644
--- a/WebCore/html/canvas/CanvasStyle.cpp
+++ b/WebCore/html/canvas/CanvasStyle.cpp
@@ -144,6 +144,26 @@ bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const
return false;
}
+bool CanvasStyle::isEquivalentColor(float r, float g, float b, float a) const
+{
+ if (m_type != RGBA)
+ return false;
+
+ return m_rgba == makeRGBA32FromFloats(r, g, b, a);
+}
+
+bool CanvasStyle::isEquivalentColor(float c, float m, float y, float k, float a) const
+{
+ if (m_type != CMYKA)
+ return false;
+
+ return c == m_cmyka.c
+ && m == m_cmyka.m
+ && y == m_cmyka.y
+ && k == m_cmyka.k
+ && a == m_cmyka.a;
+}
+
void CanvasStyle::applyStrokeColor(GraphicsContext* context)
{
if (!context)
diff --git a/WebCore/html/canvas/CanvasStyle.h b/WebCore/html/canvas/CanvasStyle.h
index 76ba6ef..8e47e63 100644
--- a/WebCore/html/canvas/CanvasStyle.h
+++ b/WebCore/html/canvas/CanvasStyle.h
@@ -56,6 +56,8 @@ namespace WebCore {
void applyStrokeColor(GraphicsContext*);
bool isEquivalentColor(const CanvasStyle&) const;
+ bool isEquivalentColor(float r, float g, float b, float a) const;
+ bool isEquivalentColor(float c, float m, float y, float k, float a) const;
private:
CanvasStyle(RGBA32 rgba);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list