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

Side by Side Diff: cc/trees/damage_tracker_unittest.cc

Issue 12967018: cc: Avoid pointless gfx::Point/Size contructors when making Rects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RectFs as well Created 7 years, 9 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/scheduler/texture_uploader_unittest.cc ('k') | cc/trees/layer_tree_host_common.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/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 LayerImpl::Create(host_impl_.active_tree(), 1); 89 LayerImpl::Create(host_impl_.active_tree(), 1);
90 scoped_ptr<LayerImpl> child = 90 scoped_ptr<LayerImpl> child =
91 LayerImpl::Create(host_impl_.active_tree(), 2); 91 LayerImpl::Create(host_impl_.active_tree(), 2);
92 92
93 root->SetPosition(gfx::PointF()); 93 root->SetPosition(gfx::PointF());
94 root->SetAnchorPoint(gfx::PointF()); 94 root->SetAnchorPoint(gfx::PointF());
95 root->SetBounds(gfx::Size(500, 500)); 95 root->SetBounds(gfx::Size(500, 500));
96 root->SetContentBounds(gfx::Size(500, 500)); 96 root->SetContentBounds(gfx::Size(500, 500));
97 root->SetDrawsContent(true); 97 root->SetDrawsContent(true);
98 root->CreateRenderSurface(); 98 root->CreateRenderSurface();
99 root->render_surface()->SetContentRect( 99 root->render_surface()->SetContentRect(gfx::Rect(0, 0, 500, 500));
100 gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
101 100
102 child->SetPosition(gfx::PointF(100.f, 100.f)); 101 child->SetPosition(gfx::PointF(100.f, 100.f));
103 child->SetAnchorPoint(gfx::PointF()); 102 child->SetAnchorPoint(gfx::PointF());
104 child->SetBounds(gfx::Size(30, 30)); 103 child->SetBounds(gfx::Size(30, 30));
105 child->SetContentBounds(gfx::Size(30, 30)); 104 child->SetContentBounds(gfx::Size(30, 30));
106 child->SetDrawsContent(true); 105 child->SetDrawsContent(true);
107 root->AddChild(child.Pass()); 106 root->AddChild(child.Pass());
108 107
109 return root.Pass(); 108 return root.Pass();
110 } 109 }
(...skipping 13 matching lines...) Expand all
124 LayerImpl::Create(host_impl_.active_tree(), 4); 123 LayerImpl::Create(host_impl_.active_tree(), 4);
125 scoped_ptr<LayerImpl> grand_child2 = 124 scoped_ptr<LayerImpl> grand_child2 =
126 LayerImpl::Create(host_impl_.active_tree(), 5); 125 LayerImpl::Create(host_impl_.active_tree(), 5);
127 126
128 root->SetPosition(gfx::PointF()); 127 root->SetPosition(gfx::PointF());
129 root->SetAnchorPoint(gfx::PointF()); 128 root->SetAnchorPoint(gfx::PointF());
130 root->SetBounds(gfx::Size(500, 500)); 129 root->SetBounds(gfx::Size(500, 500));
131 root->SetContentBounds(gfx::Size(500, 500)); 130 root->SetContentBounds(gfx::Size(500, 500));
132 root->SetDrawsContent(true); 131 root->SetDrawsContent(true);
133 root->CreateRenderSurface(); 132 root->CreateRenderSurface();
134 root->render_surface()->SetContentRect( 133 root->render_surface()->SetContentRect(gfx::Rect(0, 0, 500, 500));
135 gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
136 134
137 child1->SetPosition(gfx::PointF(100.f, 100.f)); 135 child1->SetPosition(gfx::PointF(100.f, 100.f));
138 child1->SetAnchorPoint(gfx::PointF()); 136 child1->SetAnchorPoint(gfx::PointF());
139 child1->SetBounds(gfx::Size(30, 30)); 137 child1->SetBounds(gfx::Size(30, 30));
140 child1->SetContentBounds(gfx::Size(30, 30)); 138 child1->SetContentBounds(gfx::Size(30, 30));
141 // With a child that draws_content, opacity will cause the layer to create 139 // With a child that draws_content, opacity will cause the layer to create
142 // its own RenderSurface. This layer does not draw, but is intended to 140 // its own RenderSurface. This layer does not draw, but is intended to
143 // create its own RenderSurface. TODO: setting opacity and 141 // create its own RenderSurface. TODO: setting opacity and
144 // ForceRenderSurface may be redundant here. 142 // ForceRenderSurface may be redundant here.
145 child1->SetOpacity(0.5f); 143 child1->SetOpacity(0.5f);
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 // Damage should remain empty even after one frame, since there's yet no new 1344 // Damage should remain empty even after one frame, since there's yet no new
1347 // damage. 1345 // damage.
1348 EmulateDrawingOneFrame(root.get()); 1346 EmulateDrawingOneFrame(root.get());
1349 root_damage_rect = 1347 root_damage_rect =
1350 root->render_surface()->damage_tracker()->current_damage_rect(); 1348 root->render_surface()->damage_tracker()->current_damage_rect();
1351 EXPECT_TRUE(root_damage_rect.IsEmpty()); 1349 EXPECT_TRUE(root_damage_rect.IsEmpty());
1352 } 1350 }
1353 1351
1354 } // namespace 1352 } // namespace
1355 } // namespace cc 1353 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/texture_uploader_unittest.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698