summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
authorradu.velea <radu.velea@intel.com>2016-03-07 02:32:35 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-07 10:33:33 +0000
commit8abebfdd564ba378cb0516d56d7fd5298beda2df (patch)
treec4c1755c601377ae5ae981b31478f2a122c8961a /cc/resources
parent908f01e663ef0073b3ef667258432e78add83a7b (diff)
downloadchromium_src-8abebfdd564ba378cb0516d56d7fd5298beda2df.zip
chromium_src-8abebfdd564ba378cb0516d56d7fd5298beda2df.tar.gz
chromium_src-8abebfdd564ba378cb0516d56d7fd5298beda2df.tar.bz2
cc: Fix interchange of red and blue content when using ETC1_RGB8_OES textures
Content is swizzled when texture format has different component order than expected format by platform. ETC1 implies the use RGBX layout and should not trigger a swizzle. Updated unittest. TEST=visual inspection with --enable-tile-compression and PlatformColorTest.SameComponentOrder in cc_unittests BUG=570715 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1746763002 Cr-Commit-Position: refs/heads/master@{#379533}
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/platform_color.h24
-rw-r--r--cc/resources/platform_color_unittest.cc8
2 files changed, 19 insertions, 13 deletions
diff --git a/cc/resources/platform_color.h b/cc/resources/platform_color.h
index 26d6b02..67ede54 100644
--- a/cc/resources/platform_color.h
+++ b/cc/resources/platform_color.h
@@ -47,15 +47,25 @@ class PlatformColor {
return RGBA_8888;
}
- // Return true if the given texture format has the same component order
- // as the color on this platform.
+ // Return true if the given 32bpp resource format has the same component order
+ // as the platform color data format.
static bool SameComponentOrder(ResourceFormat format) {
- switch (Format()) {
- case SOURCE_FORMAT_RGBA8:
- return format == RGBA_8888 || format == RGBA_4444;
- case SOURCE_FORMAT_BGRA8:
- return format == BGRA_8888 || format == RGBA_4444;
+ switch (format) {
+ case RGBA_8888:
+ return Format() == SOURCE_FORMAT_RGBA8;
+ case BGRA_8888:
+ return Format() == SOURCE_FORMAT_BGRA8;
+ case ALPHA_8:
+ case LUMINANCE_8:
+ case RGB_565:
+ case RGBA_4444:
+ case ETC1:
+ case RED_8:
+ case LUMINANCE_F16:
+ NOTREACHED();
+ return false;
}
+
NOTREACHED();
return false;
}
diff --git a/cc/resources/platform_color_unittest.cc b/cc/resources/platform_color_unittest.cc
index 49c8353..83f65b6 100644
--- a/cc/resources/platform_color_unittest.cc
+++ b/cc/resources/platform_color_unittest.cc
@@ -21,21 +21,17 @@ TEST(PlatformColorTest, SameComponentOrder) {
case RGBA_8888:
EXPECT_EQ(rgba, PlatformColor::SameComponentOrder(format));
break;
- case RGBA_4444:
- // RGBA_4444 indicates the number of bytes per pixel but the format
- // doesn't actually imply RGBA ordering. It uses the native ordering.
- EXPECT_EQ(true, PlatformColor::SameComponentOrder(format));
- break;
case BGRA_8888:
EXPECT_NE(rgba, PlatformColor::SameComponentOrder(format));
break;
+ // The following formats are not platform colors.
case ALPHA_8:
case LUMINANCE_8:
case RGB_565:
+ case RGBA_4444:
case ETC1:
case RED_8:
case LUMINANCE_F16:
- EXPECT_FALSE(PlatformColor::SameComponentOrder(format));
break;
}
}