The default bug view has changed. See this FAQ.

WebGL canvases print upsidedown

VERIFIED WORKSFORME

Status

()

Core
Canvas: WebGL
VERIFIED WORKSFORME
7 years ago
6 years ago

People

(Reporter: Gregg Tavares, Assigned: bjacob)

Tracking

Trunk
x86
Windows 7
Points:
---

Firefox Tracking Flags

(blocking2.0 final+)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
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.

Comment 1

7 years ago
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
(Assignee)

Updated

6 years ago
Duplicate of this bug: 614150
(Assignee)

Comment 3

6 years ago
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.
Assignee: nobody → bjacob
Status: NEW → ASSIGNED
Attachment #492698 - Flags: review?(vladimir)
(Assignee)

Updated

6 years ago
blocking2.0: --- → ?
Make sure the __restrict stuff passes through try!
blocking2.0: ? → final+
(Assignee)

Comment 5

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
(Assignee)

Comment 8

6 years ago
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.