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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 25 matching lines...) Expand all Loading... |
36 const int kWarmupRuns = 0; | 36 const int kWarmupRuns = 0; |
37 const int kTimeCheckInterval = 1; | 37 const int kTimeCheckInterval = 1; |
38 | 38 |
39 *min_time = base::TimeDelta::Max(); | 39 *min_time = base::TimeDelta::Max(); |
40 for (size_t i = 0; i < repeat_count; ++i) { | 40 for (size_t i = 0; i < repeat_count; ++i) { |
41 // Run for a minimum amount of time to avoid problems with timer | 41 // Run for a minimum amount of time to avoid problems with timer |
42 // quantization when the layer is very small. | 42 // quantization when the layer is very small. |
43 LapTimer timer(kWarmupRuns, | 43 LapTimer timer(kWarmupRuns, |
44 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 44 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
45 kTimeCheckInterval); | 45 kTimeCheckInterval); |
| 46 SkColor color = SK_ColorTRANSPARENT; |
| 47 *is_solid_color = raster_source->PerformSolidColorAnalysis( |
| 48 content_rect, contents_scale, &color); |
| 49 |
46 do { | 50 do { |
47 SkBitmap bitmap; | 51 SkBitmap bitmap; |
48 bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect.width(), | 52 bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect.width(), |
49 content_rect.height())); | 53 content_rect.height())); |
50 SkCanvas canvas(bitmap); | 54 SkCanvas canvas(bitmap); |
51 DisplayListRasterSource::SolidColorAnalysis analysis; | |
52 | 55 |
53 raster_source->PerformSolidColorAnalysis(content_rect, contents_scale, | |
54 &analysis); | |
55 raster_source->PlaybackToCanvas(&canvas, content_rect, content_rect, | 56 raster_source->PlaybackToCanvas(&canvas, content_rect, content_rect, |
56 contents_scale); | 57 contents_scale); |
57 | 58 |
58 *is_solid_color = analysis.is_solid_color; | |
59 | |
60 timer.NextLap(); | 59 timer.NextLap(); |
61 } while (!timer.HasTimeLimitExpired()); | 60 } while (!timer.HasTimeLimitExpired()); |
62 base::TimeDelta duration = | 61 base::TimeDelta duration = |
63 base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); | 62 base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); |
64 if (duration < *min_time) | 63 if (duration < *min_time) |
65 *min_time = duration; | 64 *min_time = duration; |
66 } | 65 } |
67 } | 66 } |
68 | 67 |
69 class FixedInvalidationPictureLayerTilingClient | 68 class FixedInvalidationPictureLayerTilingClient |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 total_memory_usage(0), | 215 total_memory_usage(0), |
217 total_layers(0), | 216 total_layers(0), |
218 total_picture_layers(0), | 217 total_picture_layers(0), |
219 total_picture_layers_with_no_content(0), | 218 total_picture_layers_with_no_content(0), |
220 total_picture_layers_off_screen(0) { | 219 total_picture_layers_off_screen(0) { |
221 } | 220 } |
222 | 221 |
223 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} | 222 RasterizeAndRecordBenchmarkImpl::RasterizeResults::~RasterizeResults() {} |
224 | 223 |
225 } // namespace cc | 224 } // namespace cc |
OLD | NEW |