[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:10:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3f88bce04a0d5fea14ff1ffca02732915a1ae5ab
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 14 16:55:03 2010 +0000

    2010-07-14  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Darin Adler.
    
            Canvas: Make assigning the same fillStyle or strokeStyle a fast no-op
            https://bugs.webkit.org/show_bug.cgi?id=42267
    
            Avoid calling into GraphicsContext when setting a style to its current value.
    
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::setStrokeStyle): Return early if the
            new style is the same as the current one.
            (WebCore::CanvasRenderingContext2D::setFillStyle): Same.
            * html/canvas/CanvasStyle.cpp:
            (WebCore::operator==): Added operator==(CanvasStyle, CanvasStyle)
            * html/canvas/CanvasStyle.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63327 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 90092de..db13bf8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-14  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Darin Adler.
+
+        Canvas: Make assigning the same fillStyle or strokeStyle a fast no-op
+        https://bugs.webkit.org/show_bug.cgi?id=42267
+
+        Avoid calling into GraphicsContext when setting a style to its current value.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setStrokeStyle): Return early if the
+        new style is the same as the current one.
+        (WebCore::CanvasRenderingContext2D::setFillStyle): Same.
+        * html/canvas/CanvasStyle.cpp:
+        (WebCore::operator==): Added operator==(CanvasStyle, CanvasStyle)
+        * html/canvas/CanvasStyle.h:
+
 2010-07-14  Tony Gentilcore  <tonyg at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 0db3505..c1b2142 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -172,6 +172,9 @@ void CanvasRenderingContext2D::setStrokeStyle(PassRefPtr<CanvasStyle> style)
     if (!style)
         return;
 
+    if (state().m_strokeStyle && *style == *state().m_strokeStyle)
+        return;
+
     if (canvas()->originClean()) {
         if (CanvasPattern* pattern = style->canvasPattern()) {
             if (!pattern->originClean())
@@ -195,6 +198,9 @@ void CanvasRenderingContext2D::setFillStyle(PassRefPtr<CanvasStyle> style)
 {
     if (!style)
         return;
+
+    if (state().m_fillStyle && *style == *state().m_fillStyle)
+        return;
  
     if (canvas()->originClean()) {
         if (CanvasPattern* pattern = style->canvasPattern()) {
diff --git a/WebCore/html/canvas/CanvasStyle.cpp b/WebCore/html/canvas/CanvasStyle.cpp
index 67e8201..a2b56a9 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,30 @@ PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasPattern> pattern)
     return adoptRef(new CanvasStyle(pattern));
 }
 
+bool operator==(const CanvasStyle& s1, const CanvasStyle& s2)
+{
+    if (s1.m_type != s2.m_type)
+        return false;
+
+    switch (s1.m_type) {
+    case CanvasStyle::RGBA:
+        return s1.m_rgba == s2.m_rgba;
+    case CanvasStyle::Gradient:
+        return s1.m_gradient == s2.m_gradient;
+    case CanvasStyle::ImagePattern:
+        return s1.m_pattern == s2.m_pattern;
+    case CanvasStyle::CMYKA:
+        return s1.m_cmyka.c == s2.m_cmyka.c
+            && s1.m_cmyka.m == s2.m_cmyka.m
+            && s1.m_cmyka.y == s2.m_cmyka.y
+            && s1.m_cmyka.k == s2.m_cmyka.k
+            && s1.m_cmyka.a == s2.m_cmyka.a;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 void CanvasStyle::applyStrokeColor(GraphicsContext* context)
 {
     if (!context)
diff --git a/WebCore/html/canvas/CanvasStyle.h b/WebCore/html/canvas/CanvasStyle.h
index 18e55cf..77edd18 100644
--- a/WebCore/html/canvas/CanvasStyle.h
+++ b/WebCore/html/canvas/CanvasStyle.h
@@ -55,6 +55,8 @@ namespace WebCore {
         void applyFillColor(GraphicsContext*);
         void applyStrokeColor(GraphicsContext*);
 
+        friend bool operator==(const CanvasStyle&, const CanvasStyle&);
+
     private:
         CanvasStyle(RGBA32 rgba);
         CanvasStyle(float grayLevel);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list