| 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/playback/raster_source.h" | 5 #include "cc/playback/raster_source.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 background_color_(other->background_color_), | 33 background_color_(other->background_color_), |
| 34 requires_clear_(other->requires_clear_), | 34 requires_clear_(other->requires_clear_), |
| 35 can_use_lcd_text_(can_use_lcd_text), | 35 can_use_lcd_text_(can_use_lcd_text), |
| 36 is_solid_color_(other->is_solid_color_), | 36 is_solid_color_(other->is_solid_color_), |
| 37 solid_color_(other->solid_color_), | 37 solid_color_(other->solid_color_), |
| 38 recorded_viewport_(other->recorded_viewport_), | 38 recorded_viewport_(other->recorded_viewport_), |
| 39 size_(other->size_), | 39 size_(other->size_), |
| 40 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), | 40 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), |
| 41 slow_down_raster_scale_factor_for_debug_( | 41 slow_down_raster_scale_factor_for_debug_( |
| 42 other->slow_down_raster_scale_factor_for_debug_), | 42 other->slow_down_raster_scale_factor_for_debug_), |
| 43 should_attempt_to_use_distance_field_text_(false), | |
| 44 image_decode_controller_(nullptr) {} | 43 image_decode_controller_(nullptr) {} |
| 45 | 44 |
| 46 RasterSource::RasterSource(const RasterSource* other, bool can_use_lcd_text) | 45 RasterSource::RasterSource(const RasterSource* other, bool can_use_lcd_text) |
| 47 : display_list_(other->display_list_), | 46 : display_list_(other->display_list_), |
| 48 painter_reported_memory_usage_(other->painter_reported_memory_usage_), | 47 painter_reported_memory_usage_(other->painter_reported_memory_usage_), |
| 49 background_color_(other->background_color_), | 48 background_color_(other->background_color_), |
| 50 requires_clear_(other->requires_clear_), | 49 requires_clear_(other->requires_clear_), |
| 51 can_use_lcd_text_(can_use_lcd_text), | 50 can_use_lcd_text_(can_use_lcd_text), |
| 52 is_solid_color_(other->is_solid_color_), | 51 is_solid_color_(other->is_solid_color_), |
| 53 solid_color_(other->solid_color_), | 52 solid_color_(other->solid_color_), |
| 54 recorded_viewport_(other->recorded_viewport_), | 53 recorded_viewport_(other->recorded_viewport_), |
| 55 size_(other->size_), | 54 size_(other->size_), |
| 56 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), | 55 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), |
| 57 slow_down_raster_scale_factor_for_debug_( | 56 slow_down_raster_scale_factor_for_debug_( |
| 58 other->slow_down_raster_scale_factor_for_debug_), | 57 other->slow_down_raster_scale_factor_for_debug_), |
| 59 should_attempt_to_use_distance_field_text_( | |
| 60 other->should_attempt_to_use_distance_field_text_), | |
| 61 image_decode_controller_(other->image_decode_controller_) { | 58 image_decode_controller_(other->image_decode_controller_) { |
| 62 } | 59 } |
| 63 | 60 |
| 64 RasterSource::~RasterSource() { | 61 RasterSource::~RasterSource() { |
| 65 } | 62 } |
| 66 | 63 |
| 67 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, | 64 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, |
| 68 const gfx::Rect& canvas_bitmap_rect, | 65 const gfx::Rect& canvas_bitmap_rect, |
| 69 const gfx::Rect& canvas_playback_rect, | 66 const gfx::Rect& canvas_playback_rect, |
| 70 const gfx::SizeF& raster_scales, | 67 const gfx::SizeF& raster_scales, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 261 } |
| 265 | 262 |
| 266 bool RasterSource::HasRecordings() const { | 263 bool RasterSource::HasRecordings() const { |
| 267 return !!display_list_.get(); | 264 return !!display_list_.get(); |
| 268 } | 265 } |
| 269 | 266 |
| 270 gfx::Rect RasterSource::RecordedViewport() const { | 267 gfx::Rect RasterSource::RecordedViewport() const { |
| 271 return recorded_viewport_; | 268 return recorded_viewport_; |
| 272 } | 269 } |
| 273 | 270 |
| 274 void RasterSource::SetShouldAttemptToUseDistanceFieldText() { | |
| 275 should_attempt_to_use_distance_field_text_ = true; | |
| 276 } | |
| 277 | |
| 278 bool RasterSource::ShouldAttemptToUseDistanceFieldText() const { | |
| 279 return should_attempt_to_use_distance_field_text_; | |
| 280 } | |
| 281 | |
| 282 void RasterSource::AsValueInto(base::trace_event::TracedValue* array) const { | 271 void RasterSource::AsValueInto(base::trace_event::TracedValue* array) const { |
| 283 if (display_list_.get()) | 272 if (display_list_.get()) |
| 284 TracedValue::AppendIDRef(display_list_.get(), array); | 273 TracedValue::AppendIDRef(display_list_.get(), array); |
| 285 } | 274 } |
| 286 | 275 |
| 287 void RasterSource::DidBeginTracing() { | 276 void RasterSource::DidBeginTracing() { |
| 288 if (display_list_.get()) | 277 if (display_list_.get()) |
| 289 display_list_->EmitTraceSnapshot(); | 278 display_list_->EmitTraceSnapshot(); |
| 290 } | 279 } |
| 291 | 280 |
| 292 bool RasterSource::CanUseLCDText() const { | 281 bool RasterSource::CanUseLCDText() const { |
| 293 return can_use_lcd_text_; | 282 return can_use_lcd_text_; |
| 294 } | 283 } |
| 295 | 284 |
| 296 scoped_refptr<RasterSource> RasterSource::CreateCloneWithoutLCDText() const { | 285 scoped_refptr<RasterSource> RasterSource::CreateCloneWithoutLCDText() const { |
| 297 bool can_use_lcd_text = false; | 286 bool can_use_lcd_text = false; |
| 298 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); | 287 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); |
| 299 } | 288 } |
| 300 | 289 |
| 301 RasterSource::PlaybackSettings::PlaybackSettings() | 290 RasterSource::PlaybackSettings::PlaybackSettings() |
| 302 : playback_to_shared_canvas(false), | 291 : playback_to_shared_canvas(false), |
| 303 skip_images(false), | 292 skip_images(false), |
| 304 use_image_hijack_canvas(true) {} | 293 use_image_hijack_canvas(true) {} |
| 305 | 294 |
| 306 } // namespace cc | 295 } // namespace cc |
| OLD | NEW |