Bug 803299 - Enable 32-bit colour on Android. r=kats

This commit is contained in:
Chris Lord
2013-05-28 18:50:16 +01:00
parent a9515b4c58
commit b43c75dc8a
9 changed files with 122 additions and 17 deletions

View File

@@ -38,6 +38,7 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ImageFormat;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
@@ -135,6 +136,7 @@ public class GeckoAppShell
static private final boolean LOGGING = false;
static private int sDensityDpi = 0;
static private int sScreenDepth = 0;
private static final EventDispatcher sEventDispatcher = new EventDispatcher();
@@ -1379,6 +1381,27 @@ public class GeckoAppShell
return sDensityDpi;
}
/**
* Returns the colour depth of the default screen. This will either be
* 24 or 16.
*/
public static int getScreenDepth() {
if (sScreenDepth == 0 && getGeckoInterface() != null) {
switch (getGeckoInterface().getActivity().getWindowManager().getDefaultDisplay().getPixelFormat()) {
case PixelFormat.RGBA_8888 :
case PixelFormat.RGBX_8888 :
case PixelFormat.RGB_888 :
sScreenDepth = 24;
break;
default:
sScreenDepth = 16;
break;
}
}
return sScreenDepth;
}
public static void setFullScreen(boolean fullscreen) {
if (getGeckoInterface() != null)
getGeckoInterface().setFullScreen(fullscreen);