summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabarth@webkit.org <abarth@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2009-07-25 22:00:50 +0000
committerabarth@webkit.org <abarth@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2009-07-25 22:00:50 +0000
commit69072815acc858644d314ebc0ff330ab940a1b8e (patch)
tree3c9ea04bba22750dffb48a528612e9db3b3414c7
parentaadae86cacb0eec452ff3c99e473754252b39394 (diff)
downloadchromium_src-69072815acc858644d314ebc0ff330ab940a1b8e.zip
chromium_src-69072815acc858644d314ebc0ff330ab940a1b8e.tar.gz
chromium_src-69072815acc858644d314ebc0ff330ab940a1b8e.tar.bz2
2009-07-16 Shinichiro Hamaji <hamaji@chromium.org>
Reviewed by Oliver Hunt. Canvas: rotation of 'no-repeat' pattern still has small error https://bugs.webkit.org/show_bug.cgi?id=26749 Use (1<<23)/2 as steps of no-repeat pattern to make the error less than 0.5. The previous value may cause 1 pixel errors. Add another test to show this bug clearly. Also add png expected image which was missing in the previous patch. * fast/canvas/image-pattern-rotate.html: Added. * platform/mac/fast/canvas/image-object-in-canvas-expected.checksum: * platform/mac/fast/canvas/image-object-in-canvas-expected.png: * platform/mac/fast/canvas/image-pattern-rotate-expected.checksum: Added. * platform/mac/fast/canvas/image-pattern-rotate-expected.png: Added. * platform/mac/fast/canvas/image-pattern-rotate-expected.txt: Added. 2009-07-16 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Oliver Hunt. Canvas: rotation of 'no-repeat' pattern still has small error https://bugs.webkit.org/show_bug.cgi?id=26749 Use (1<<23)/2 as steps of no-repeat pattern to make the error less than 0.5. The previous value may cause 1 pixel errors. Add another test to show this bug clearly. Also add png expected image which was missing in the previous patch. Test: fast/canvas/image-pattern-rotate.html * platform/graphics/cg/PatternCG.cpp: (WebCore::Pattern::createPlatformPattern): git-svn-id: svn://svn.chromium.org/blink/trunk@46399 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r--third_party/WebKit/LayoutTests/ChangeLog20
-rw-r--r--third_party/WebKit/LayoutTests/fast/canvas/image-pattern-rotate.html53
-rw-r--r--third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-object-in-canvas-expected.checksum2
-rw-r--r--third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.checksum1
-rw-r--r--third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.txt41
-rw-r--r--third_party/WebKit/WebCore/ChangeLog18
-rw-r--r--third_party/WebKit/WebCore/platform/graphics/cg/PatternCG.cpp7
7 files changed, 137 insertions, 5 deletions
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog
index 6a5b5bb..2cb01ac 100644
--- a/third_party/WebKit/LayoutTests/ChangeLog
+++ b/third_party/WebKit/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2009-07-16 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ Canvas: rotation of 'no-repeat' pattern still has small error
+ https://bugs.webkit.org/show_bug.cgi?id=26749
+
+ Use (1<<23)/2 as steps of no-repeat pattern to make the error less
+ than 0.5. The previous value may cause 1 pixel errors.
+
+ Add another test to show this bug clearly.
+ Also add png expected image which was missing in the previous patch.
+
+ * fast/canvas/image-pattern-rotate.html: Added.
+ * platform/mac/fast/canvas/image-object-in-canvas-expected.checksum:
+ * platform/mac/fast/canvas/image-object-in-canvas-expected.png:
+ * platform/mac/fast/canvas/image-pattern-rotate-expected.checksum: Added.
+ * platform/mac/fast/canvas/image-pattern-rotate-expected.png: Added.
+ * platform/mac/fast/canvas/image-pattern-rotate-expected.txt: Added.
+
2009-07-25 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
Reviewed by George Staikos.
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/image-pattern-rotate.html b/third_party/WebKit/LayoutTests/fast/canvas/image-pattern-rotate.html
new file mode 100644
index 0000000..83fbae4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/image-pattern-rotate.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<script>
+var img;
+
+function imageLoaded() {
+ var NUM_IMAGE = 16;
+ for (var i = 0; i < NUM_IMAGE; i++) {
+ var canvases = document.getElementById('canvases');
+ var canvas = document.createElement('canvas');
+ canvas.width = 3;
+ canvas.height = 3;
+ var ctx = canvas.getContext('2d');
+
+ var pattern = ctx.createPattern(img, 'no-repeat');
+ ctx.fillStyle = pattern;
+ ctx.translate(img.width / 2, img.height / 2);
+ var angle = 2 * Math.PI * i / NUM_IMAGE;
+ ctx.rotate(angle);
+ ctx.translate(- img.width / 2, - img.height / 2);
+ ctx.fillRect(0, 0, img.width, img.height);
+
+ var div = document.createElement('div');
+ div.appendChild(canvas);
+ canvases.appendChild(div);
+ }
+
+ if (window.layoutTestController) {
+ layoutTestController.notifyDone();
+ }
+}
+
+function runTests() {
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ }
+
+ img = new Image();
+ img.onload = imageLoaded;
+ img.src = ('data:image/png;base64,' +
+ 'iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAIAAADZSiLoAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kHEAcrAR/kt7IAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAFElEQVQI12P4//8/AwMDhIQBuBgAs2oL9bpyMd8AAAAASUVORK5CYII=');
+
+}
+</script>
+</head>
+<body onload="runTests();">
+You should see (almost) straight vertical line below.
+<div id="canvases"></div>
+</pre>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-object-in-canvas-expected.checksum b/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-object-in-canvas-expected.checksum
index edcc339..1726bde 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-object-in-canvas-expected.checksum
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-object-in-canvas-expected.checksum
@@ -1 +1 @@
-567ec6f2679eb520e8bcb4da0fc1f6ae \ No newline at end of file
+5e5ef0c5f52baafde5f61485640ebe6f \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.checksum b/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.checksum
new file mode 100644
index 0000000..037dd48
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.checksum
@@ -0,0 +1 @@
+f13995ea2b4b53dd39ebd5f41de91cbc \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.txt
new file mode 100644
index 0000000..f13aaabd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/image-pattern-rotate-expected.txt
@@ -0,0 +1,41 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x82
+ RenderBlock {HTML} at (0,0) size 800x82
+ RenderBody {BODY} at (8,8) size 784x66
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 327x18
+ text run at (0,0) width 327: "You should see (almost) straight vertical line below."
+ RenderBlock {DIV} at (0,18) size 784x48
+ RenderBlock {DIV} at (0,0) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,3) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,6) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,9) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,12) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,15) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,18) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,21) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,24) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,27) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,30) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,33) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,36) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,39) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,42) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
+ RenderBlock {DIV} at (0,45) size 784x3
+ RenderHTMLCanvas {CANVAS} at (0,0) size 3x3
diff --git a/third_party/WebKit/WebCore/ChangeLog b/third_party/WebKit/WebCore/ChangeLog
index 8e11ae8..fab381f 100644
--- a/third_party/WebKit/WebCore/ChangeLog
+++ b/third_party/WebKit/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-07-16 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ Canvas: rotation of 'no-repeat' pattern still has small error
+ https://bugs.webkit.org/show_bug.cgi?id=26749
+
+ Use (1<<23)/2 as steps of no-repeat pattern to make the error less
+ than 0.5. The previous value may cause 1 pixel errors.
+
+ Add another test to show this bug clearly.
+ Also add png expected image which was missing in the previous patch.
+
+ Test: fast/canvas/image-pattern-rotate.html
+
+ * platform/graphics/cg/PatternCG.cpp:
+ (WebCore::Pattern::createPlatformPattern):
+
2009-07-25 Kwang Yul Seo <skyul@company100.net>
Reviewed by Darin Adler.
diff --git a/third_party/WebKit/WebCore/platform/graphics/cg/PatternCG.cpp b/third_party/WebKit/WebCore/platform/graphics/cg/PatternCG.cpp
index f985a78..63628f4 100644
--- a/third_party/WebKit/WebCore/platform/graphics/cg/PatternCG.cpp
+++ b/third_party/WebKit/WebCore/platform/graphics/cg/PatternCG.cpp
@@ -63,10 +63,9 @@ CGPatternRef Pattern::createPlatformPattern(const TransformationMatrix& userSpac
// result in nothing being rendered.
// INT_MAX is almost correct, but there seems to be some number wrapping occuring making the fill
// pattern is not filled correctly.
- // To make error of floating point less than 1, we need to use a big number which is smaller than the
- // number of mantissa of float (1 << 23).
- CGFloat xStep = m_repeatX ? tileRect.width() : ((1 << 23) - 1);
- CGFloat yStep = m_repeatY ? tileRect.height() : ((1 << 23) - 1);
+ // To make error of floating point less than 0.5, we use the half of the number of mantissa of float (1 << 22).
+ CGFloat xStep = m_repeatX ? tileRect.width() : (1 << 22);
+ CGFloat yStep = m_repeatY ? tileRect.height() : (1 << 22);
// The pattern will release the tile when it's done rendering in patternReleaseCallback
tileImage()->ref();