Bug 728524 - Invalid OP fix. r=jgilbert
authorOleg Romashin <oleg.romashin@nokia.com>
Sun, 15 Jul 2012 11:11:17 -0400
changeset 99369 02c4bf15eb5987d779858fb6ef6b021e765fb530
parent 99368 6fed555b91c3f62d1b819601b2010a60d2b1e27f
child 99370 8c74c9a515c75ae1eb5045e8d63f22231381ad82
push id11963
push userromaxa@gmail.com
push dateSun, 15 Jul 2012 18:17:50 +0000
treeherdermozilla-inbound@02c4bf15eb59 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs728524
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 728524 - Invalid OP fix. r=jgilbert
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -1269,22 +1269,22 @@ void TiledTextureImage::Resize(const nsI
 }
 
 PRUint32 TiledTextureImage::GetTileCount()
 {
     return mImages.Length();
 }
 
 GLContext::GLFormats
-GLContext::ChooseGLFormats(ContextFormat& aCF)
+GLContext::ChooseGLFormats(ContextFormat& aCF, ColorByteOrder aByteOrder)
 {
     GLFormats formats;
 
     if (aCF.alpha) {
-        if (mIsGLES2 && IsExtensionSupported(EXT_texture_format_BGRA8888)) {
+        if (mIsGLES2 && IsExtensionSupported(EXT_texture_format_BGRA8888) && aByteOrder != ForceRGBA) {
             formats.texColor = LOCAL_GL_BGRA;
         } else {
             formats.texColor = LOCAL_GL_RGBA;
         }
 
         if (mIsGLES2 && !IsExtensionSupported(OES_rgb8_rgba8)) {
             formats.rbColor = LOCAL_GL_RGBA4;
             aCF.red = aCF.green = aCF.blue = aCF.alpha = 4;
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1721,17 +1721,22 @@ protected:
         GLenum texColorType;
         GLenum rbColor;
         GLenum depthStencil;
         GLenum depth;
         GLenum stencil;
         GLsizei samples;
     };
 
-    GLFormats ChooseGLFormats(ContextFormat& aCF);
+    enum ColorByteOrder {
+      ForceRGBA,
+      DefaultByteOrder
+    };
+
+    GLFormats ChooseGLFormats(ContextFormat& aCF, GLContext::ColorByteOrder aByteOrder = GLContext::DefaultByteOrder);
     void CreateTextureForOffscreen(const GLFormats& aFormats, const gfxIntSize& aSize,
                                    GLuint& texture);
     void CreateRenderbuffersForOffscreen(const GLContext::GLFormats& aFormats, const gfxIntSize& aSize,
                                          GLuint& colorMSRB, GLuint& depthRB, GLuint& stencilRB);
     bool AssembleOffscreenFBOs(const GLuint colorMSRB,
                                const GLuint depthRB,
                                const GLuint stencilRB,
                                const GLuint texture,
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -750,17 +750,17 @@ GLContextEGL::CreateSharedHandle(Texture
         return nsnull;
 
     if (!mShareWithEGLImage)
         return nsnull;
 
     MakeCurrent();
     GLuint texture = 0;
     ContextFormat fmt = ActualFormat();
-    CreateTextureForOffscreen(ChooseGLFormats(fmt), mOffscreenSize, texture);
+    CreateTextureForOffscreen(ChooseGLFormats(fmt, GLContext::ForceRGBA), mOffscreenSize, texture);
     // texture ownership moved to EGLTextureWrapper after  this point
     // and texture will be deleted in EGLTextureWrapper dtor
     EGLTextureWrapper* tex = new EGLTextureWrapper(this, texture);
     if (!tex->CreateEGLImage()) {
         NS_ERROR("EGLImage creation for EGLTextureWrapper failed");
         ReleaseSharedHandle(aType, (SharedTextureHandle)tex);
 
         // Stop trying to create shared image Handle