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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 6 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 | « ui/compositor/layer.cc ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 667 }
668 668
669 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { 669 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
670 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, 670 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED,
671 gfx::Rect(20, 20, 400, 400))); 671 gfx::Rect(20, 20, 400, 400)));
672 l1->SetFillsBoundsOpaquely(true); 672 l1->SetFillsBoundsOpaquely(true);
673 l1->SetForceRenderSurface(true); 673 l1->SetForceRenderSurface(true);
674 l1->SetVisible(false); 674 l1->SetVisible(false);
675 675
676 EXPECT_EQ(gfx::PointF().ToString(), 676 EXPECT_EQ(gfx::PointF().ToString(),
677 l1->cc_layer()->anchor_point().ToString()); 677 l1->cc_layer()->transform_origin().ToString());
678 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 678 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
679 EXPECT_TRUE(l1->cc_layer()->contents_opaque()); 679 EXPECT_TRUE(l1->cc_layer()->contents_opaque());
680 EXPECT_TRUE(l1->cc_layer()->force_render_surface()); 680 EXPECT_TRUE(l1->cc_layer()->force_render_surface());
681 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); 681 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
682 682
683 cc::Layer* before_layer = l1->cc_layer(); 683 cc::Layer* before_layer = l1->cc_layer();
684 684
685 bool callback1_run = false; 685 bool callback1_run = false;
686 cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0); 686 cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0);
687 l1->SetTextureMailbox(mailbox, 687 l1->SetTextureMailbox(mailbox,
688 cc::SingleReleaseCallback::Create( 688 cc::SingleReleaseCallback::Create(
689 base::Bind(ReturnMailbox, &callback1_run)), 689 base::Bind(ReturnMailbox, &callback1_run)),
690 gfx::Size(1, 1)); 690 gfx::Size(1, 1));
691 691
692 EXPECT_NE(before_layer, l1->cc_layer()); 692 EXPECT_NE(before_layer, l1->cc_layer());
693 693
694 EXPECT_EQ(gfx::PointF().ToString(), 694 EXPECT_EQ(gfx::PointF().ToString(),
695 l1->cc_layer()->anchor_point().ToString()); 695 l1->cc_layer()->transform_origin().ToString());
696 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 696 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
697 EXPECT_TRUE(l1->cc_layer()->contents_opaque()); 697 EXPECT_TRUE(l1->cc_layer()->contents_opaque());
698 EXPECT_TRUE(l1->cc_layer()->force_render_surface()); 698 EXPECT_TRUE(l1->cc_layer()->force_render_surface());
699 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); 699 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
700 EXPECT_FALSE(callback1_run); 700 EXPECT_FALSE(callback1_run);
701 701
702 bool callback2_run = false; 702 bool callback2_run = false;
703 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0); 703 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0);
704 l1->SetTextureMailbox(mailbox, 704 l1->SetTextureMailbox(mailbox,
705 cc::SingleReleaseCallback::Create( 705 cc::SingleReleaseCallback::Create(
706 base::Bind(ReturnMailbox, &callback2_run)), 706 base::Bind(ReturnMailbox, &callback2_run)),
707 gfx::Size(1, 1)); 707 gfx::Size(1, 1));
708 EXPECT_TRUE(callback1_run); 708 EXPECT_TRUE(callback1_run);
709 EXPECT_FALSE(callback2_run); 709 EXPECT_FALSE(callback2_run);
710 710
711 l1->SetShowPaintedContent(); 711 l1->SetShowPaintedContent();
712 EXPECT_EQ(gfx::PointF().ToString(), 712 EXPECT_EQ(gfx::PointF().ToString(),
713 l1->cc_layer()->anchor_point().ToString()); 713 l1->cc_layer()->transform_origin().ToString());
714 EXPECT_TRUE(l1->cc_layer()->DrawsContent()); 714 EXPECT_TRUE(l1->cc_layer()->DrawsContent());
715 EXPECT_TRUE(l1->cc_layer()->contents_opaque()); 715 EXPECT_TRUE(l1->cc_layer()->contents_opaque());
716 EXPECT_TRUE(l1->cc_layer()->force_render_surface()); 716 EXPECT_TRUE(l1->cc_layer()->force_render_surface());
717 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); 717 EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
718 EXPECT_TRUE(callback2_run); 718 EXPECT_TRUE(callback2_run);
719 } 719 }
720 720
721 // Various visibile/drawn assertions. 721 // Various visibile/drawn assertions.
722 TEST_F(LayerWithNullDelegateTest, Visibility) { 722 TEST_F(LayerWithNullDelegateTest, Visibility) {
723 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED)); 723 scoped_ptr<Layer> l1(new Layer(LAYER_TEXTURED));
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 l1->SetOpacity(0.5f); 1501 l1->SetOpacity(0.5f);
1502 1502
1503 // Change l1's cc::Layer. 1503 // Change l1's cc::Layer.
1504 l1->SwitchCCLayerForTest(); 1504 l1->SwitchCCLayerForTest();
1505 1505
1506 // Ensure that the opacity animation completed. 1506 // Ensure that the opacity animation completed.
1507 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); 1507 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f);
1508 } 1508 }
1509 1509
1510 } // namespace ui 1510 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698