[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

senorblanco at chromium.org senorblanco at chromium.org
Thu Oct 29 20:38:10 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit ca012416a437c10009639db5396f9a0ec46a181b
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 2 17:19:44 2009 +0000

    Enable two point radial gradients in Chromium/Skia.
    
    Reviewed by Dimitri Glazkov.
    
    https://bugs.webkit.org/show_bug.cgi?id=30017
    
    Covered by the following tests:
    
    LayoutTests/svg/W3C-SVG-1.1/pservers-grad-13-b.svg
    LayoutTests/fast/backgrounds/svg-as-background-3.html
    LayoutTests/fast/gradients/generated-gradients.html
    LayoutTests/fast/gradients/simple-gradients.html
    
    * platform/graphics/skia/GradientSkia.cpp:
    (WebCore::Gradient::platformGradient):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49025 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3c1f755..72f4423 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-10-02  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Enable two point radial gradients in Chromium/Skia.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30017
+
+        Covered by the following tests:
+
+        LayoutTests/svg/W3C-SVG-1.1/pservers-grad-13-b.svg
+        LayoutTests/fast/backgrounds/svg-as-background-3.html
+        LayoutTests/fast/gradients/generated-gradients.html
+        LayoutTests/fast/gradients/simple-gradients.html
+
+        * platform/graphics/skia/GradientSkia.cpp:
+        (WebCore::Gradient::platformGradient):
+
 2009-10-02  Norbert Leser  <norbert.leser at nokia.com>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/platform/graphics/skia/GradientSkia.cpp b/WebCore/platform/graphics/skia/GradientSkia.cpp
index 3bdddb2..268b17e 100644
--- a/WebCore/platform/graphics/skia/GradientSkia.cpp
+++ b/WebCore/platform/graphics/skia/GradientSkia.cpp
@@ -152,19 +152,21 @@ SkShader* Gradient::platformGradient()
     }
 
     if (m_radial) {
-        // FIXME: CSS radial Gradients allow an offset focal point (the
-        // "start circle"), but skia doesn't seem to support that, so this just
-        // ignores m_p0/m_r0 and draws the gradient centered in the "end
-        // circle" (m_p1/m_r1).
-        // See http://webkit.org/blog/175/introducing-css-gradients/ for a
-        // description of the expected behavior.
-        
-        // The radius we give to Skia must be positive (and non-zero).  If
-        // we're given a zero radius, just ask for a very small radius so
-        // Skia will still return an object.
-        SkScalar radius = m_r1 > 0 ? WebCoreFloatToSkScalar(m_r1) : SK_ScalarMin;
-        m_gradient = SkGradientShader::CreateRadial(m_p1,
-            radius, colors, pos, static_cast<int>(countUsed), tile);
+        // Since the two-point radial gradient is slower than the plain radial,
+        // only use it if we have to.
+        if (m_p0 != m_p1) {
+            // The radii we give to Skia must be positive.  If we're given a 
+            // negative radius, ask for zero instead.
+            SkScalar radius0 = m_r0 >= 0.0f ? WebCoreFloatToSkScalar(m_r0) : 0;
+            SkScalar radius1 = m_r1 >= 0.0f ? WebCoreFloatToSkScalar(m_r1) : 0;
+            m_gradient = SkGradientShader::CreateTwoPointRadial(m_p0, radius0, m_p1, radius1, colors, pos, static_cast<int>(countUsed), tile);
+        } else {
+            // The radius we give to Skia must be positive (and non-zero).  If
+            // we're given a zero radius, just ask for a very small radius so
+            // Skia will still return an object.
+            SkScalar radius = m_r1 > 0 ? WebCoreFloatToSkScalar(m_r1) : SK_ScalarMin;
+            m_gradient = SkGradientShader::CreateRadial(m_p1, radius, colors, pos, static_cast<int>(countUsed), tile);
+        }
     } else {
         SkPoint pts[2] = { m_p0, m_p1 };
         m_gradient = SkGradientShader::CreateLinear(pts, colors, pos,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list