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

Side by Side Diff: cc/layer_iterator_unittest.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector Created 8 years, 1 month 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/layer_impl.cc ('k') | cc/layer_quad.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_iterator.h" 7 #include "cc/layer_iterator.h"
8 8
9 #include "cc/layer.h" 9 #include "cc/layer.h"
10 #include "cc/layer_tree_host_common.h" 10 #include "cc/layer_tree_host_common.h"
(...skipping 19 matching lines...) Expand all
30 int m_countRepresentingItself; 30 int m_countRepresentingItself;
31 31
32 virtual bool drawsContent() const OVERRIDE { return m_drawsContent; } 32 virtual bool drawsContent() const OVERRIDE { return m_drawsContent; }
33 void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; } 33 void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; }
34 34
35 private: 35 private:
36 TestLayer() 36 TestLayer()
37 : Layer() 37 : Layer()
38 , m_drawsContent(true) 38 , m_drawsContent(true)
39 { 39 {
40 setBounds(IntSize(100, 100)); 40 setBounds(gfx::Size(100, 100));
41 setPosition(IntPoint()); 41 setPosition(gfx::Point());
42 setAnchorPoint(IntPoint()); 42 setAnchorPoint(gfx::Point());
43 } 43 }
44 virtual ~TestLayer() 44 virtual ~TestLayer()
45 { 45 {
46 } 46 }
47 47
48 bool m_drawsContent; 48 bool m_drawsContent;
49 }; 49 };
50 50
51 #define EXPECT_COUNT(layer, target, contrib, itself) \ 51 #define EXPECT_COUNT(layer, target, contrib, itself) \
52 EXPECT_EQ(target, layer->m_countRepresentingTargetSurface); \ 52 EXPECT_EQ(target, layer->m_countRepresentingTargetSurface); \
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 scoped_refptr<TestLayer> root1 = TestLayer::create(); 204 scoped_refptr<TestLayer> root1 = TestLayer::create();
205 scoped_refptr<TestLayer> root2 = TestLayer::create(); 205 scoped_refptr<TestLayer> root2 = TestLayer::create();
206 scoped_refptr<TestLayer> root3 = TestLayer::create(); 206 scoped_refptr<TestLayer> root3 = TestLayer::create();
207 scoped_refptr<TestLayer> root21 = TestLayer::create(); 207 scoped_refptr<TestLayer> root21 = TestLayer::create();
208 scoped_refptr<TestLayer> root22 = TestLayer::create(); 208 scoped_refptr<TestLayer> root22 = TestLayer::create();
209 scoped_refptr<TestLayer> root23 = TestLayer::create(); 209 scoped_refptr<TestLayer> root23 = TestLayer::create();
210 scoped_refptr<TestLayer> root221 = TestLayer::create(); 210 scoped_refptr<TestLayer> root221 = TestLayer::create();
211 scoped_refptr<TestLayer> root231 = TestLayer::create(); 211 scoped_refptr<TestLayer> root231 = TestLayer::create();
212 212
213 rootLayer->createRenderSurface(); 213 rootLayer->createRenderSurface();
214 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bo unds())); 214 rootLayer->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), rootLayer ->bounds()));
215 215
216 rootLayer->addChild(root1); 216 rootLayer->addChild(root1);
217 rootLayer->addChild(root2); 217 rootLayer->addChild(root2);
218 rootLayer->addChild(root3); 218 rootLayer->addChild(root3);
219 root2->setDrawsContent(false); 219 root2->setDrawsContent(false);
220 root2->setOpacity(0.5); // Force the layer to own a new surface. 220 root2->setOpacity(0.5); // Force the layer to own a new surface.
221 root2->addChild(root21); 221 root2->addChild(root21);
222 root2->addChild(root22); 222 root2->addChild(root22);
223 root2->addChild(root23); 223 root2->addChild(root23);
224 root22->setOpacity(0.5); 224 root22->setOpacity(0.5);
(...skipping 21 matching lines...) Expand all
246 EXPECT_COUNT(root2, 10, 11, -1); 246 EXPECT_COUNT(root2, 10, 11, -1);
247 EXPECT_COUNT(root21, -1, -1, 9); 247 EXPECT_COUNT(root21, -1, -1, 9);
248 EXPECT_COUNT(root22, 7, 8, 6); 248 EXPECT_COUNT(root22, 7, 8, 6);
249 EXPECT_COUNT(root221, -1, -1, 5); 249 EXPECT_COUNT(root221, -1, -1, 5);
250 EXPECT_COUNT(root23, 3, 4, 2); 250 EXPECT_COUNT(root23, 3, 4, 2);
251 EXPECT_COUNT(root231, -1, -1, 1); 251 EXPECT_COUNT(root231, -1, -1, 1);
252 EXPECT_COUNT(root3, -1, -1, 0); 252 EXPECT_COUNT(root3, -1, -1, 0);
253 } 253 }
254 254
255 } // namespace 255 } // namespace
OLDNEW
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698