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

Side by Side Diff: cc/debug/invalidation_benchmark.cc

Issue 2183403002: cc: Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layer_tree_change
Patch Set: remove unused test file. Created 4 years, 4 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
« no previous file with comments | « no previous file | cc/layers/heads_up_display_unittest.cc » ('j') | cc/layers/layer_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/debug/invalidation_benchmark.h" 5 #include "cc/debug/invalidation_benchmark.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 host, [this](Layer* layer) { layer->RunMicroBenchmark(this); }); 68 host, [this](Layer* layer) { layer->RunMicroBenchmark(this); });
69 } 69 }
70 70
71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { 71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) {
72 gfx::Rect visible_layer_rect = gfx::Rect(layer->bounds()); 72 gfx::Rect visible_layer_rect = gfx::Rect(layer->bounds());
73 gfx::Transform from_screen; 73 gfx::Transform from_screen;
74 bool invertible = layer->screen_space_transform().GetInverse(&from_screen); 74 bool invertible = layer->screen_space_transform().GetInverse(&from_screen);
75 if (!invertible) 75 if (!invertible)
76 from_screen = gfx::Transform(); 76 from_screen = gfx::Transform();
77 gfx::Rect viewport_rect = MathUtil::ProjectEnclosingClippedRect( 77 gfx::Rect viewport_rect = MathUtil::ProjectEnclosingClippedRect(
78 from_screen, gfx::Rect(layer->layer_tree_host()->device_viewport_size())); 78 from_screen, gfx::Rect(layer->GetLayerTree()->device_viewport_size()));
79 visible_layer_rect.Intersect(viewport_rect); 79 visible_layer_rect.Intersect(viewport_rect);
80 switch (mode_) { 80 switch (mode_) {
81 case FIXED_SIZE: { 81 case FIXED_SIZE: {
82 // Invalidation with a random position and fixed size. 82 // Invalidation with a random position and fixed size.
83 int x = LCGRandom() * (visible_layer_rect.width() - width_); 83 int x = LCGRandom() * (visible_layer_rect.width() - width_);
84 int y = LCGRandom() * (visible_layer_rect.height() - height_); 84 int y = LCGRandom() * (visible_layer_rect.height() - height_);
85 gfx::Rect invalidation_rect(x, y, width_, height_); 85 gfx::Rect invalidation_rect(x, y, width_, height_);
86 layer->SetNeedsDisplayRect(invalidation_rect); 86 layer->SetNeedsDisplayRect(invalidation_rect);
87 break; 87 break;
88 } 88 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // high quality, but they need to be identical in each run. Therefore, we use a 133 // high quality, but they need to be identical in each run. Therefore, we use a
134 // LCG and keep the state locally in the benchmark. 134 // LCG and keep the state locally in the benchmark.
135 float InvalidationBenchmark::LCGRandom() { 135 float InvalidationBenchmark::LCGRandom() {
136 const uint32_t a = 1664525; 136 const uint32_t a = 1664525;
137 const uint32_t c = 1013904223; 137 const uint32_t c = 1013904223;
138 seed_ = a * seed_ + c; 138 seed_ = a * seed_ + c;
139 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); 139 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max();
140 } 140 }
141 141
142 } // namespace cc 142 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/heads_up_display_unittest.cc » ('j') | cc/layers/layer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698