[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:47:20 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 1eb799d81379f8c8a4770496d8cd28f0f9f2c77a
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 23 02:19:04 2009 +0000

    2009-12-22  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Eric Seidel.
    
            [Chromium] Garbage in transparent regions of images uploaded as textures
            https://bugs.webkit.org/show_bug.cgi?id=32888
    
            * fast/canvas/webgl/bug-32888-expected.txt: Added.
            * fast/canvas/webgl/bug-32888.html: Added.
            * fast/canvas/webgl/resources/bug-32888-texture.png: Added.
    2009-12-22  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Eric Seidel.
    
            [Chromium] Garbage in transparent regions of images uploaded as textures
            https://bugs.webkit.org/show_bug.cgi?id=32888
    
            Test: fast/canvas/webgl/bug-32888.html (works in Safari / DumpRenderTree)
    
            * src/GraphicsContext3D.cpp:
            (WebCore::GraphicsContext3D::texImage2D):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52517 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9d37d03..48d0fd4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-22  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Eric Seidel.
+
+        [Chromium] Garbage in transparent regions of images uploaded as textures
+        https://bugs.webkit.org/show_bug.cgi?id=32888
+
+        * fast/canvas/webgl/bug-32888-expected.txt: Added.
+        * fast/canvas/webgl/bug-32888.html: Added.
+        * fast/canvas/webgl/resources/bug-32888-texture.png: Added.
+
 2009-12-22  Darin Adler  <darin at apple.com>
 
         Removed DataGrid from results.
diff --git a/LayoutTests/fast/canvas/webgl/bug-32888-expected.txt b/LayoutTests/fast/canvas/webgl/bug-32888-expected.txt
new file mode 100644
index 0000000..5f86d7d
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/bug-32888-expected.txt
@@ -0,0 +1,18 @@
+Regression test for https://bugs.webkit.org/show_bug.cgi?id=32888 : Garbage in transparent regions of images uploaded as textures
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Checking lower left corner
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+Checking upper left corner
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/bug-32888.html b/LayoutTests/fast/canvas/webgl/bug-32888.html
new file mode 100644
index 0000000..7026722
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/bug-32888.html
@@ -0,0 +1,161 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/webgl-test.js"></script>
+<script src="resources/utils3d.js"> </script>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec3 g_Position;
+attribute vec2 g_TexCoord0;
+
+varying vec2 texCoord;
+
+void main()
+{
+    gl_Position = vec4(g_Position.x, g_Position.y, g_Position.z, 1.0);
+    texCoord = g_TexCoord0;
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+uniform sampler2D tex;
+varying vec2 texCoord;
+
+void main()
+{
+    gl_FragColor = texture2D(tex, texCoord);
+}
+</script>
+
+<script>
+var gl = null;
+var textureLoc = null;
+var successfullyParsed = false;
+
+function init()
+{
+    if (window.layoutTestController) {
+        layoutTestController.overridePreference("WebKitWebGLEnabled", "1");
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    description('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=32888">https://bugs.webkit.org/show_bug.cgi?id=32888</a> : <code>Garbage in transparent regions of images uploaded as textures</code>');
+
+    gl = initWebGL("example", "vshader", "fshader", [ "g_Position", "g_TexCoord0" ], [ 0, 0, 0, 1 ], 1);
+    gl.viewport(0, 0, 32, 32);
+
+    textureLoc = gl.getUniformLocation(gl.program, "tex");
+
+    var vertices = new WebGLFloatArray([
+         1.0,  1.0, 0.0,
+        -1.0,  1.0, 0.0,
+        -1.0, -1.0, 0.0,
+         1.0,  1.0, 0.0,
+        -1.0, -1.0, 0.0,
+         1.0, -1.0, 0.0]);
+    // The input texture has 8 characters; take the leftmost one
+    var coeff = 1.0 / 8.0;
+    var texCoords = new WebGLFloatArray([
+        coeff, 1.0,
+        0.0, 1.0,
+        0.0, 0.0,
+        coeff, 1.0,
+        0.0, 0.0,
+        coeff, 0.0]);
+    var texCoordOffset = vertices.byteLength;
+
+    var vbo = gl.createBuffer();
+    gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
+    gl.bufferData(gl.ARRAY_BUFFER,
+                  texCoordOffset + texCoords.byteLength,
+                  gl.STATIC_DRAW);
+    gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices);
+    gl.bufferSubData(gl.ARRAY_BUFFER, texCoordOffset, texCoords);
+
+    gl.enableVertexAttribArray(0);
+    gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+    gl.enableVertexAttribArray(1);
+    gl.vertexAttribPointer(1, 2, gl.FLOAT, gl.FALSE, 0, texCoordOffset);
+
+    texture = loadTexture("resources/bug-32888-texture.png");
+}
+
+function loadTexture(src) {
+    var texture = gl.createTexture();
+    gl.bindTexture(gl.TEXTURE_2D, texture);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+    var image = new Image();
+    image.onload = function() {
+        gl.bindTexture(gl.TEXTURE_2D, texture);
+        gl.texImage2D(gl.TEXTURE_2D, 0, image, true);
+        runTest();
+    };
+    image.src = src;
+    return texture;
+}
+
+// These two declarations need to be global for "shouldBe" to see them
+var buf = null;
+var idx = 0;
+
+function runTest()
+{
+    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+    // Bind the texture to texture unit 0
+    gl.bindTexture(gl.TEXTURE_2D, texture);
+    // Point the uniform sampler to texture unit 0
+    gl.uniform1i(textureLoc, 0);
+    // Draw the triangles
+    gl.drawArrays(gl.TRIANGLES, 0, 6);
+
+    // Read back the rendering results
+    var width = 32;
+    var height = 32;
+    buf = gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE);
+    // Spot check a couple of 2x2 regions in the upper and lower left
+    // corners; they should be the background color rather than
+    // garbage
+    var queryWidth = 2;
+    var queryHeight = 2;
+    debug("Checking lower left corner");
+    var xoff = 1;
+    var yoff = height - 3;
+    for (var y = 0; y < queryHeight; y++) {
+        for (var x = 0; x < queryWidth; x++) {
+            idx = ((yoff + y) * width * 4 +
+                   (xoff + x) * 4);
+            shouldBe("buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0", "true");
+        }
+    }
+    debug("Checking upper left corner");
+    yoff = 1;
+    for (var y = 0; y < queryHeight; y++) {
+        for (var x = 0; x < queryWidth; x++) {
+            idx = ((yoff + y) * width * 4 +
+                   (xoff + x) * 4);
+            shouldBe("buf[idx] == 0 && buf[idx + 1] == 0 && buf[idx + 2] == 0", "true");
+        }
+    }
+
+    successfullyParsed = true;
+    var epilogue = document.createElement("script");
+    epilogue.onload = finish;
+    epilogue.src = "../../js/resources/js-test-post.js";
+    document.body.appendChild(epilogue);
+}
+
+function finish() {
+    if (window.layoutTestController) {
+        layoutTestController.notifyDone();
+    }
+}
+</script>
+</head>
+<body onload="init()">
+<canvas id="example" width="32px" height="32px"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/webgl/resources/bug-32888-texture.png b/LayoutTests/fast/canvas/webgl/resources/bug-32888-texture.png
new file mode 100644
index 0000000..e78cfe7
Binary files /dev/null and b/LayoutTests/fast/canvas/webgl/resources/bug-32888-texture.png differ
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 9ddeada..34ffe5b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-22  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Eric Seidel.
+
+        [Chromium] Garbage in transparent regions of images uploaded as textures
+        https://bugs.webkit.org/show_bug.cgi?id=32888
+
+        Test: fast/canvas/webgl/bug-32888.html (works in Safari / DumpRenderTree)
+
+        * src/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::texImage2D):
+
 2009-12-22  Adam Langley  <agl at google.com>
 
         Build fix: not reviewed.
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index 6440552..020dc05 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -2047,6 +2047,7 @@ int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image,
                                                     colorSpace,
                                                     kCGImageAlphaPremultipliedLast);
     CGColorSpaceRelease(colorSpace);
+    CGContextSetBlendMode(tmpContext, kCGBlendModeCopy);
     CGContextDrawImage(tmpContext,
                        CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)),
                        cgImage);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list