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

Side by Side Diff: cc/region_unittest.cc

Issue 11369103: Compare SkRegion and android::Region performance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/region.cc ('k') | no next file » | 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/region.h" 7 #include "cc/region.h"
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 10, 0).isEmpty()); 411 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 10, 0).isEmpty());
412 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 0, 10).isEmpty()); 412 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 0, 10).isEmpty());
413 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 10, 0).isEmpty()); 413 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 10, 0).isEmpty());
414 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 0, 10).isEmpty()); 414 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 0, 10).isEmpty());
415 EXPECT_FALSE(SkIRect::MakeXYWH(-1, -1, 1, 1).isEmpty()); 415 EXPECT_FALSE(SkIRect::MakeXYWH(-1, -1, 1, 1).isEmpty());
416 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 1, 1).isEmpty()); 416 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 1, 1).isEmpty());
417 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 2, 2).isEmpty()); 417 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 2, 2).isEmpty());
418 } 418 }
419 419
420 } // namespace 420 } // namespace
421
422 #include "cc/layer.h"
423 #include "cc/layer_tree_host_common.h"
424 #include "cc/occlusion_tracker.h"
425
426 void blah() {
427 static int count = 0;
428 ++count;
429 }
430
431 namespace {
432 TEST(RegionTest, Speed) {
433 scoped_refptr<Layer> root_layer = Layer::create();
434
435 for (int i = 0; i < 10000; ++i) {
436 scoped_refptr<Layer> layer = Layer::create();
437 layer->setIsDrawable(true);
438 layer->setAnchorPoint(gfx::Point());
439 layer->setBounds(gfx::Size(400, 400));
440 layer->setContentsOpaque(true);
441
442 int x = i % 600;
443 int y = 600 - x;
444 layer->setPosition(gfx::Point(x, y));
445
446 root_layer->addChild(layer);
447 }
448
449 Layer::LayerList renderSurfaceLayerList;
450 gfx::Size device_viewport_size(1000, 1000);
451 LayerTreeHostCommon::calculateDrawTransforms(root_layer, device_viewport_size, 1, 1, 1000, renderSurfaceLayerList);
452
453 bool recordMetrics = false;
454 OcclusionTracker occlusionTracker(gfx::Rect(device_viewport_size), recordMetri cs);
455 occlusionTracker.setMinimumTrackingSize(gfx::Size());
456
457 typedef LayerIterator<Layer, Layer::LayerList, RenderSurface, LayerIteratorAct ions::FrontToBack> LayerIteratorType;
458 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
459 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
460 occlusionTracker.enterLayer(it);
461
462 bool occluded = occlusionTracker.occluded(it->renderTarget(), gfx::Rect(it-> contentBounds()), it->drawTransform(), true, it->drawableContentRect(), NULL);
463 if (!occluded)
464 blah();
465
466 occlusionTracker.leaveLayer(it);
467 }
468 }
469 } // namespace
OLDNEW
« no previous file with comments | « cc/region.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698