Bug 894087 - Fix 24-bit color detection. r=Cwiiis
authorBrian Nicholson <bnicholson@mozilla.com>
Thu, 18 Jul 2013 12:09:01 -0700
changeset 139156 ecc75387637acab4120f6f062a9c900dd1abad82
parent 139155 7b3d37195619800e49ec8effedb383808e99fb6a
child 139157 d4ce733487fc25cbda31b9f432519a6607b61bb0
push id1890
push userryanvm@gmail.com
push dateFri, 19 Jul 2013 17:44:21 +0000
treeherderfx-team@20848adc9980 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs894087
milestone25.0a1
Bug 894087 - Fix 24-bit color detection. r=Cwiiis
mobile/android/base/GeckoAppShell.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -1366,28 +1366,20 @@ public class GeckoAppShell
 
     /**
      * Returns the colour depth of the default screen. This will either be
      * 24 or 16.
      */
     public static synchronized int getScreenDepth() {
         if (sScreenDepth == 0) {
             sScreenDepth = 16;
-            if (getGeckoInterface() != null) {
-                switch (getGeckoInterface().getActivity().getWindowManager().getDefaultDisplay().getPixelFormat()) {
-                    case PixelFormat.RGBA_8888 :
-                    case PixelFormat.RGBX_8888 :
-                    case PixelFormat.RGB_888 :
-                    {
-                        if (isHighMemoryDevice()) {
-                            sScreenDepth = 24;
-                        }
-                        break;
-                    }
-                }
+            PixelFormat info = new PixelFormat();
+            PixelFormat.getPixelFormatInfo(getGeckoInterface().getActivity().getWindowManager().getDefaultDisplay().getPixelFormat(), info);
+            if (info.bitsPerPixel >= 24 && isHighMemoryDevice()) {
+                sScreenDepth = 24;
             }
         }
 
         return sScreenDepth;
     }
 
     public static synchronized void setScreenDepthOverride(int aScreenDepth) {
         if (sScreenDepth != 0) {