Closed Bug 597207 Opened 14 years ago Closed 14 years ago

WebGL canvases print upsidedown

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

VERIFIED WORKSFORME
Tracking Status
blocking2.0 --- final+

People

(Reporter: mozilla2, Assigned: bjacob)

References

()

Details

Attachments

(1 file)

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
Status: UNCONFIRMED → NEW
Component: General → Canvas: WebGL
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → canvas.webgl
Version: unspecified → Trunk
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.
Assignee: nobody → bjacob
Status: NEW → ASSIGNED
Attachment #492698 - Flags: review?(vladimir)
blocking2.0: --- → ?
Make sure the __restrict stuff passes through try!
blocking2.0: ? → final+
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...
Attachment #492698 - Flags: review?(vladimir) → review-
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..
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Indeed it is working now -- despite bug 625353!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: