Bug 691646 - Pattern tile pixelated on patternTransform. r=dholbert
authorRobert Longson <longsonr@gmail.com>
Tue, 04 Oct 2011 09:38:21 +0100
changeset 78726 9c7b5bdb4f04139e0913b22183ef13e0884cd327
parent 78695 86b2eda5770082ffbe65bf660cfee7b42605d867
child 78727 8dac1be4c4c1566320b4de994512aa502bd951e0
push id506
push userclegnitto@mozilla.com
push dateWed, 09 Nov 2011 02:03:18 +0000
treeherdermozilla-aurora@63587fc7bb93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs691646
milestone10.0a1
Bug 691646 - Pattern tile pixelated on patternTransform. r=dholbert
layout/reftests/svg/pattern-scale-01-ref.svg
layout/reftests/svg/pattern-scale-01.svg
layout/reftests/svg/reftest.list
layout/svg/base/src/nsSVGPatternFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/pattern-scale-01-ref.svg
@@ -0,0 +1,7 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg">
+  <circle cx="100" cy="100" r="100" fill="lime"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/pattern-scale-01.svg
@@ -0,0 +1,12 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg">
+  <defs>
+    <pattern id="pattern" width="5" height="5" patternUnits="userSpaceOnUse" patternTransform="scale(-40)">
+      <circle cx="2.5" cy="2.5" r="2.5" fill="lime" />
+    </pattern>
+  </defs>
+  <rect width="200" height="200" fill="url(#pattern)"/>
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -171,16 +171,17 @@ fails-if(Android&&layersOpenGL) == outer
 fails-if(Android&&layersOpenGL) == path-04.svg pass.svg
 == path-05.svg pass.svg
 == pathLength-01.svg pass.svg
 == pathLength-02.svg pass.svg
 == pattern-invalid-01.svg pattern-invalid-01-ref.svg
 == pattern-live-01a.svg pattern-live-01-ref.svg
 == pattern-live-01b.svg pattern-live-01-ref.svg
 == pattern-live-01c.svg pattern-live-01-ref.svg
+== pattern-scale-01.svg pattern-scale-01-ref.svg
 == pattern-transform-presence-01.svg pattern-transform-presence-01-ref.svg
 == polygon-marker-01.svg pass.svg
 == polygon-points-negative-01.svg pass.svg
 == polyline-points-invalid-01.svg pass.svg
 == pseudo-classes-01.svg pass.svg
 # This test depends on :visited styles (which are asynchronous), so we run
 # it in layout/style/test/test_visited_reftests.html instead of using the
 # reftest harness.
--- a/layout/svg/base/src/nsSVGPatternFrame.cpp
+++ b/layout/svg/base/src/nsSVGPatternFrame.cpp
@@ -256,18 +256,20 @@ nsSVGPatternFrame::PaintPattern(gfxASurf
 
   // Now that we have all of the necessary geometries, we can
   // create our surface.
   float patternWidth = bbox.Width();
   float patternHeight = bbox.Height();
 
   bool resultOverflows;
   gfxIntSize surfaceSize =
-    nsSVGUtils::ConvertToSurfaceSize(gfxSize(patternWidth, patternHeight),
-                                     &resultOverflows);
+    nsSVGUtils::ConvertToSurfaceSize(
+      gfxSize(patternWidth * fabs(patternMatrix->xx),
+              patternHeight * fabs(patternMatrix->yy)),
+      &resultOverflows);
 
   // 0 disables rendering, < 0 is an error
   if (surfaceSize.width <= 0 || surfaceSize.height <= 0)
     return NS_ERROR_FAILURE;
 
   if (resultOverflows ||
       patternWidth != surfaceSize.width ||
       patternHeight != surfaceSize.height) {