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_impl.h" | 5 #include "cc/debug/rasterize_and_record_benchmark_impl.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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 90 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
91 content_rect.width(), | 91 content_rect.width(), |
92 content_rect.height()); | 92 content_rect.height()); |
93 bitmap.allocPixels(); | 93 bitmap.allocPixels(); |
94 | 94 |
95 SkBitmapDevice device(bitmap); | 95 SkBitmapDevice device(bitmap); |
96 SkCanvas canvas(&device); | 96 SkCanvas canvas(&device); |
97 PicturePileImpl::Analysis analysis; | 97 PicturePileImpl::Analysis analysis; |
98 | 98 |
99 base::TimeTicks start = Now(); | 99 base::TimeTicks start = Now(); |
100 picture_pile->AnalyzeInRect( | |
101 content_rect, contents_scale, &analysis, NULL); | |
102 picture_pile->RasterToBitmap(&canvas, content_rect, contents_scale, NULL); | 100 picture_pile->RasterToBitmap(&canvas, content_rect, contents_scale, NULL); |
103 base::TimeTicks end = Now(); | 101 base::TimeTicks end = Now(); |
104 base::TimeDelta duration = end - start; | 102 base::TimeDelta duration = end - start; |
105 if (duration < min_time) | 103 if (duration < min_time) |
106 min_time = duration; | 104 min_time = duration; |
107 } | 105 } |
108 | 106 |
109 rasterize_results_.pixels_rasterized += | 107 rasterize_results_.pixels_rasterized += |
110 content_rect.width() * content_rect.height(); | 108 content_rect.width() * content_rect.height(); |
111 rasterize_results_.total_best_time += min_time; | 109 rasterize_results_.total_best_time += min_time; |
112 } | 110 } |
113 } | 111 } |
114 | 112 |
115 RasterizeAndRecordBenchmarkImpl::RasterizeResults::RasterizeResults() | 113 RasterizeAndRecordBenchmarkImpl::RasterizeResults::RasterizeResults() |
116 : pixels_rasterized(0) {} | 114 : pixels_rasterized(0) {} |
117 | 115 |
118 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 116 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
119 | 117 |
120 } // namespace cc | 118 } // namespace cc |
OLD | NEW |