Closed Bug 583844 Opened 14 years ago Closed 14 years ago

ReadPixels fixes for PACK_ALIGNMENT and EXT_bgra

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta4+

People

(Reporter: vlad, Assigned: vlad)

Details

Attachments

(1 file)

For WebGL especially, GL_PACK_ALIGNMENT is under content control; we need to force it to be what we expect when calling glReadPixels.  Also fix correct usage of BGRA format and byte swap where needed.
Attachment #462165 - Flags: review?(bjacob)
blocking2.0: --- → beta4+
Comment on attachment 462165 [details] [diff] [review]
fix readpixels calls

OK, just 1 argh,

-        // XXX byteswap
+
+        // swap B and R bytes
+        for (int j = 0; j < mBounds.height; ++j) {
+          PRUint32 *row = (PRUint32*) (isurf->Data() + isurf->Stride() * j);
+          for (int i = 0; i < mBounds.width; ++i) {
+            *row = (*row & 0xff00ff00) | ((*row & 0xff) << 16) | ((*row & 0xff0000) >> 16);
+            row++;
+          }
+        }

Argh, one more place where we have to loop over all pixels in the CPU...
Attachment #462165 - Flags: review?(bjacob) → review+
http://hg.mozilla.org/mozilla-central/rev/09a07cc60743

part of this ended up going in inside

http://hg.mozilla.org/mozilla-central/rev/d879bb244890
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: