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

Unified Diff: content/common/gpu/client/gl_helper_readback_support.h

Issue 412453002: GLHelper: Address inconsistent mapping of SkColorType to GL format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
Index: content/common/gpu/client/gl_helper_readback_support.h
diff --git a/content/common/gpu/client/gl_helper_readback_support.h b/content/common/gpu/client/gl_helper_readback_support.h
index 266711c26b6046871252efd59c82749965b98bfe..773b5ce2958eabedef027015d11005bf6ff64016 100644
--- a/content/common/gpu/client/gl_helper_readback_support.h
+++ b/content/common/gpu/client/gl_helper_readback_support.h
@@ -11,26 +11,36 @@
namespace content {
+enum FormatSupport { kReadbackSupported,
piman 2014/07/22 19:57:55 nit: leave the enum in GLHelperReadbackSupport for
robert.bradford 2014/07/23 16:58:45 Enum moved in, and moved to MACRO_STYLE.
+ kReadbackSwizzle,
+ kReadbackNotSupported};
+
class CONTENT_EXPORT GLHelperReadbackSupport {
public:
GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl);
~GLHelperReadbackSupport();
- // Checks whether the readback (Color read format and type) is supported
- // for the requested texture format by the hardware or not.
- // For ex: some hardwares have rgb565 readback
- // support when binded with the frame buffer for others it may fail.
- // Here we pass the internal textureformat as skia config.
- bool IsReadbackConfigSupported(SkColorType texture_format);
+ // For a given color type retrieve whether readback is supported and if so
+ // how it should be performed. The |format|, |type| and |bytes_per_pixel| are
+ // the values that should be used with glReadPixels to facilitate the
+ // readback. If |can_swizzle| is true then this method will return
+ // kReadbackSwizzle if the data needs to be swizzled before using the
+ // returned |format| otherwise the method will return kReadbackSupported to
+ // indicate that readback is permitted of this color othewise
+ // kReadbackNotSupported will be returned. This method always overwrites the
+ // out values irrespective of the return value
piman 2014/07/22 19:57:55 nit: end comment with a period.
robert.bradford 2014/07/23 16:58:45 Done.
+ FormatSupport ReadbackConfig(SkColorType color_type,
+ const bool& can_swizzle,
piman 2014/07/22 19:57:55 nit: bool instead of const bool &.
robert.bradford 2014/07/23 16:58:45 Done.
+ GLint& format,
piman 2014/07/22 19:57:56 non-const references are forbidden by style guide.
robert.bradford 2014/07/23 16:58:45 Done.
+ GLint& type,
piman 2014/07/22 19:57:56 GLenum
robert.bradford 2014/07/23 16:58:45 Done.
+ int32& bytes_per_pixel);
piman 2014/07/22 19:57:55 size_t
robert.bradford 2014/07/23 16:58:45 Done.
// Provides the additional readback format/type pairing for a render target
// of a given format/type pairing
void GetAdditionalFormat(GLint format, GLint type, GLint *format_out,
GLint *type_out);
private:
- enum FormatSupport { FORMAT_NOT_SUPPORTED = 0, FORMAT_SUPPORTED, };
-
struct FormatCacheEntry {
GLint format;
GLint type;

Powered by Google App Engine
This is Rietveld 408576698