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/test/fake_picture_pile_impl.h" | 5 #include "cc/test/fake_picture_pile_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "cc/test/impl_side_painting_settings.h" | 10 #include "cc/test/impl_side_painting_settings.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void FakePicturePileImpl::RerecordPile() { | 88 void FakePicturePileImpl::RerecordPile() { |
89 for (int y = 0; y < num_tiles_y(); ++y) { | 89 for (int y = 0; y < num_tiles_y(); ++y) { |
90 for (int x = 0; x < num_tiles_x(); ++x) { | 90 for (int x = 0; x < num_tiles_x(); ++x) { |
91 RemoveRecordingAt(x, y); | 91 RemoveRecordingAt(x, y); |
92 AddRecordingAt(x, y); | 92 AddRecordingAt(x, y); |
93 } | 93 } |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
| 97 void FakePicturePileImpl::AnalyzeInRect(gfx::Rect content_rect, |
| 98 float contents_scale, |
| 99 Analysis* analysis) { |
| 100 // Create and raster to a bitmap of content_rect size, even though the |
| 101 // analysis_rect may be smaller to simulate edge tiles where recorded content |
| 102 // doesn't cover the entire content_rect. |
| 103 SkBitmap empty_bitmap; |
| 104 empty_bitmap.setConfig(SkBitmap::kNo_Config, |
| 105 content_rect.width(), |
| 106 content_rect.height()); |
| 107 |
| 108 gfx::Rect analysis_rect( |
| 109 AnalysisRectForRaster(content_rect, contents_scale)); |
| 110 skia::AnalysisDevice device(empty_bitmap, analysis_rect); |
| 111 skia::AnalysisCanvas canvas(&device); |
| 112 |
| 113 RasterDirect(&canvas, content_rect, contents_scale, NULL); |
| 114 |
| 115 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); |
| 116 analysis->has_text = canvas.HasText(); |
| 117 } |
| 118 |
97 } // namespace cc | 119 } // namespace cc |
OLD | NEW |