Index: ui/gl/gl_surface_format.h |
diff --git a/ui/gl/gl_surface_format.h b/ui/gl/gl_surface_format.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..be20e2a0586d55b2b35200c0dea22c3c9a73104b |
--- /dev/null |
+++ b/ui/gl/gl_surface_format.h |
@@ -0,0 +1,61 @@ |
+// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_GL_GL_SURFACE_FORMAT_H_ |
+#define UI_GL_GL_SURFACE_FORMAT_H_ |
+ |
+namespace gl { |
+ |
+class GLSurfaceFormat { |
+ public: |
+ |
+ // Minimum bit depth and format of surface. |
+ enum SurfaceFormat { |
+ SURFACE_ARGB8888, |
+ SURFACE_RGB565, |
+ SURFACE_OSMESA_BGRA, |
+ SURFACE_OSMESA_RGBA, |
+ SURFACE_SURFACELESS, |
+ }; |
+ |
+ enum SurfacePixelLayout { |
+ SURFACE_PIXEL_LAYOUT_DONT_CARE = -1, |
+ SURFACE_PIXEL_LAYOUT_BGRA, |
+ SURFACE_PIXEL_LAYOUT_RGBA, |
+ }; |
+ |
+ GLSurfaceFormat(); |
+ |
+ GLSurfaceFormat(SurfaceFormat format); |
+ |
+ bool IsDefault(); |
+ |
+ bool IsSurfaceless(); |
+ |
+ bool IsCompatible(GLSurfaceFormat other_format); |
+ |
+ void SetDepthBits(int depth_bits); |
+ void SetStencilBits(int stencil_bits); |
+ void SetSamples(int samples); |
+ |
+ SurfacePixelLayout GetPixelLayout(); |
+ |
+ int GetBufferSize(); |
+ |
+ private: |
+ bool is_default = true; |
+ bool is_surfaceless = false; |
+ int red_bits = -1; |
+ int green_bits = -1; |
+ int blue_bits = -1; |
+ int alpha_bits = -1; |
+ int depth_bits = -1; |
+ int samples = -1; |
+ int stencil_bits = -1; |
+ SurfacePixelLayout pixel_layout = SURFACE_PIXEL_LAYOUT_DONT_CARE; |
+}; |
+ |
+} // namespace gl |
+ |
+#endif // UI_GL_GL_SURFACE_FORMAT_H_ |