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

Unified Diff: cc/layers/layer_impl_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.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl_unittest.cc
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 01dda88ada7f96c3602e6f46fad00bf1c7bc7cbe..dc1b29bc9ed47309745b6afe6a81429edb9c6d72 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -293,5 +293,35 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size));
}
+TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
+ FakeImplProxy proxy;
+ FakeLayerTreeHostImpl host_impl(&proxy);
+ EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface()));
+ scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
+
+ 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);
+ host_impl.active_tree()->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.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698