OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GL_GL_SURFACE_FORMAT_H_ |
| 6 #define UI_GL_GL_SURFACE_FORMAT_H_ |
| 7 |
| 8 #include "ui/gl/gl_export.h" |
| 9 |
| 10 namespace gl { |
| 11 |
| 12 class GL_EXPORT GLSurfaceFormat { |
| 13 public: |
| 14 |
| 15 // For use with constructor. |
| 16 enum SurfacePixelLayout { |
| 17 PIXEL_LAYOUT_DONT_CARE = -1, |
| 18 PIXEL_LAYOUT_BGRA, |
| 19 PIXEL_LAYOUT_RGBA, |
| 20 }; |
| 21 |
| 22 GLSurfaceFormat(); |
| 23 |
| 24 ~GLSurfaceFormat(); |
| 25 |
| 26 GLSurfaceFormat(SurfacePixelLayout layout); |
| 27 |
| 28 GLSurfaceFormat(const GLSurfaceFormat& other); |
| 29 |
| 30 bool IsDefault(); |
| 31 |
| 32 void SetIsSurfaceless(); |
| 33 bool IsSurfaceless(); |
| 34 |
| 35 bool IsCompatible(GLSurfaceFormat other_format); |
| 36 |
| 37 // Default pixel format is RGBA8888. Use this method to select |
| 38 // a preference of RGB565. TODO(klausw): use individual setter |
| 39 // methods if there's a use case for them. |
| 40 void SetRGB565(); |
| 41 |
| 42 // Other properties for future use. |
| 43 void SetDepthBits(int depth_bits); |
| 44 int GetDepthBits(); |
| 45 |
| 46 void SetStencilBits(int stencil_bits); |
| 47 int GetStencilBits(); |
| 48 |
| 49 void SetSamples(int samples); |
| 50 int GetSamples(); |
| 51 |
| 52 void SetDefaultPixelLayout(SurfacePixelLayout layout); |
| 53 |
| 54 SurfacePixelLayout GetPixelLayout(); |
| 55 |
| 56 int GetBufferSize(); |
| 57 |
| 58 private: |
| 59 bool is_default_ = true; |
| 60 SurfacePixelLayout pixel_layout_ = PIXEL_LAYOUT_DONT_CARE; |
| 61 bool is_surfaceless_ = false; |
| 62 int red_bits_ = -1; |
| 63 int green_bits_ = -1; |
| 64 int blue_bits_ = -1; |
| 65 int alpha_bits_ = -1; |
| 66 int depth_bits_ = -1; |
| 67 int samples_ = -1; |
| 68 int stencil_bits_ = -1; |
| 69 }; |
| 70 |
| 71 } // namespace gl |
| 72 |
| 73 #endif // UI_GL_GL_SURFACE_FORMAT_H_ |
OLD | NEW |