| 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/display_list_raster_source.h" | 5 #include "cc/playback/display_list_raster_source.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
| 9 #include "cc/debug/debug_colors.h" | 9 #include "cc/debug/debug_colors.h" |
| 10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
| 11 #include "cc/playback/raster_source_helper.h" | 11 #include "cc/playback/raster_source_helper.h" |
| 12 #include "skia/ext/analysis_canvas.h" | 12 #include "skia/ext/analysis_canvas.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkPictureRecorder.h" | 14 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 15 #include "ui/gfx/geometry/rect_conversions.h" | 15 #include "ui/gfx/geometry/rect_conversions.h" |
| 16 | 16 |
| 17 namespace { | |
| 18 | |
| 19 #ifdef NDEBUG | |
| 20 const bool kDefaultClearCanvasSetting = false; | |
| 21 #else | |
| 22 const bool kDefaultClearCanvasSetting = true; | |
| 23 #endif | |
| 24 | |
| 25 } // namespace | |
| 26 | |
| 27 namespace cc { | 17 namespace cc { |
| 28 | 18 |
| 29 scoped_refptr<DisplayListRasterSource> | 19 scoped_refptr<DisplayListRasterSource> |
| 30 DisplayListRasterSource::CreateFromDisplayListRecordingSource( | 20 DisplayListRasterSource::CreateFromDisplayListRecordingSource( |
| 31 const DisplayListRecordingSource* other, | 21 const DisplayListRecordingSource* other, |
| 32 bool can_use_lcd_text) { | 22 bool can_use_lcd_text) { |
| 33 return make_scoped_refptr( | 23 return make_scoped_refptr( |
| 34 new DisplayListRasterSource(other, can_use_lcd_text)); | 24 new DisplayListRasterSource(other, can_use_lcd_text)); |
| 35 } | 25 } |
| 36 | 26 |
| 37 DisplayListRasterSource::DisplayListRasterSource() | 27 DisplayListRasterSource::DisplayListRasterSource() |
| 38 : background_color_(SK_ColorTRANSPARENT), | 28 : background_color_(SK_ColorTRANSPARENT), |
| 39 requires_clear_(true), | 29 requires_clear_(true), |
| 40 can_use_lcd_text_(true), | 30 can_use_lcd_text_(true), |
| 41 is_solid_color_(false), | 31 is_solid_color_(false), |
| 42 solid_color_(SK_ColorTRANSPARENT), | 32 solid_color_(SK_ColorTRANSPARENT), |
| 43 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), | 33 clear_canvas_with_debug_color_(false), |
| 44 slow_down_raster_scale_factor_for_debug_(0), | 34 slow_down_raster_scale_factor_for_debug_(0), |
| 45 should_attempt_to_use_distance_field_text_(false) { | 35 should_attempt_to_use_distance_field_text_(false) { |
| 46 } | 36 } |
| 47 | 37 |
| 48 DisplayListRasterSource::DisplayListRasterSource( | 38 DisplayListRasterSource::DisplayListRasterSource( |
| 49 const DisplayListRecordingSource* other, | 39 const DisplayListRecordingSource* other, |
| 50 bool can_use_lcd_text) | 40 bool can_use_lcd_text) |
| 51 : display_list_(other->display_list_), | 41 : display_list_(other->display_list_), |
| 52 background_color_(other->background_color_), | 42 background_color_(other->background_color_), |
| 53 requires_clear_(other->requires_clear_), | 43 requires_clear_(other->requires_clear_), |
| 54 can_use_lcd_text_(can_use_lcd_text), | 44 can_use_lcd_text_(can_use_lcd_text), |
| 55 is_solid_color_(other->is_solid_color_), | 45 is_solid_color_(other->is_solid_color_), |
| 56 solid_color_(other->solid_color_), | 46 solid_color_(other->solid_color_), |
| 57 recorded_viewport_(other->recorded_viewport_), | 47 recorded_viewport_(other->recorded_viewport_), |
| 58 size_(other->size_), | 48 size_(other->size_), |
| 59 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), | 49 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), |
| 60 slow_down_raster_scale_factor_for_debug_( | 50 slow_down_raster_scale_factor_for_debug_( |
| 61 other->slow_down_raster_scale_factor_for_debug_), | 51 other->slow_down_raster_scale_factor_for_debug_), |
| 62 should_attempt_to_use_distance_field_text_(false) { | 52 should_attempt_to_use_distance_field_text_(false) { |
| 63 } | 53 } |
| 64 | 54 |
| 65 DisplayListRasterSource::DisplayListRasterSource( | 55 DisplayListRasterSource::DisplayListRasterSource( |
| 66 const DisplayListRasterSource* other, | 56 const DisplayListRasterSource* other, |
| 67 bool can_use_lcd_text) | 57 bool can_use_lcd_text) |
| 68 : display_list_(other->display_list_), | 58 : display_list_(other->display_list_), |
| 69 background_color_(other->background_color_), | 59 background_color_(other->background_color_), |
| 70 requires_clear_(other->requires_clear_), | 60 requires_clear_(other->requires_clear_), |
| 71 can_use_lcd_text_(can_use_lcd_text), | 61 can_use_lcd_text_(can_use_lcd_text), |
| 72 is_solid_color_(other->is_solid_color_), | 62 is_solid_color_(other->is_solid_color_), |
| 73 solid_color_(other->solid_color_), | 63 solid_color_(other->solid_color_), |
| 74 recorded_viewport_(other->recorded_viewport_), | 64 recorded_viewport_(other->recorded_viewport_), |
| 75 size_(other->size_), | 65 size_(other->size_), |
| 76 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), | 66 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), |
| 77 slow_down_raster_scale_factor_for_debug_( | 67 slow_down_raster_scale_factor_for_debug_( |
| 78 other->slow_down_raster_scale_factor_for_debug_), | 68 other->slow_down_raster_scale_factor_for_debug_), |
| 79 should_attempt_to_use_distance_field_text_( | 69 should_attempt_to_use_distance_field_text_( |
| 80 other->should_attempt_to_use_distance_field_text_) { | 70 other->should_attempt_to_use_distance_field_text_) { |
| 81 } | 71 } |
| 82 | 72 |
| 83 DisplayListRasterSource::~DisplayListRasterSource() { | 73 DisplayListRasterSource::~DisplayListRasterSource() { |
| 84 } | 74 } |
| 85 | 75 |
| 86 void DisplayListRasterSource::PlaybackToSharedCanvas( | 76 void DisplayListRasterSource::PlaybackToSharedCanvas( |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 222 } |
| 233 | 223 |
| 234 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() | 224 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() |
| 235 const { | 225 const { |
| 236 bool can_use_lcd_text = false; | 226 bool can_use_lcd_text = false; |
| 237 return scoped_refptr<RasterSource>( | 227 return scoped_refptr<RasterSource>( |
| 238 new DisplayListRasterSource(this, can_use_lcd_text)); | 228 new DisplayListRasterSource(this, can_use_lcd_text)); |
| 239 } | 229 } |
| 240 | 230 |
| 241 } // namespace cc | 231 } // namespace cc |
| OLD | NEW |