Chromium Code Reviews| 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_recording_source.h" | 5 #include "cc/playback/display_list_recording_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
| 10 #include "cc/base/histograms.h" | 10 #include "cc/base/histograms.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 SizeToProto(size_, proto->mutable_size()); | 52 SizeToProto(size_, proto->mutable_size()); |
| 53 proto->set_slow_down_raster_scale_factor_for_debug( | 53 proto->set_slow_down_raster_scale_factor_for_debug( |
| 54 slow_down_raster_scale_factor_for_debug_); | 54 slow_down_raster_scale_factor_for_debug_); |
| 55 proto->set_generate_discardable_images_metadata( | 55 proto->set_generate_discardable_images_metadata( |
| 56 generate_discardable_images_metadata_); | 56 generate_discardable_images_metadata_); |
| 57 proto->set_requires_clear(requires_clear_); | 57 proto->set_requires_clear(requires_clear_); |
| 58 proto->set_is_solid_color(is_solid_color_); | 58 proto->set_is_solid_color(is_solid_color_); |
| 59 proto->set_clear_canvas_with_debug_color(clear_canvas_with_debug_color_); | 59 proto->set_clear_canvas_with_debug_color(clear_canvas_with_debug_color_); |
| 60 proto->set_solid_color(static_cast<uint64_t>(solid_color_)); | 60 proto->set_solid_color(static_cast<uint64_t>(solid_color_)); |
| 61 proto->set_background_color(static_cast<uint64_t>(background_color_)); | 61 proto->set_background_color(static_cast<uint64_t>(background_color_)); |
| 62 display_list_->ToProtobuf(proto->mutable_display_list()); | 62 if (display_list_) |
| 63 display_list_->ToProtobuf(proto->mutable_display_list()); | |
| 63 } | 64 } |
| 64 | 65 |
| 65 void DisplayListRecordingSource::FromProtobuf( | 66 void DisplayListRecordingSource::FromProtobuf( |
| 66 const proto::DisplayListRecordingSource& proto) { | 67 const proto::DisplayListRecordingSource& proto) { |
| 67 recorded_viewport_ = ProtoToRect(proto.recorded_viewport()); | 68 recorded_viewport_ = ProtoToRect(proto.recorded_viewport()); |
| 68 size_ = ProtoToSize(proto.size()); | 69 size_ = ProtoToSize(proto.size()); |
| 69 slow_down_raster_scale_factor_for_debug_ = | 70 slow_down_raster_scale_factor_for_debug_ = |
| 70 proto.slow_down_raster_scale_factor_for_debug(); | 71 proto.slow_down_raster_scale_factor_for_debug(); |
| 71 generate_discardable_images_metadata_ = | 72 generate_discardable_images_metadata_ = |
| 72 proto.generate_discardable_images_metadata(); | 73 proto.generate_discardable_images_metadata(); |
| 73 requires_clear_ = proto.requires_clear(); | 74 requires_clear_ = proto.requires_clear(); |
| 74 is_solid_color_ = proto.is_solid_color(); | 75 is_solid_color_ = proto.is_solid_color(); |
| 75 clear_canvas_with_debug_color_ = proto.clear_canvas_with_debug_color(); | 76 clear_canvas_with_debug_color_ = proto.clear_canvas_with_debug_color(); |
| 76 solid_color_ = static_cast<SkColor>(proto.solid_color()); | 77 solid_color_ = static_cast<SkColor>(proto.solid_color()); |
| 77 background_color_ = static_cast<SkColor>(proto.background_color()); | 78 background_color_ = static_cast<SkColor>(proto.background_color()); |
| 78 display_list_ = DisplayItemList::CreateFromProto(proto.display_list()); | 79 if (proto.has_display_list()) { |
|
vmpstr
2015/12/16 04:21:08
When would it not? Can you leave a comment?
David Trainor- moved to gerrit
2015/12/16 19:10:58
If we serialized an empty RecordingSource (which h
| |
| 79 | 80 display_list_ = DisplayItemList::CreateFromProto(proto.display_list()); |
| 80 FinishDisplayItemListUpdate(); | 81 FinishDisplayItemListUpdate(); |
| 82 } else { | |
| 83 display_list_ = nullptr; | |
| 84 } | |
| 81 } | 85 } |
| 82 | 86 |
| 83 void DisplayListRecordingSource::UpdateInvalidationForNewViewport( | 87 void DisplayListRecordingSource::UpdateInvalidationForNewViewport( |
| 84 const gfx::Rect& old_recorded_viewport, | 88 const gfx::Rect& old_recorded_viewport, |
| 85 const gfx::Rect& new_recorded_viewport, | 89 const gfx::Rect& new_recorded_viewport, |
| 86 Region* invalidation) { | 90 Region* invalidation) { |
| 87 // Invalidate newly-exposed and no-longer-exposed areas. | 91 // Invalidate newly-exposed and no-longer-exposed areas. |
| 88 Region newly_exposed_region(new_recorded_viewport); | 92 Region newly_exposed_region(new_recorded_viewport); |
| 89 newly_exposed_region.Subtract(old_recorded_viewport); | 93 newly_exposed_region.Subtract(old_recorded_viewport); |
| 90 invalidation->Union(newly_exposed_region); | 94 invalidation->Union(newly_exposed_region); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 225 } |
| 222 | 226 |
| 223 void DisplayListRecordingSource::Clear() { | 227 void DisplayListRecordingSource::Clear() { |
| 224 recorded_viewport_ = gfx::Rect(); | 228 recorded_viewport_ = gfx::Rect(); |
| 225 display_list_ = nullptr; | 229 display_list_ = nullptr; |
| 226 painter_reported_memory_usage_ = 0; | 230 painter_reported_memory_usage_ = 0; |
| 227 is_solid_color_ = false; | 231 is_solid_color_ = false; |
| 228 } | 232 } |
| 229 | 233 |
| 230 } // namespace cc | 234 } // namespace cc |
| OLD | NEW |