Bug 736005 - Put GL config fallback back on Android, r=cjones

This commit is contained in:
Michael Wu 2012-03-29 19:47:22 -07:00
Родитель a7acd7cca1
Коммит 6e1f0507f8
1 изменённых файлов: 29 добавлений и 12 удалений

Просмотреть файл

@ -1444,20 +1444,9 @@ static const EGLint kEGLConfigAttribsRGBA32[] = {
LOCAL_EGL_NONE
};
// Return true if a suitable EGLConfig was found and pass it out
// through aConfig. Return false otherwise.
//
// NB: It's entirely legal for the returned EGLConfig to be valid yet
// have the value null.
static bool
CreateConfig(EGLConfig* aConfig)
CreateConfig(EGLConfig* aConfig, PRInt32 depth)
{
nsCOMPtr<nsIScreenManager> screenMgr = do_GetService("@mozilla.org/gfx/screenmanager;1");
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
PRInt32 depth = 24;
screen->GetColorDepth(&depth);
EGLConfig configs[64];
gfxASurface::gfxImageFormat format;
const EGLint* attribs = depth == 16 ? kEGLConfigAttribsRGB16 :
@ -1492,6 +1481,34 @@ CreateConfig(EGLConfig* aConfig)
return false;
}
// Return true if a suitable EGLConfig was found and pass it out
// through aConfig. Return false otherwise.
//
// NB: It's entirely legal for the returned EGLConfig to be valid yet
// have the value null.
static bool
CreateConfig(EGLConfig* aConfig)
{
nsCOMPtr<nsIScreenManager> screenMgr = do_GetService("@mozilla.org/gfx/screenmanager;1");
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
PRInt32 depth = 24;
screen->GetColorDepth(&depth);
if (!CreateConfig(aConfig, depth)) {
#ifdef MOZ_WIDGET_ANDROID
// Bug 736005
// Android doesn't always support 16 bit so also try 24 bit
if (depth == 16) {
return CreateConfig(aConfig, 24);
}
#endif
return false;
} else {
return true;
}
}
static EGLSurface
CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config)
{