| 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" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 DisplayListRecordingSource::~DisplayListRecordingSource() { | 42 DisplayListRecordingSource::~DisplayListRecordingSource() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( | 45 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( |
| 46 ContentLayerClient* painter, | 46 ContentLayerClient* painter, |
| 47 Region* invalidation, | 47 Region* invalidation, |
| 48 const gfx::Size& layer_size, | 48 const gfx::Size& layer_size, |
| 49 const gfx::Rect& visible_layer_rect, | 49 const gfx::Rect& visible_layer_rect, |
| 50 int frame_number, | 50 int frame_number, |
| 51 RecordingMode recording_mode) { | 51 RecordingMode recording_mode, |
| 52 int* recorded_area) { |
| 52 bool updated = false; | 53 bool updated = false; |
| 53 | 54 |
| 54 if (size_ != layer_size) { | 55 if (size_ != layer_size) { |
| 55 size_ = layer_size; | 56 size_ = layer_size; |
| 56 updated = true; | 57 updated = true; |
| 57 } | 58 } |
| 58 | 59 |
| 59 gfx::Rect old_recorded_viewport = recorded_viewport_; | 60 gfx::Rect old_recorded_viewport = recorded_viewport_; |
| 60 recorded_viewport_ = visible_layer_rect; | 61 recorded_viewport_ = visible_layer_rect; |
| 61 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_); | 62 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 is_suitable_for_gpu_rasterization_ = | 114 is_suitable_for_gpu_rasterization_ = |
| 114 display_list_->IsSuitableForGpuRasterization(); | 115 display_list_->IsSuitableForGpuRasterization(); |
| 115 | 116 |
| 116 DetermineIfSolidColor(); | 117 DetermineIfSolidColor(); |
| 117 display_list_->EmitTraceSnapshot(); | 118 display_list_->EmitTraceSnapshot(); |
| 118 | 119 |
| 119 display_list_->CreateAndCacheSkPicture(); | 120 display_list_->CreateAndCacheSkPicture(); |
| 120 if (gather_pixel_refs_) | 121 if (gather_pixel_refs_) |
| 121 display_list_->GatherPixelRefs(grid_cell_size_); | 122 display_list_->GatherPixelRefs(grid_cell_size_); |
| 122 | 123 |
| 124 if (recorded_area) |
| 125 *recorded_area = recorded_viewport_.size().GetArea(); |
| 126 |
| 123 return true; | 127 return true; |
| 124 } | 128 } |
| 125 | 129 |
| 126 gfx::Size DisplayListRecordingSource::GetSize() const { | 130 gfx::Size DisplayListRecordingSource::GetSize() const { |
| 127 return size_; | 131 return size_; |
| 128 } | 132 } |
| 129 | 133 |
| 130 void DisplayListRecordingSource::SetEmptyBounds() { | 134 void DisplayListRecordingSource::SetEmptyBounds() { |
| 131 size_ = gfx::Size(); | 135 size_ = gfx::Size(); |
| 132 Clear(); | 136 Clear(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 185 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
| 182 } | 186 } |
| 183 | 187 |
| 184 void DisplayListRecordingSource::Clear() { | 188 void DisplayListRecordingSource::Clear() { |
| 185 recorded_viewport_ = gfx::Rect(); | 189 recorded_viewport_ = gfx::Rect(); |
| 186 display_list_ = NULL; | 190 display_list_ = NULL; |
| 187 is_solid_color_ = false; | 191 is_solid_color_ = false; |
| 188 } | 192 } |
| 189 | 193 |
| 190 } // namespace cc | 194 } // namespace cc |
| OLD | NEW |