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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/test/fake_impl_proxy.h" 7 #include "cc/test/fake_impl_proxy.h"
8 #include "cc/test/fake_layer_tree_host_impl.h" 8 #include "cc/test/fake_layer_tree_host_impl.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 286 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
287 root->SetBackgroundFilters(arbitrary_filters)); 287 root->SetBackgroundFilters(arbitrary_filters));
288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number)); 288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number));
289 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 289 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
290 root->SetTransform(arbitrary_transform)); 290 root->SetTransform(arbitrary_transform));
291 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 291 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
292 root->SetSublayerTransform(arbitrary_transform)); 292 root->SetSublayerTransform(arbitrary_transform));
293 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size)); 293 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size));
294 } 294 }
295 295
296 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
297 FakeImplProxy proxy;
298 FakeLayerTreeHostImpl host_impl(&proxy);
299 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface()));
300 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
301
302 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) {
303 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) {
304 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) {
305 layer->SetContentsOpaque(!!contents_opaque);
306 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED
307 : SK_ColorTRANSPARENT);
308 host_impl.active_tree()->set_background_color(
309 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT);
310
311 SkColor safe_color = layer->SafeOpaqueBackgroundColor();
312 if (contents_opaque) {
313 EXPECT_EQ(SkColorGetA(safe_color), 255u)
314 << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
315 << host_opaque << "\n";
316 } else {
317 EXPECT_NE(SkColorGetA(safe_color), 255u)
318 << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
319 << host_opaque << "\n";
320 }
321 }
322 }
323 }
324 }
325
296 } // namespace 326 } // namespace
297 } // namespace cc 327 } // namespace cc
OLDNEW
« 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