| 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); |
| 100 picture_pile->RasterToBitmap(&canvas, content_rect, contents_scale, NULL); | 102 picture_pile->RasterToBitmap(&canvas, content_rect, contents_scale, NULL); |
| 101 base::TimeTicks end = Now(); | 103 base::TimeTicks end = Now(); |
| 102 base::TimeDelta duration = end - start; | 104 base::TimeDelta duration = end - start; |
| 103 if (duration < min_time) | 105 if (duration < min_time) |
| 104 min_time = duration; | 106 min_time = duration; |
| 105 } | 107 } |
| 106 | 108 |
| 107 rasterize_results_.pixels_rasterized += | 109 rasterize_results_.pixels_rasterized += |
| 108 content_rect.width() * content_rect.height(); | 110 content_rect.width() * content_rect.height(); |
| 109 rasterize_results_.total_best_time += min_time; | 111 rasterize_results_.total_best_time += min_time; |
| 110 } | 112 } |
| 111 } | 113 } |
| 112 | 114 |
| 113 RasterizeAndRecordBenchmarkImpl::RasterizeResults::RasterizeResults() | 115 RasterizeAndRecordBenchmarkImpl::RasterizeResults::RasterizeResults() |
| 114 : pixels_rasterized(0) {} | 116 : pixels_rasterized(0) {} |
| 115 | 117 |
| 116 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 118 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
| 117 | 119 |
| 118 } // namespace cc | 120 } // namespace cc |
| OLD | NEW |