Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 8c29342ab408e2f0e10fb0ff370807d449c5646c..67e2a15629559e03aa50250bdedb237e592bad94 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -9,6 +9,7 @@
#include "ui/gl/gl_surface_egl.h"
#if defined(OS_ANDROID)
+#include "base/android/sys_utils.h"
#include <android/native_window_jni.h>
#endif
@@ -125,6 +126,11 @@ bool GLSurfaceEGL::InitializeOneOff() {
return false;
}
+ bool use_16bit_surface = false;
+#if defined(OS_ANDROID)
+ use_16bit_surface = base::android::SysUtils::IsLowEndDevice();
+#endif
+
// Choose an EGL configuration.
// On X this is only used for PBuffer surfaces.
static const EGLint kConfigAttribs[] = {
@@ -138,9 +144,16 @@ bool GLSurfaceEGL::InitializeOneOff() {
EGL_NONE
};
+ static const EGLint kConfigAttribs16bit[] = {
+ EGL_BUFFER_SIZE, 16,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
+ EGL_NONE
+ };
+
EGLint num_configs;
if (!eglChooseConfig(g_display,
- kConfigAttribs,
+ use_16bit_surface ? kConfigAttribs16bit : kConfigAttribs,
NULL,
0,
&num_configs)) {
@@ -155,7 +168,7 @@ bool GLSurfaceEGL::InitializeOneOff() {
}
if (!eglChooseConfig(g_display,
- kConfigAttribs,
+ use_16bit_surface ? kConfigAttribs16bit : kConfigAttribs,
&g_config,
1,
&num_configs)) {
@@ -164,6 +177,17 @@ bool GLSurfaceEGL::InitializeOneOff() {
return false;
}
+ if (use_16bit_surface) {
+ EGLint red_size, green_size, blue_size;
+ eglGetConfigAttrib(g_display, g_config, EGL_RED_SIZE, &red_size);
+ eglGetConfigAttrib(g_display, g_config, EGL_GREEN_SIZE, &green_size);
+ eglGetConfigAttrib(g_display, g_config, EGL_BLUE_SIZE, &blue_size);
+
+ DCHECK_EQ(5, red_size);
Sami 2013/08/08 10:11:01 The implementation might not support RGB565 so che
+ DCHECK_EQ(6, green_size);
+ DCHECK_EQ(5, blue_size);
+ }
+
g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS);
g_egl_create_context_robustness_supported =
HasEGLExtension("EGL_EXT_create_context_robustness");

Powered by Google App Engine
This is Rietveld 408576698