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

Unified Diff: ui/gl/gl_surface_format.h

Issue 2616723002: Refactor GL surface format handling (Closed)
Patch Set: Created 3 years, 11 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_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_

Powered by Google App Engine
This is Rietveld 408576698