| 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/layers/recording_source.h" | 5 #include "cc/layers/recording_source.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 namespace cc { | 33 namespace cc { |
| 34 | 34 |
| 35 RecordingSource::RecordingSource() | 35 RecordingSource::RecordingSource() |
| 36 : slow_down_raster_scale_factor_for_debug_(0), | 36 : slow_down_raster_scale_factor_for_debug_(0), |
| 37 requires_clear_(false), | 37 requires_clear_(false), |
| 38 is_solid_color_(false), | 38 is_solid_color_(false), |
| 39 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), | 39 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), |
| 40 solid_color_(SK_ColorTRANSPARENT), | 40 solid_color_(SK_ColorTRANSPARENT), |
| 41 background_color_(SK_ColorTRANSPARENT) {} | 41 background_color_(SK_ColorTRANSPARENT), |
| 42 recording_scale_factor_(1.f) {} |
| 42 | 43 |
| 43 RecordingSource::~RecordingSource() {} | 44 RecordingSource::~RecordingSource() {} |
| 44 | 45 |
| 45 void RecordingSource::UpdateInvalidationForNewViewport( | 46 void RecordingSource::UpdateInvalidationForNewViewport( |
| 46 const gfx::Rect& old_recorded_viewport, | 47 const gfx::Rect& old_recorded_viewport, |
| 47 const gfx::Rect& new_recorded_viewport, | 48 const gfx::Rect& new_recorded_viewport, |
| 48 Region* invalidation) { | 49 Region* invalidation) { |
| 49 // Invalidate newly-exposed and no-longer-exposed areas. | 50 // Invalidate newly-exposed and no-longer-exposed areas. |
| 50 Region newly_exposed_region(new_recorded_viewport); | 51 Region newly_exposed_region(new_recorded_viewport); |
| 51 newly_exposed_region.Subtract(old_recorded_viewport); | 52 newly_exposed_region.Subtract(old_recorded_viewport); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 134 } |
| 134 | 135 |
| 135 const DisplayItemList* RecordingSource::GetDisplayItemList() { | 136 const DisplayItemList* RecordingSource::GetDisplayItemList() { |
| 136 return display_list_.get(); | 137 return display_list_.get(); |
| 137 } | 138 } |
| 138 | 139 |
| 139 scoped_refptr<RasterSource> RecordingSource::CreateRasterSource() const { | 140 scoped_refptr<RasterSource> RecordingSource::CreateRasterSource() const { |
| 140 return scoped_refptr<RasterSource>(new RasterSource(this)); | 141 return scoped_refptr<RasterSource>(new RasterSource(this)); |
| 141 } | 142 } |
| 142 | 143 |
| 144 void RecordingSource::SetRecordingScaleFactor(float recording_scale_factor) { |
| 145 recording_scale_factor_ = recording_scale_factor; |
| 146 } |
| 147 |
| 143 void RecordingSource::DetermineIfSolidColor() { | 148 void RecordingSource::DetermineIfSolidColor() { |
| 144 DCHECK(display_list_); | 149 DCHECK(display_list_); |
| 145 is_solid_color_ = false; | 150 is_solid_color_ = false; |
| 146 solid_color_ = SK_ColorTRANSPARENT; | 151 solid_color_ = SK_ColorTRANSPARENT; |
| 147 | 152 |
| 148 if (display_list_->op_count() > kMaxOpsToAnalyzeForLayer) | 153 if (display_list_->op_count() > kMaxOpsToAnalyzeForLayer) |
| 149 return; | 154 return; |
| 150 | 155 |
| 151 TRACE_EVENT1("cc", "RecordingSource::DetermineIfSolidColor", "opcount", | 156 TRACE_EVENT1("cc", "RecordingSource::DetermineIfSolidColor", "opcount", |
| 152 display_list_->op_count()); | 157 display_list_->op_count()); |
| 153 is_solid_color_ = display_list_->GetColorIfSolidInRect( | 158 is_solid_color_ = display_list_->GetColorIfSolidInRect( |
| 154 gfx::Rect(GetSize()), &solid_color_, kMaxOpsToAnalyzeForLayer); | 159 gfx::Rect(GetSize()), &solid_color_, kMaxOpsToAnalyzeForLayer); |
| 155 } | 160 } |
| 156 | 161 |
| 157 } // namespace cc | 162 } // namespace cc |
| OLD | NEW |