From f2bf030c8ba7c0ee183fbbf60b7506d40b3785d0 Mon Sep 17 00:00:00 2001 From: George Wright Date: Fri, 30 Mar 2012 11:56:08 -0400 Subject: [PATCH] Bug 740372 - Handle MOZ_GFX_OPTIMIZE_MOBILE in gfxASurface and gfx2DGlue format conversion functions. r=jrmuizel --- gfx/thebes/gfx2DGlue.h | 5 +++++ gfx/thebes/gfxASurface.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/gfx/thebes/gfx2DGlue.h b/gfx/thebes/gfx2DGlue.h index 280c5561ca3..5cbd66d1207 100644 --- a/gfx/thebes/gfx2DGlue.h +++ b/gfx/thebes/gfx2DGlue.h @@ -175,6 +175,7 @@ inline gfxMatrix ThebesMatrix(const Matrix &aMatrix) inline gfxASurface::gfxContentType ContentForFormat(const SurfaceFormat &aFormat) { switch (aFormat) { + case FORMAT_R5G6B5: case FORMAT_B8G8R8X8: return gfxASurface::CONTENT_COLOR; case FORMAT_A8: @@ -189,7 +190,11 @@ 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: diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index fd54b41169b..fb8356a4ea8 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -460,7 +460,11 @@ gfxASurface::FormatFromContent(gfxASurface::gfxContentType type) return ImageFormatA8; case CONTENT_COLOR: default: +#ifdef MOZ_GFX_OPTIMIZE_MOBILE + return ImageFormatRGB16_565; +#else return ImageFormatRGB24; +#endif } }