User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3 Build Identifier: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b6pre) Gecko/20100911 Firefox/4.0b6pre Go to any page with a WebGL canvas. Print the page. The image on the canvas will be upside down. Reproducible: Always Steps to Reproduce: 1. Go to any page with a WebGL Canvas 2. Print the page Actual Results: The WebGL canvas will be printed upside down Expected Results: The WebGL canvas is printed right side up You can avoid wasting paper by using the print preview feature.
Confirmed. Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7pre) Gecko/20100916 Firefox/4.0b7pre
Created attachment 492698 [details] [diff] [review] fix upside-down bug Move the flipping (required for GL<->Thebes interop) from WebGLContext::Render to GLContext::ReadPixelsIntoImageSurface. Indeed this was not a WebGL-specific bug as far as I can see, GLContext::ReadPixelsIntoImageSurface was wrong, and for WebGL this patch makes both 'View image' and 'print preview' work for me. The flipping is done in the same pass as the RGBA->BGRA swizzling for better performance. I didn't check the generated code but the __restrict qualifiers should allow the compiler to do a good job.
Make sure the __restrict stuff passes through try!
It does: we already use __restrict e.g. in http://hg.mozilla.org/mozilla-central/file/tip/content/canvas/src/WebGLTexelConversions.h It also passes on every other compiler that I know of e.g. Sun, XLC, LLVM, QCC... ^ Gregg: by the way, this is the file that we borrowed originally from WebKit and you might want to have a look at our improvements there (__restrict and removing a few divisions).
Comment on attachment 492698 [details] [diff] [review] fix upside-down bug There are other callers of ReadPixelsIntoImageSurface -- I find it hard to believe that they'll still remain correct if the image is flipped from what it was before :-) I'd suggest that ReadPixelsIntoImageSurface gets an option to specify whether to flip the image or not (since it has to do RGB swapping anyway, it can do it more efficiently) -- defaulting to FALSE. The View Image bug is because WebGLContext::GetInputStream was calling ReadPixelsIntoImageSurface and not flipping it. Not sure why the print issue is happening, but I'm guessing similar...
print-preview looks right-side-up for me currently; I believe this was fixed with a number of image-getting changes. reopen if still broken..
Indeed it is working now -- despite bug 625353!