Closed Bug 956141 Opened 11 years ago Closed 11 years ago

Move y-flipping feature out of GLContext, into CompositorOGL

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: bjacob, Assigned: bjacob)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file, 1 obsolete file)

OpenGL knows natively only one coordinate system, where the y axis is upwards. But in a browser's layout engine, one naturally wants the y axis to point downwards, as web pages are typically scrolled downwards from "the top of the page". So, some y-flipping needs to take place, somewhere. So far, the y-flipping was a feature of GLContext. GLContext had a mFlipped flag defaulting to false, and the compositor set it to true on its GLContext. GLContext was a bad choice of a place to implement that flipping. Even leaving aside aesthetic or practicality considerations, there was a basic problem: in order to implement such a flipping, one needs to know a "height" so one can compute the (y -> height - y) transformation, and OpenGL contexts do not have a "height" notion. That problem was hacked around by using the viewport height (as in glViewport). That in turn created a deeper problem: glViewport is only meant to specify a coordinate transformation, and using its height to implement the flipping made our GLContext class depart significantly from standard OpenGL semantics. For example, in standard OpenGL, glViewport does not affect glScissor at all, but with GLContext's flipping, it does. Since the only user of the flipping feature was the GL compositor, it seems natural to move it there. Since some more flipping had to live there anyway, this also has the benefit of putting all the related flipping in one place.
Attachment #8355319 - Flags: review?(ncameron)
Attachment #8355319 - Flags: review?(jgilbert)
Assignee: nobody → bjacob
Removed a bad change in CopyToTarget which was unneeded and causing reftest-sanity to fail. Now passing reftest-sanity locally.
Attachment #8355769 - Flags: review?(ncameron)
Attachment #8355769 - Flags: review?(jgilbert)
Attachment #8355319 - Attachment is obsolete: true
Attachment #8355319 - Flags: review?(ncameron)
Attachment #8355319 - Flags: review?(jgilbert)
Comment on attachment 8355769 [details] [diff] [review] Move flipping out of GLContext into CompositorOGL Review of attachment 8355769 [details] [diff] [review]: ----------------------------------------------------------------- Nice. ::: gfx/layers/opengl/CompositorOGL.h @@ +327,5 @@ > * Records the passed frame timestamp and returns the current estimated FPS. > */ > double AddFrameAndGetFps(const TimeStamp& timestamp); > > + GLint FlippedY(GLint y) const { return mHeight - y; } Could this have a better name and a comment please? It is pretty non-obvious what is going on.
Attachment #8355769 - Flags: review?(ncameron) → review+
Comment on attachment 8355769 [details] [diff] [review] Move flipping out of GLContext into CompositorOGL Review of attachment 8355769 [details] [diff] [review]: ----------------------------------------------------------------- Thank you so much!
Attachment #8355769 - Flags: review?(jgilbert) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Depends on: 962721
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: