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

Unified Diff: components/display_compositor/gl_helper_readback_support.cc

Issue 807853003: Use GLHelper support to validate format before processing texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | content/browser/compositor/surface_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/display_compositor/gl_helper_readback_support.cc
diff --git a/components/display_compositor/gl_helper_readback_support.cc b/components/display_compositor/gl_helper_readback_support.cc
index b7a019beef4798ce2c6d35c22a4a891ca242f7db..5bb1bdafd4987f4910092a8a3228234daef3d4ae 100644
--- a/components/display_compositor/gl_helper_readback_support.cc
+++ b/components/display_compositor/gl_helper_readback_support.cc
@@ -25,8 +25,7 @@ void GLHelperReadbackSupport::InitializeReadbackSupport() {
for (int i = 0; i <= kLastEnum_SkColorType; ++i) {
format_support_table_[i] = GLHelperReadbackSupport::NOT_SUPPORTED;
}
- // TODO(sikugu): kAlpha_8_SkColorType support check is failing on mesa.
- // See crbug.com/415667.
+ CheckForReadbackSupport(kAlpha_8_SkColorType);
CheckForReadbackSupport(kRGB_565_SkColorType);
CheckForReadbackSupport(kARGB_4444_SkColorType);
CheckForReadbackSupport(kRGBA_8888_SkColorType);
@@ -38,6 +37,9 @@ void GLHelperReadbackSupport::CheckForReadbackSupport(
SkColorType texture_format) {
bool supports_format = false;
switch (texture_format) {
+ case kAlpha_8_SkColorType:
+ supports_format = SupportsFormat(GL_ALPHA, GL_UNSIGNED_BYTE);
+ break;
case kRGB_565_SkColorType:
supports_format = SupportsFormat(GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
break;
@@ -124,6 +126,16 @@ GLHelperReadbackSupport::GetReadbackConfig(SkColorType color_type,
*type = GL_UNSIGNED_BYTE;
GLenum new_format = 0, new_type = 0;
switch (color_type) {
+ case kAlpha_8_SkColorType:
+ if (format_support_table_[color_type] ==
+ GLHelperReadbackSupport::SUPPORTED) {
+ *format = GL_ALPHA;
+ *type = GL_UNSIGNED_BYTE;
+ *bytes_per_pixel = 1;
+ return GLHelperReadbackSupport::SUPPORTED;
+ }
+
+ break;
case kRGB_565_SkColorType:
if (format_support_table_[color_type] ==
GLHelperReadbackSupport::SUPPORTED) {
« no previous file with comments | « no previous file | content/browser/compositor/surface_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698