b=625353; webgl canvas "show image" upside down; r=bjacob, a=b
authorVladimir Vukicevic <vladimir@pobox.com>
Mon, 31 Jan 2011 13:11:04 -0800
changeset 61665 46d40c236f3d39f433269412e0af46d4dc62038d
parent 61664 688dd0a52427bb90a0fd747f111f44f22b440859
child 61666 fe7b943b7a25fac7d8756a48bf4ca1d869b161c8
push id18437
push uservladimir@mozilla.com
push dateMon, 31 Jan 2011 21:12:06 +0000
treeherdermozilla-central@46d40c236f3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob, b
bugs625353
milestone2.0b11pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=625353; webgl canvas "show image" upside down; r=bjacob, a=b
content/canvas/src/WebGLContext.cpp
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -569,19 +569,22 @@ WebGLContext::GetInputStream(const char*
     if (!gl)
         return NS_ERROR_FAILURE;
 
     nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
                                                          gfxASurface::ImageFormatARGB32);
     if (surf->CairoStatus() != 0)
         return NS_ERROR_FAILURE;
 
-    gl->ReadPixelsIntoImageSurface(0, 0, mWidth, mHeight, surf);
+    nsRefPtr<gfxContext> tmpcx = new gfxContext(surf);
+    // Use Render() to make sure that appropriate y-flip gets applied
+    nsresult rv = Render(tmpcx, gfxPattern::FILTER_NEAREST);
+    if (NS_FAILED(rv))
+        return rv;
 
-    nsresult rv;
     const char encoderPrefix[] = "@mozilla.org/image/encoder;2?type=";
     nsAutoArrayPtr<char> conid(new char[strlen(encoderPrefix) + strlen(aMimeType) + 1]);
 
     if (!conid)
         return NS_ERROR_OUT_OF_MEMORY;
 
     strcpy(conid, encoderPrefix);
     strcat(conid, aMimeType);