| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GL_GL_SURFACE_FORMAT_H_ | 5 #ifndef UI_GL_GL_SURFACE_FORMAT_H_ |
| 6 #define UI_GL_GL_SURFACE_FORMAT_H_ | 6 #define UI_GL_GL_SURFACE_FORMAT_H_ |
| 7 | 7 |
| 8 #include "ui/gl/gl_export.h" | 8 #include "ui/gl/gl_export.h" |
| 9 | 9 |
| 10 namespace gl { | 10 namespace gl { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 GLSurfaceFormat(); | 28 GLSurfaceFormat(); |
| 29 | 29 |
| 30 // Use a specified pixel layout, cf. gl_surface_osmesa. | 30 // Use a specified pixel layout, cf. gl_surface_osmesa. |
| 31 GLSurfaceFormat(SurfacePixelLayout layout); | 31 GLSurfaceFormat(SurfacePixelLayout layout); |
| 32 | 32 |
| 33 // Copy constructor from pre-existing format. | 33 // Copy constructor from pre-existing format. |
| 34 GLSurfaceFormat(const GLSurfaceFormat& other); | 34 GLSurfaceFormat(const GLSurfaceFormat& other); |
| 35 | 35 |
| 36 ~GLSurfaceFormat(); | 36 ~GLSurfaceFormat(); |
| 37 | 37 |
| 38 // Helper method to determine if the format is unchanged from the | |
| 39 // default at creation time. TODO(klausw): can this be removed? | |
| 40 bool IsDefault(); | |
| 41 | |
| 42 // Surfaceless appears as a format property for backwards | |
| 43 // compatibility with the previous enum-based implementation. | |
| 44 // TODO(klausw): consider removing it and/or merging it into the | |
| 45 // pre-existing IsSurfaceless() predicate for the various Surface | |
| 46 // subclasses? | |
| 47 void SetIsSurfaceless(); | |
| 48 bool IsSurfaceless(); | |
| 49 | |
| 50 // A given pair of surfaces is considered compatible if glSetSurface | 38 // A given pair of surfaces is considered compatible if glSetSurface |
| 51 // can be used to switch between them without generating BAD_MATCH | 39 // can be used to switch between them without generating BAD_MATCH |
| 52 // errors, visual errors, or gross inefficiency, and incompatible | 40 // errors, visual errors, or gross inefficiency, and incompatible |
| 53 // otherwise. For example, a pixel layout mismatch would be | 41 // otherwise. For example, a pixel layout mismatch would be |
| 54 // considered incompatible. This comparison only makes sense within | 42 // considered incompatible. This comparison only makes sense within |
| 55 // the context of a single gl_surface subtype. | 43 // the context of a single gl_surface subtype. |
| 56 bool IsCompatible(GLSurfaceFormat other_format); | 44 bool IsCompatible(GLSurfaceFormat other_format); |
| 57 | 45 |
| 58 // Default pixel format is RGBA8888. Use this method to select | 46 // Default pixel format is RGBA8888. Use this method to select |
| 59 // a preference of RGB565. TODO(klausw): use individual setter | 47 // a preference of RGB565. TODO(klausw): use individual setter |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 void SetDefaultPixelLayout(SurfacePixelLayout layout); | 61 void SetDefaultPixelLayout(SurfacePixelLayout layout); |
| 74 | 62 |
| 75 SurfacePixelLayout GetPixelLayout(); | 63 SurfacePixelLayout GetPixelLayout(); |
| 76 | 64 |
| 77 // Compute number of bits needed for storing one pixel, not | 65 // Compute number of bits needed for storing one pixel, not |
| 78 // including any padding. At this point mainly used to distinguish | 66 // including any padding. At this point mainly used to distinguish |
| 79 // RGB565 (16) from RGBA8888 (32). | 67 // RGB565 (16) from RGBA8888 (32). |
| 80 int GetBufferSize(); | 68 int GetBufferSize(); |
| 81 | 69 |
| 82 private: | 70 private: |
| 83 bool is_default_ = true; | |
| 84 SurfacePixelLayout pixel_layout_ = PIXEL_LAYOUT_DONT_CARE; | 71 SurfacePixelLayout pixel_layout_ = PIXEL_LAYOUT_DONT_CARE; |
| 85 bool is_surfaceless_ = false; | |
| 86 int red_bits_ = -1; | 72 int red_bits_ = -1; |
| 87 int green_bits_ = -1; | 73 int green_bits_ = -1; |
| 88 int blue_bits_ = -1; | 74 int blue_bits_ = -1; |
| 89 int alpha_bits_ = -1; | 75 int alpha_bits_ = -1; |
| 90 int depth_bits_ = -1; | 76 int depth_bits_ = -1; |
| 91 int samples_ = -1; | 77 int samples_ = -1; |
| 92 int stencil_bits_ = -1; | 78 int stencil_bits_ = -1; |
| 93 }; | 79 }; |
| 94 | 80 |
| 95 } // namespace gl | 81 } // namespace gl |
| 96 | 82 |
| 97 #endif // UI_GL_GL_SURFACE_FORMAT_H_ | 83 #endif // UI_GL_GL_SURFACE_FORMAT_H_ |
| OLD | NEW |