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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 SkTileGridPicture::TileGridInfo tile_grid_info; | 102 SkTileGridPicture::TileGridInfo tile_grid_info; |
103 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); | 103 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); |
104 | 104 |
105 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( | 105 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( |
106 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); | 106 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); |
107 if (visible_content_rect.IsEmpty()) | 107 if (visible_content_rect.IsEmpty()) |
108 return; | 108 return; |
109 | 109 |
110 | 110 |
111 base::TimeDelta min_time = | 111 base::TimeDelta min_time = base::TimeDelta::Max(); |
112 base::TimeDelta::FromInternalValue(std::numeric_limits<int64>::max()); | |
113 for (int i = 0; i < record_repeat_count_; ++i) { | 112 for (int i = 0; i < record_repeat_count_; ++i) { |
114 base::TimeTicks start = Now(); | 113 base::TimeTicks start = Now(); |
115 scoped_refptr<Picture> picture = Picture::Create( | 114 scoped_refptr<Picture> picture = Picture::Create( |
116 visible_content_rect, painter, tile_grid_info, false, 0); | 115 visible_content_rect, painter, tile_grid_info, false, 0); |
117 base::TimeTicks end = Now(); | 116 base::TimeTicks end = Now(); |
118 base::TimeDelta duration = end - start; | 117 base::TimeDelta duration = end - start; |
119 if (duration < min_time) | 118 if (duration < min_time) |
120 min_time = duration; | 119 min_time = duration; |
121 } | 120 } |
122 | 121 |
123 record_results_.pixels_recorded += | 122 record_results_.pixels_recorded += |
124 visible_content_rect.width() * visible_content_rect.height(); | 123 visible_content_rect.width() * visible_content_rect.height(); |
125 record_results_.total_best_time += min_time; | 124 record_results_.total_best_time += min_time; |
126 } | 125 } |
127 | 126 |
128 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 127 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
129 : pixels_recorded(0) {} | 128 : pixels_recorded(0) {} |
130 | 129 |
131 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 130 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
132 | 131 |
133 } // namespace cc | 132 } // namespace cc |
OLD | NEW |