Commit 8574a2eb authored by abarth@webkit.org's avatar abarth@webkit.org

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: http://svn.webkit.org/repository/webkit/trunk@46399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bb31450c
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.
......
<!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>
567ec6f2679eb520e8bcb4da0fc1f6ae
\ No newline at end of file
5e5ef0c5f52baafde5f61485640ebe6f
\ No newline at end of file
f13995ea2b4b53dd39ebd5f41de91cbc
\ No newline at end of file
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
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.
......
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment