Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/resources/display_list_recording_source.h" | 5 #include "cc/resources/display_list_recording_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
| 10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
| 11 #include "cc/resources/display_item_list.h" | 11 #include "cc/resources/display_item_list.h" |
| 12 #include "cc/resources/display_list_raster_source.h" | 12 #include "cc/resources/display_list_raster_source.h" |
| 13 #include "skia/ext/analysis_canvas.h" | 13 #include "skia/ext/analysis_canvas.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Layout pixel buffer around the visible layer rect to record. Any base | 17 // Layout pixel buffer around the visible layer rect to record. Any base |
| 18 // picture that intersects the visible layer rect expanded by this distance | 18 // picture that intersects the visible layer rect expanded by this distance |
| 19 // will be recorded. | 19 // will be recorded. |
| 20 const int kPixelDistanceToRecord = 8000; | 20 const int kPixelDistanceToRecord = 8000; |
| 21 // We don't perform solid color analysis on images that have more than 10 skia | 21 // We don't perform solid color analysis on images that have more than 10 skia |
| 22 // operations. | 22 // operations. |
| 23 const int kOpCountThatIsOkToAnalyze = 10; | 23 const int kOpCountThatIsOkToAnalyze = 10; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 namespace cc { | 27 namespace cc { |
| 28 | 28 |
| 29 DisplayListRecordingSource::DisplayListRecordingSource() | 29 DisplayListRecordingSource::DisplayListRecordingSource( |
| 30 const gfx::Size& grid_cell_size) | |
| 30 : slow_down_raster_scale_factor_for_debug_(0), | 31 : slow_down_raster_scale_factor_for_debug_(0), |
| 31 requires_clear_(false), | 32 requires_clear_(false), |
| 32 is_solid_color_(false), | 33 is_solid_color_(false), |
| 33 solid_color_(SK_ColorTRANSPARENT), | 34 solid_color_(SK_ColorTRANSPARENT), |
| 34 background_color_(SK_ColorTRANSPARENT), | 35 background_color_(SK_ColorTRANSPARENT), |
| 35 pixel_record_distance_(kPixelDistanceToRecord), | 36 pixel_record_distance_(kPixelDistanceToRecord), |
| 37 grid_cell_size_(grid_cell_size), | |
| 36 is_suitable_for_gpu_rasterization_(true) { | 38 is_suitable_for_gpu_rasterization_(true) { |
| 37 } | 39 } |
| 38 | 40 |
| 39 DisplayListRecordingSource::~DisplayListRecordingSource() { | 41 DisplayListRecordingSource::~DisplayListRecordingSource() { |
| 40 } | 42 } |
| 41 | 43 |
| 42 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( | 44 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( |
| 43 ContentLayerClient* painter, | 45 ContentLayerClient* painter, |
| 44 Region* invalidation, | 46 Region* invalidation, |
| 45 const gfx::Size& layer_size, | 47 const gfx::Size& layer_size, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 painting_control); | 109 painting_control); |
| 108 } | 110 } |
| 109 display_list_->set_layer_rect(recorded_viewport_); | 111 display_list_->set_layer_rect(recorded_viewport_); |
| 110 is_suitable_for_gpu_rasterization_ = | 112 is_suitable_for_gpu_rasterization_ = |
| 111 display_list_->IsSuitableForGpuRasterization(); | 113 display_list_->IsSuitableForGpuRasterization(); |
| 112 | 114 |
| 113 DetermineIfSolidColor(); | 115 DetermineIfSolidColor(); |
| 114 display_list_->EmitTraceSnapshot(); | 116 display_list_->EmitTraceSnapshot(); |
| 115 | 117 |
| 116 display_list_->CreateAndCacheSkPicture(); | 118 display_list_->CreateAndCacheSkPicture(); |
| 119 display_list_->GatherPixelRefs(grid_cell_size_); | |
|
ajuma
2015/03/30 20:46:37
This should be conditional on gather_pixel_refs_.
weiliangc
2015/03/31 14:04:11
Done.
| |
| 117 | 120 |
| 118 return true; | 121 return true; |
| 119 } | 122 } |
| 120 | 123 |
| 121 void DisplayListRecordingSource::DidMoveToNewCompositor() { | 124 void DisplayListRecordingSource::DidMoveToNewCompositor() { |
| 122 // No invalidation history to worry about here. | 125 // No invalidation history to worry about here. |
| 123 } | 126 } |
| 124 | 127 |
| 125 gfx::Size DisplayListRecordingSource::GetSize() const { | 128 gfx::Size DisplayListRecordingSource::GetSize() const { |
| 126 return size_; | 129 return size_; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 179 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
| 177 } | 180 } |
| 178 | 181 |
| 179 void DisplayListRecordingSource::Clear() { | 182 void DisplayListRecordingSource::Clear() { |
| 180 recorded_viewport_ = gfx::Rect(); | 183 recorded_viewport_ = gfx::Rect(); |
| 181 display_list_ = NULL; | 184 display_list_ = NULL; |
| 182 is_solid_color_ = false; | 185 is_solid_color_ = false; |
| 183 } | 186 } |
| 184 | 187 |
| 185 } // namespace cc | 188 } // namespace cc |
| OLD | NEW |