Index: ui/gl/gl_surface.h |
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h |
index 3b08ebc8d57ce5057fd9af29844c6e9df56ab0cd..68bef153d5d557d1d00ccc778ef5f2e2c87d63f9 100644 |
--- a/ui/gl/gl_surface.h |
+++ b/ui/gl/gl_surface.h |
@@ -10,6 +10,7 @@ |
#include "base/callback.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
+#include "base/sys_info.h" |
#include "build/build_config.h" |
#include "ui/gfx/geometry/rect.h" |
#include "ui/gfx/geometry/rect_f.h" |
@@ -38,8 +39,8 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
// Minimum bit depth of surface. |
enum Format { |
- SURFACE_ARGB8888 = 1, // 32 bits |
- SURFACE_RGB565 = 2, // 16 bits |
+ SURFACE_ARGB8888, |
+ SURFACE_RGB565, |
SURFACE_DEFAULT = SURFACE_ARGB8888 |
}; |
@@ -152,7 +153,7 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
virtual void* GetConfig(); |
// Get the GL pixel format of the surface, if available. |
- virtual unsigned GetFormat(); |
+ virtual GLSurface::Format GetFormat(); |
// Get access to a helper providing time of recent refresh and period |
// of screen refresh. If unavailable, returns NULL. |
@@ -209,10 +210,14 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
gfx::AcceleratedWidget window); |
#endif // defined(USE_OZONE) |
+ static Format GetDefaultFormat() { |
+ return base::SysInfo::IsLowEndDevice() ? SURFACE_RGB565 : SURFACE_ARGB8888; |
no sievers
2016/02/17 23:38:01
Can you make this logic/format override specific t
Jinsuk Kim
2016/02/18 02:57:24
Done.
|
+ } |
+ |
// Create a GL surface used for offscreen rendering. |
static scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
const gfx::Size& size) { |
- return CreateOffscreenGLSurface(size, SURFACE_DEFAULT); |
+ return CreateOffscreenGLSurface(size, GetDefaultFormat()); |
} |
static scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
@@ -234,6 +239,8 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
static bool ExtensionsContain(const char* extensions, const char* name); |
+ GLSurface::Format format_; |
+ |
private: |
friend class base::RefCounted<GLSurface>; |
friend class GLContext; |
@@ -279,7 +286,7 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface { |
void* GetShareHandle() override; |
void* GetDisplay() override; |
void* GetConfig() override; |
- unsigned GetFormat() override; |
+ GLSurface::Format GetFormat() override; |
VSyncProvider* GetVSyncProvider() override; |
bool ScheduleOverlayPlane(int z_order, |
OverlayTransform transform, |