Bug 958420 - Remove obsolete code trying to use PIXEL_FORMAT_A_8 with gralloc. r=gal, r=pchang
authorSolomon Chiu <schiu@mozilla.com>
Mon, 13 Jan 2014 10:00:34 +0800
changeset 163547 d0b6a2d398b6113d15a571934faaee01f968f0c1
parent 163546 fbe57a30e322ced26f5d35a78805156ddfd7fd4d
child 163548 8fc3d2e02f478e1c80a83ef1c405bf2cda476892
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersgal, pchang
bugs958420
milestone29.0a1
Bug 958420 - Remove obsolete code trying to use PIXEL_FORMAT_A_8 with gralloc. r=gal, r=pchang
gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
gfx/layers/opengl/GrallocTextureClient.cpp
gfx/layers/opengl/GrallocTextureHost.cpp
gfx/layers/opengl/TextureHostOGL.cpp
--- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
@@ -151,36 +151,32 @@ ImageFormatForPixelFormat(android::Pixel
 {
   switch (aFormat) {
   case PIXEL_FORMAT_RGBA_8888:
     return gfxImageFormatARGB32;
   case PIXEL_FORMAT_RGBX_8888:
     return gfxImageFormatRGB24;
   case PIXEL_FORMAT_RGB_565:
     return gfxImageFormatRGB16_565;
-  case PIXEL_FORMAT_A_8:
-    return gfxImageFormatA8;
   default:
     MOZ_CRASH("Unknown gralloc pixel format");
   }
   return gfxImageFormatARGB32;
 }
 
 static android::PixelFormat
 PixelFormatForImageFormat(gfxImageFormat aFormat)
 {
   switch (aFormat) {
   case gfxImageFormatARGB32:
     return android::PIXEL_FORMAT_RGBA_8888;
   case gfxImageFormatRGB24:
     return android::PIXEL_FORMAT_RGBX_8888;
   case gfxImageFormatRGB16_565:
     return android::PIXEL_FORMAT_RGB_565;
-  case gfxImageFormatA8:
-    return android::PIXEL_FORMAT_A_8;
   default:
     MOZ_CRASH("Unknown gralloc pixel format");
   }
   return gfxImageFormatARGB32;
 }
 
 static size_t
 BytesPerPixelForPixelFormat(android::PixelFormat aFormat)
@@ -191,18 +187,16 @@ BytesPerPixelForPixelFormat(android::Pix
   case PIXEL_FORMAT_BGRA_8888:
     return 4;
   case PIXEL_FORMAT_RGB_888:
     return 3;
   case PIXEL_FORMAT_RGB_565:
   case PIXEL_FORMAT_RGBA_5551:
   case PIXEL_FORMAT_RGBA_4444:
     return 2;
-  case PIXEL_FORMAT_A_8:
-    return 1;
   default:
     return 0;
   }
   return 0;
 }
 
 static android::PixelFormat
 PixelFormatForContentType(gfxContentType aContentType)
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -224,19 +224,16 @@ GrallocTextureClientOGL::AllocateForSurf
   case gfx::SurfaceFormat::R8G8B8X8:
   case gfx::SurfaceFormat::B8G8R8X8:
     // there is no android BGRX format?
     format = android::PIXEL_FORMAT_RGBX_8888;
     break;
   case gfx::SurfaceFormat::R5G6B5:
     format = android::PIXEL_FORMAT_RGB_565;
     break;
-  case gfx::SurfaceFormat::A8:
-    format = android::PIXEL_FORMAT_A_8;
-    break;
   default:
     NS_WARNING("Unsupported surface format");
     return false;
   }
 
   return AllocateGralloc(aSize, format, usage);
 }
 
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -26,18 +26,16 @@ SurfaceFormatForAndroidPixelFormat(andro
   case android::PIXEL_FORMAT_BGRA_8888:
     return swapRB ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8A8;
   case android::PIXEL_FORMAT_RGBA_8888:
     return swapRB ? gfx::SurfaceFormat::B8G8R8A8 : gfx::SurfaceFormat::R8G8B8A8;
   case android::PIXEL_FORMAT_RGBX_8888:
     return swapRB ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::R8G8B8X8;
   case android::PIXEL_FORMAT_RGB_565:
     return gfx::SurfaceFormat::R5G6B5;
-  case android::PIXEL_FORMAT_A_8:
-    return gfx::SurfaceFormat::A8;
   case HAL_PIXEL_FORMAT_YCbCr_422_SP:
   case HAL_PIXEL_FORMAT_YCrCb_420_SP:
   case HAL_PIXEL_FORMAT_YCbCr_422_I:
   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.
   default:
@@ -66,17 +64,16 @@ TextureTargetForAndroidPixelFormat(andro
   case HAL_PIXEL_FORMAT_YCbCr_422_I:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
   case HAL_PIXEL_FORMAT_YV12:
     return LOCAL_GL_TEXTURE_EXTERNAL;
   case android::PIXEL_FORMAT_RGBA_8888:
   case android::PIXEL_FORMAT_RGBX_8888:
   case android::PIXEL_FORMAT_RGB_565:
-  case android::PIXEL_FORMAT_A_8:
     return LOCAL_GL_TEXTURE_2D;
   default:
     if (aFormat >= 0x100 && aFormat <= 0x1FF) {
       // Reserved range for HAL specific formats.
       return LOCAL_GL_TEXTURE_EXTERNAL;
     } else {
       // This is not super-unreachable, there's a bunch of hypothetical pixel
       // formats we don't deal with.
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -1257,18 +1257,16 @@ Deprecated_SurfaceFormatForAndroidPixelF
   case android::PIXEL_FORMAT_BGRA_8888:
     return swapRB ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::B8G8R8A8;
   case android::PIXEL_FORMAT_RGBA_8888:
     return swapRB ? SurfaceFormat::B8G8R8A8 : SurfaceFormat::R8G8B8A8;
   case android::PIXEL_FORMAT_RGBX_8888:
     return swapRB ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R8G8B8X8;
   case android::PIXEL_FORMAT_RGB_565:
     return SurfaceFormat::R5G6B5;
-  case android::PIXEL_FORMAT_A_8:
-    return SurfaceFormat::A8;
   case HAL_PIXEL_FORMAT_YCbCr_422_SP:
   case HAL_PIXEL_FORMAT_YCrCb_420_SP:
   case HAL_PIXEL_FORMAT_YCbCr_422_I:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
   case HAL_PIXEL_FORMAT_YV12:
     return SurfaceFormat::B8G8R8A8; // yup, use SurfaceFormat::B8G8R8A8 even though it's a YUV texture. This is an external texture.
   default:
@@ -1296,17 +1294,16 @@ Deprecated_TextureTargetForAndroidPixelF
   case HAL_PIXEL_FORMAT_YCbCr_422_I:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
   case HAL_PIXEL_FORMAT_YV12:
     return LOCAL_GL_TEXTURE_EXTERNAL;
   case android::PIXEL_FORMAT_RGBA_8888:
   case android::PIXEL_FORMAT_RGBX_8888:
   case android::PIXEL_FORMAT_RGB_565:
-  case android::PIXEL_FORMAT_A_8:
     return LOCAL_GL_TEXTURE_2D;
   default:
     if (aFormat >= 0x100 && aFormat <= 0x1FF) {
       // Reserved range for HAL specific formats.
       return LOCAL_GL_TEXTURE_EXTERNAL;
     } else {
       // This is not super-unreachable, there's a bunch of hypothetical pixel
       // formats we don't deal with.