Chromium Code Reviews| 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..5a11fa9e62420697453b23bcbaadd75b207dfa00 |
| --- /dev/null |
| +++ b/ui/gl/gl_surface_format.h |
| @@ -0,0 +1,73 @@ |
| +// 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_ |
| + |
| +#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; |
|
jbauman
2017/01/06 02:51:30
is_default_, pixel_layout_, is_surfaceless_, etc.
klausw
2017/01/06 03:44:40
Oops, done.
|
| + 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_ |