| 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_cache_(nullptr) {} | 43 image_decode_cache_(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_cache_(other->image_decode_cache_) {} | 58 image_decode_cache_(other->image_decode_cache_) {} |
| 62 | 59 |
| 63 RasterSource::~RasterSource() { | 60 RasterSource::~RasterSource() { |
| 64 } | 61 } |
| 65 | 62 |
| 66 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, | 63 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, |
| 67 const gfx::Rect& canvas_bitmap_rect, | 64 const gfx::Rect& canvas_bitmap_rect, |
| 68 const gfx::Rect& canvas_playback_rect, | 65 const gfx::Rect& canvas_playback_rect, |
| 69 const gfx::SizeF& raster_scales, | 66 const gfx::SizeF& raster_scales, |
| 70 const PlaybackSettings& settings) const { | 67 const PlaybackSettings& settings) const { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 267 } |
| 271 | 268 |
| 272 bool RasterSource::HasRecordings() const { | 269 bool RasterSource::HasRecordings() const { |
| 273 return !!display_list_.get(); | 270 return !!display_list_.get(); |
| 274 } | 271 } |
| 275 | 272 |
| 276 gfx::Rect RasterSource::RecordedViewport() const { | 273 gfx::Rect RasterSource::RecordedViewport() const { |
| 277 return recorded_viewport_; | 274 return recorded_viewport_; |
| 278 } | 275 } |
| 279 | 276 |
| 280 void RasterSource::SetShouldAttemptToUseDistanceFieldText() { | |
| 281 should_attempt_to_use_distance_field_text_ = true; | |
| 282 } | |
| 283 | |
| 284 bool RasterSource::ShouldAttemptToUseDistanceFieldText() const { | |
| 285 return should_attempt_to_use_distance_field_text_; | |
| 286 } | |
| 287 | |
| 288 void RasterSource::AsValueInto(base::trace_event::TracedValue* array) const { | 277 void RasterSource::AsValueInto(base::trace_event::TracedValue* array) const { |
| 289 if (display_list_.get()) | 278 if (display_list_.get()) |
| 290 TracedValue::AppendIDRef(display_list_.get(), array); | 279 TracedValue::AppendIDRef(display_list_.get(), array); |
| 291 } | 280 } |
| 292 | 281 |
| 293 void RasterSource::DidBeginTracing() { | 282 void RasterSource::DidBeginTracing() { |
| 294 if (display_list_.get()) | 283 if (display_list_.get()) |
| 295 display_list_->EmitTraceSnapshot(); | 284 display_list_->EmitTraceSnapshot(); |
| 296 } | 285 } |
| 297 | 286 |
| 298 bool RasterSource::CanUseLCDText() const { | 287 bool RasterSource::CanUseLCDText() const { |
| 299 return can_use_lcd_text_; | 288 return can_use_lcd_text_; |
| 300 } | 289 } |
| 301 | 290 |
| 302 scoped_refptr<RasterSource> RasterSource::CreateCloneWithoutLCDText() const { | 291 scoped_refptr<RasterSource> RasterSource::CreateCloneWithoutLCDText() const { |
| 303 bool can_use_lcd_text = false; | 292 bool can_use_lcd_text = false; |
| 304 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); | 293 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); |
| 305 } | 294 } |
| 306 | 295 |
| 307 RasterSource::PlaybackSettings::PlaybackSettings() | 296 RasterSource::PlaybackSettings::PlaybackSettings() |
| 308 : playback_to_shared_canvas(false), | 297 : playback_to_shared_canvas(false), |
| 309 skip_images(false), | 298 skip_images(false), |
| 310 use_image_hijack_canvas(true) {} | 299 use_image_hijack_canvas(true) {} |
| 311 | 300 |
| 312 } // namespace cc | 301 } // namespace cc |
| OLD | NEW |