Bug 740372 - Handle MOZ_GFX_OPTIMIZE_MOBILE in gfxASurface and gfx2DGlue format conversion functions. r=jrmuizel
authorGeorge Wright <gwright@mozilla.com>
Fri, 30 Mar 2012 11:56:08 -0400
changeset 94045 f7a96b2c55f423f30c2828e766f6e4cc19e03641
parent 94044 5a3a3536f52a9cb2d4a47f0ff871652ef4478813
child 94046 96fcc34dbbc9bd3943af8d75a105b83cfa61941b
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs740372
milestone14.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 740372 - Handle MOZ_GFX_OPTIMIZE_MOBILE in gfxASurface and gfx2DGlue format conversion functions. r=jrmuizel
gfx/thebes/gfx2DGlue.h
gfx/thebes/gfxASurface.cpp
--- a/gfx/thebes/gfx2DGlue.h
+++ b/gfx/thebes/gfx2DGlue.h
@@ -170,31 +170,36 @@ inline gfxMatrix ThebesMatrix(const Matr
 {
   return gfxMatrix(aMatrix._11, aMatrix._12, aMatrix._21,
                    aMatrix._22, aMatrix._31, aMatrix._32);
 }
 
 inline gfxASurface::gfxContentType ContentForFormat(const SurfaceFormat &aFormat)
 {
   switch (aFormat) {
+  case FORMAT_R5G6B5:
   case FORMAT_B8G8R8X8:
     return gfxASurface::CONTENT_COLOR;
   case FORMAT_A8:
     return gfxASurface::CONTENT_ALPHA;
   case FORMAT_B8G8R8A8:
   default:
     return gfxASurface::CONTENT_COLOR_ALPHA;
   }
 }
 
 inline SurfaceFormat FormatForContent(gfxASurface::gfxContentType aContent)
 {
   switch (aContent) {
   case gfxASurface::CONTENT_COLOR:
+#ifdef MOZ_GFX_OPTIMIZE_MOBILE
+    return FORMAT_R5G6B5;
+#else
     return FORMAT_B8G8R8X8;
+#endif
   case gfxASurface::CONTENT_ALPHA:
     return FORMAT_A8;
   default:
     return FORMAT_B8G8R8A8;
   }
 }
 
 inline CompositionOp CompositionOpForOp(gfxContext::GraphicsOperator aOp)
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -455,17 +455,21 @@ gfxASurface::FormatFromContent(gfxASurfa
 {
     switch (type) {
         case CONTENT_COLOR_ALPHA:
             return ImageFormatARGB32;
         case CONTENT_ALPHA:
             return ImageFormatA8;
         case CONTENT_COLOR:
         default:
+#ifdef MOZ_GFX_OPTIMIZE_MOBILE
+            return ImageFormatRGB16_565;
+#else
             return ImageFormatRGB24;
+#endif
     }
 }
 
 void
 gfxASurface::SetSubpixelAntialiasingEnabled(bool aEnabled)
 {
 #ifdef MOZ_TREE_CAIRO
     if (!mSurfaceValid)