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

Unified Diff: ui/gl/gl_surface_format.h

Issue 2702403009: Make surface GetFormat pure virtual, add missing overrides. (Closed)
Patch Set: Fix class name for Windows Created 3 years, 10 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.cc ('k') | ui/gl/gl_surface_glx.h » ('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
index cb7d51d7baaa0db43b655cdb1f0c909031a90257..2fcf504f887b516cf9cb92054a8026910ac9a69d 100644
--- a/ui/gl/gl_surface_format.h
+++ b/ui/gl/gl_surface_format.h
@@ -9,6 +9,10 @@
namespace gl {
+// Expresses surface format properties that may vary depending
+// on the underlying gl_surface implementation or specific usage
+// scenarios. Intended usage is to support copying formats and
+// checking compatibility.
class GL_EXPORT GLSurfaceFormat {
public:
@@ -19,19 +23,36 @@ class GL_EXPORT GLSurfaceFormat {
PIXEL_LAYOUT_RGBA,
};
+ // Default surface format for the underlying gl_surface subtype.
+ // Use the setters below to change attributes if needed.
GLSurfaceFormat();
+ // Use a specified pixel layout, cf. gl_surface_osmesa.
+ GLSurfaceFormat(SurfacePixelLayout layout);
+
+ // Copy constructor from pre-existing format.
+ GLSurfaceFormat(const GLSurfaceFormat& other);
+
~GLSurfaceFormat();
- GLSurfaceFormat(SurfacePixelLayout layout);
-
- GLSurfaceFormat(const GLSurfaceFormat& other);
-
+ // Helper method to determine if the format is unchanged from the
+ // default at creation time. TODO(klausw): can this be removed?
bool IsDefault();
+ // Surfaceless appears as a format property for backwards
+ // compatibility with the previous enum-based implementation.
+ // TODO(klausw): consider removing it and/or merging it into the
+ // pre-existing IsSurfaceless() predicate for the various Surface
+ // subclasses?
void SetIsSurfaceless();
bool IsSurfaceless();
+ // A given pair of surfaces is considered compatible if glSetSurface
+ // can be used to switch between them without generating BAD_MATCH
+ // errors, visual errors, or gross inefficiency, and incompatible
+ // otherwise. For example, a pixel layout mismatch would be
+ // considered incompatible. This comparison only makes sense within
+ // the context of a single gl_surface subtype.
bool IsCompatible(GLSurfaceFormat other_format);
// Default pixel format is RGBA8888. Use this method to select
@@ -53,6 +74,9 @@ class GL_EXPORT GLSurfaceFormat {
SurfacePixelLayout GetPixelLayout();
+ // Compute number of bits needed for storing one pixel, not
+ // including any padding. At this point mainly used to distinguish
+ // RGB565 (16) from RGBA8888 (32).
int GetBufferSize();
private:
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698