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 16 matching lines...) Expand all Loading... |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 | 30 |
31 RecordingSource::RecordingSource() | 31 RecordingSource::RecordingSource() |
32 : slow_down_raster_scale_factor_for_debug_(0), | 32 : slow_down_raster_scale_factor_for_debug_(0), |
33 requires_clear_(false), | 33 requires_clear_(false), |
34 is_solid_color_(false), | 34 is_solid_color_(false), |
35 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), | 35 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), |
36 solid_color_(SK_ColorTRANSPARENT), | 36 solid_color_(SK_ColorTRANSPARENT), |
37 background_color_(SK_ColorTRANSPARENT) {} | 37 background_color_(SK_ColorTRANSPARENT), |
| 38 recording_scale_factor_(1.f) {} |
38 | 39 |
39 RecordingSource::~RecordingSource() {} | 40 RecordingSource::~RecordingSource() {} |
40 | 41 |
41 void RecordingSource::UpdateInvalidationForNewViewport( | 42 void RecordingSource::UpdateInvalidationForNewViewport( |
42 const gfx::Rect& old_recorded_viewport, | 43 const gfx::Rect& old_recorded_viewport, |
43 const gfx::Rect& new_recorded_viewport, | 44 const gfx::Rect& new_recorded_viewport, |
44 Region* invalidation) { | 45 Region* invalidation) { |
45 // Invalidate newly-exposed and no-longer-exposed areas. | 46 // Invalidate newly-exposed and no-longer-exposed areas. |
46 Region newly_exposed_region(new_recorded_viewport); | 47 Region newly_exposed_region(new_recorded_viewport); |
47 newly_exposed_region.Subtract(old_recorded_viewport); | 48 newly_exposed_region.Subtract(old_recorded_viewport); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 126 } |
126 | 127 |
127 void RecordingSource::SetRequiresClear(bool requires_clear) { | 128 void RecordingSource::SetRequiresClear(bool requires_clear) { |
128 requires_clear_ = requires_clear; | 129 requires_clear_ = requires_clear; |
129 } | 130 } |
130 | 131 |
131 const DisplayItemList* RecordingSource::GetDisplayItemList() { | 132 const DisplayItemList* RecordingSource::GetDisplayItemList() { |
132 return display_list_.get(); | 133 return display_list_.get(); |
133 } | 134 } |
134 | 135 |
| 136 void RecordingSource::SetRecordingScaleFactor(float recording_scale_factor) { |
| 137 recording_scale_factor_ = recording_scale_factor; |
| 138 } |
| 139 |
135 scoped_refptr<RasterSource> RecordingSource::CreateRasterSource( | 140 scoped_refptr<RasterSource> RecordingSource::CreateRasterSource( |
136 bool can_use_lcd_text) const { | 141 bool can_use_lcd_text) const { |
137 return scoped_refptr<RasterSource>( | 142 return scoped_refptr<RasterSource>( |
138 RasterSource::CreateFromRecordingSource(this, can_use_lcd_text)); | 143 RasterSource::CreateFromRecordingSource(this, can_use_lcd_text)); |
139 } | 144 } |
140 | 145 |
141 void RecordingSource::DetermineIfSolidColor() { | 146 void RecordingSource::DetermineIfSolidColor() { |
142 DCHECK(display_list_); | 147 DCHECK(display_list_); |
143 is_solid_color_ = false; | 148 is_solid_color_ = false; |
144 solid_color_ = SK_ColorTRANSPARENT; | 149 solid_color_ = SK_ColorTRANSPARENT; |
145 | 150 |
146 // TODO(vmpstr): We can probably remove this check. | 151 // TODO(vmpstr): We can probably remove this check. |
147 if (!display_list_->ShouldBeAnalyzedForSolidColor()) | 152 if (!display_list_->ShouldBeAnalyzedForSolidColor()) |
148 return; | 153 return; |
149 | 154 |
150 TRACE_EVENT1("cc", "RecordingSource::DetermineIfSolidColor", "opcount", | 155 TRACE_EVENT1("cc", "RecordingSource::DetermineIfSolidColor", "opcount", |
151 display_list_->op_count()); | 156 display_list_->op_count()); |
152 is_solid_color_ = | 157 is_solid_color_ = |
153 display_list_->GetColorIfSolidInRect(gfx::Rect(GetSize()), &solid_color_); | 158 display_list_->GetColorIfSolidInRect(gfx::Rect(GetSize()), &solid_color_); |
154 } | 159 } |
155 | 160 |
156 } // namespace cc | 161 } // namespace cc |
OLD | NEW |