зеркало из https://github.com/mozilla/gecko-dev.git
Bug 985322 - Return RGBA instead of BGRA for external gralloc textures. r=nical
Before bug 950050, we'd calculate a format of BGRA, then ignore it and return RGBA in GetFormat. This just calculates RGBA and returns the format directly.
This commit is contained in:
Родитель
62e7421fb7
Коммит
0cd6b453f9
|
@ -37,11 +37,11 @@ SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat,
|
|||
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
|
||||
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
return gfx::SurfaceFormat::B8G8R8A8; // yup, use SurfaceFormat::B8G8R8A8 even though it's a YUV texture. This is an external texture.
|
||||
return gfx::SurfaceFormat::R8G8B8A8; // yup, use SurfaceFormat::R8G8B8A8 even though it's a YUV texture. This is an external texture.
|
||||
default:
|
||||
if (aFormat >= 0x100 && aFormat <= 0x1FF) {
|
||||
// Reserved range for HAL specific formats.
|
||||
return gfx::SurfaceFormat::B8G8R8A8;
|
||||
return gfx::SurfaceFormat::R8G8B8A8;
|
||||
} else {
|
||||
// This is not super-unreachable, there's a bunch of hypothetical pixel
|
||||
// formats we don't deal with.
|
||||
|
@ -66,6 +66,7 @@ TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat)
|
|||
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
return LOCAL_GL_TEXTURE_EXTERNAL;
|
||||
case android::PIXEL_FORMAT_BGRA_8888:
|
||||
case android::PIXEL_FORMAT_RGBA_8888:
|
||||
case android::PIXEL_FORMAT_RGBX_8888:
|
||||
case android::PIXEL_FORMAT_RGB_565:
|
||||
|
@ -88,14 +89,12 @@ TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat)
|
|||
|
||||
GrallocTextureSourceOGL::GrallocTextureSourceOGL(CompositorOGL* aCompositor,
|
||||
android::GraphicBuffer* aGraphicBuffer,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
TextureFlags aFlags)
|
||||
gfx::SurfaceFormat aFormat)
|
||||
: mCompositor(aCompositor)
|
||||
, mGraphicBuffer(aGraphicBuffer)
|
||||
, mEGLImage(0)
|
||||
, mFormat(aFormat)
|
||||
, mNeedsReset(true)
|
||||
, mFlags(aFlags)
|
||||
{
|
||||
MOZ_ASSERT(mGraphicBuffer.get());
|
||||
}
|
||||
|
@ -207,16 +206,6 @@ GrallocTextureSourceOGL::GetTextureTarget() const
|
|||
return TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat
|
||||
GrallocTextureSourceOGL::GetFormat() const {
|
||||
MOZ_ASSERT(mGraphicBuffer.get());
|
||||
if (!mGraphicBuffer.get()) {
|
||||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
return SurfaceFormatForAndroidPixelFormat(mGraphicBuffer->getPixelFormat(),
|
||||
mFlags & TEXTURE_RB_SWAPPED);
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
|
||||
{
|
||||
|
@ -306,8 +295,7 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
|||
}
|
||||
mTextureSource = new GrallocTextureSourceOGL(nullptr,
|
||||
graphicBuffer,
|
||||
format,
|
||||
aFlags);
|
||||
format);
|
||||
}
|
||||
|
||||
GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
||||
|
|
|
@ -24,8 +24,7 @@ public:
|
|||
|
||||
GrallocTextureSourceOGL(CompositorOGL* aCompositor,
|
||||
android::GraphicBuffer* aGraphicBuffer,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
TextureFlags aFlags);
|
||||
gfx::SurfaceFormat aFormat);
|
||||
|
||||
virtual ~GrallocTextureSourceOGL();
|
||||
|
||||
|
@ -39,7 +38,7 @@ public:
|
|||
|
||||
virtual GLenum GetTextureTarget() const MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual GLenum GetWrapMode() const MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -72,7 +71,6 @@ protected:
|
|||
GLuint mTexture;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
bool mNeedsReset;
|
||||
TextureFlags mFlags;
|
||||
};
|
||||
|
||||
class GrallocTextureHostOGL : public TextureHost
|
||||
|
|
Загрузка…
Ссылка в новой задаче