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

Unified Diff: ui/gl/gl_surface_format.h

Issue 2616723002: Refactor GL surface format handling (Closed)
Patch Set: Fix copyright notice on new files 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
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | ui/gl/gl_surface_format.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cb7d51d7baaa0db43b655cdb1f0c909031a90257
--- /dev/null
+++ b/ui/gl/gl_surface_format.h
@@ -0,0 +1,73 @@
+// Copyright 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_
+
+#include "ui/gl/gl_export.h"
+
+namespace gl {
+
+class GL_EXPORT GLSurfaceFormat {
+ public:
+
+ // For use with constructor.
+ enum SurfacePixelLayout {
+ PIXEL_LAYOUT_DONT_CARE = -1,
+ PIXEL_LAYOUT_BGRA,
+ PIXEL_LAYOUT_RGBA,
+ };
+
+ GLSurfaceFormat();
+
+ ~GLSurfaceFormat();
+
+ GLSurfaceFormat(SurfacePixelLayout layout);
+
+ GLSurfaceFormat(const GLSurfaceFormat& other);
+
+ bool IsDefault();
+
+ void SetIsSurfaceless();
+ bool IsSurfaceless();
+
+ bool IsCompatible(GLSurfaceFormat other_format);
+
+ // Default pixel format is RGBA8888. Use this method to select
+ // a preference of RGB565. TODO(klausw): use individual setter
+ // methods if there's a use case for them.
+ void SetRGB565();
+
+ // Other properties for future use.
+ void SetDepthBits(int depth_bits);
+ int GetDepthBits();
+
+ void SetStencilBits(int stencil_bits);
+ int GetStencilBits();
+
+ void SetSamples(int samples);
+ int GetSamples();
+
+ void SetDefaultPixelLayout(SurfacePixelLayout layout);
+
+ SurfacePixelLayout GetPixelLayout();
+
+ int GetBufferSize();
+
+ private:
+ bool is_default_ = true;
+ SurfacePixelLayout pixel_layout_ = PIXEL_LAYOUT_DONT_CARE;
+ 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;
+};
+
+} // namespace gl
+
+#endif // UI_GL_GL_SURFACE_FORMAT_H_
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | ui/gl/gl_surface_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698