OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/rasterize_and_record_benchmark.h" | 5 #include "cc/debug/rasterize_and_record_benchmark.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 SkTileGridPicture::TileGridInfo tile_grid_info; | 111 SkTileGridPicture::TileGridInfo tile_grid_info; |
112 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); | 112 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); |
113 | 113 |
114 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( | 114 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( |
115 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); | 115 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); |
116 if (visible_content_rect.IsEmpty()) | 116 if (visible_content_rect.IsEmpty()) |
117 return; | 117 return; |
118 | 118 |
119 | 119 |
120 base::TimeDelta min_time = base::TimeDelta::Max(); | 120 base::TimeDelta min_time = |
| 121 base::TimeDelta::FromInternalValue(std::numeric_limits<int64>::max()); |
121 for (int i = 0; i < record_repeat_count_; ++i) { | 122 for (int i = 0; i < record_repeat_count_; ++i) { |
122 base::TimeTicks start = Now(); | 123 base::TimeTicks start = Now(); |
123 scoped_refptr<Picture> picture = Picture::Create( | 124 scoped_refptr<Picture> picture = Picture::Create( |
124 visible_content_rect, painter, tile_grid_info, false, 0); | 125 visible_content_rect, painter, tile_grid_info, false, 0); |
125 base::TimeTicks end = Now(); | 126 base::TimeTicks end = Now(); |
126 base::TimeDelta duration = end - start; | 127 base::TimeDelta duration = end - start; |
127 if (duration < min_time) | 128 if (duration < min_time) |
128 min_time = duration; | 129 min_time = duration; |
129 } | 130 } |
130 | 131 |
131 record_results_.pixels_recorded += | 132 record_results_.pixels_recorded += |
132 visible_content_rect.width() * visible_content_rect.height(); | 133 visible_content_rect.width() * visible_content_rect.height(); |
133 record_results_.total_best_time += min_time; | 134 record_results_.total_best_time += min_time; |
134 } | 135 } |
135 | 136 |
136 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 137 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
137 : pixels_recorded(0) {} | 138 : pixels_recorded(0) {} |
138 | 139 |
139 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 140 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
140 | 141 |
141 } // namespace cc | 142 } // namespace cc |
OLD | NEW |