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

Unified Diff: cc/layers/layer_unittest.cc

Issue 15995031: cc: Don't clear transparent piles to an opaque color (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_unittest.cc
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 006846a53dd9dc92fd4f80e63f4146de25279b13..8eb58616a0e1df23fd800268abda55b8de9eab5f 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -976,5 +976,36 @@ TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
EXPECT_FALSE(AddTestAnimation(layer.get()));
}
+TEST_F(LayerTest, SafeOpaqueBackgroundColor) {
+ LayerTreeHostFactory factory;
+ scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create();
+
+ scoped_refptr<Layer> layer = Layer::Create();
+ layer_tree_host->SetRootLayer(layer);
+
+ for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) {
+ for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) {
+ for (int host_opaque = 0; host_opaque < 2; ++host_opaque) {
+ layer->SetContentsOpaque(!!contents_opaque);
+ layer->SetBackgroundColor(layer_opaque ? SK_ColorRED
+ : SK_ColorTRANSPARENT);
+ layer_tree_host->set_background_color(
+ host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT);
+
+ SkColor safe_color = layer->SafeOpaqueBackgroundColor();
+ if (contents_opaque) {
+ EXPECT_EQ(SkColorGetA(safe_color), 255u)
+ << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
+ << host_opaque << "\n";
+ } else {
+ EXPECT_NE(SkColorGetA(safe_color), 255u)
+ << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
+ << host_opaque << "\n";
+ }
+ }
+ }
+ }
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698