Bug 831438. Add pref for forcing 16bit on B2G. r=cjones
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 17 Jan 2013 11:52:41 -0500
changeset 119157 e7c8f4228da4118aec41a3ee578851e3c6a7faa7
parent 119156 e3497f146c7cbd2cb4ccd40ad0d85f0b3cedbfb4
child 119158 339344803492ecccb09a42c28b79bcfcbcbae333
push id24195
push userMs2ger@gmail.com
push dateSat, 19 Jan 2013 16:10:11 +0000
treeherdermozilla-central@02e12a80aef9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs831438
milestone21.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 831438. Add pref for forcing 16bit on B2G. r=cjones B2G currently tries to detect the depth of the screen and uses that as the offscreen format. This lets us override that for testing the 16bit path on 24bit devices.
gfx/thebes/gfxAndroidPlatform.cpp
--- a/gfx/thebes/gfxAndroidPlatform.cpp
+++ b/gfx/thebes/gfxAndroidPlatform.cpp
@@ -2,16 +2,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "base/basictypes.h"
 
 #include "gfxAndroidPlatform.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/Preferences.h"
 
 #include "gfxFT2FontList.h"
 #include "gfxImageSurface.h"
 #include "mozilla/dom/ContentChild.h"
 #include "nsXULAppAPI.h"
 #include "nsIScreen.h"
 #include "nsIScreenManager.h"
 
@@ -97,16 +98,21 @@ gfxAndroidPlatform::gfxAndroidPlatform()
     nsCOMPtr<nsIScreen> screen;
     screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
     mScreenDepth = 24;
     screen->GetColorDepth(&mScreenDepth);
 
     mOffscreenFormat = mScreenDepth == 16
                        ? gfxASurface::ImageFormatRGB16_565
                        : gfxASurface::ImageFormatRGB24;
+
+    if (Preferences::GetBool("gfx.android.rgb16.force", false)) {
+        mOffscreenFormat = gfxASurface::ImageFormatRGB16_565;
+    }
+
 }
 
 gfxAndroidPlatform::~gfxAndroidPlatform()
 {
     cairo_debug_reset_static_data();
 
     FT_Done_Library(gPlatformFTLibrary);
     gPlatformFTLibrary = NULL;