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/resources/display_list_recording_source.h" | 5 #include "cc/resources/display_list_recording_source.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 DisplayListRecordingSource::~DisplayListRecordingSource() { | 38 DisplayListRecordingSource::~DisplayListRecordingSource() { |
39 } | 39 } |
40 | 40 |
41 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( | 41 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( |
42 ContentLayerClient* painter, | 42 ContentLayerClient* painter, |
43 Region* invalidation, | 43 Region* invalidation, |
44 bool can_use_lcd_text, | 44 bool can_use_lcd_text, |
45 const gfx::Size& layer_size, | 45 const gfx::Size& layer_size, |
46 const gfx::Rect& visible_layer_rect, | 46 const gfx::Rect& visible_layer_rect, |
47 int frame_number, | 47 int frame_number, |
48 Picture::RecordingMode recording_mode) { | 48 RecordingMode recording_mode) { |
49 bool updated = false; | 49 bool updated = false; |
50 | 50 |
51 if (size_ != layer_size) { | 51 if (size_ != layer_size) { |
52 size_ = layer_size; | 52 size_ = layer_size; |
53 updated = true; | 53 updated = true; |
54 } | 54 } |
55 | 55 |
56 if (can_use_lcd_text_ != can_use_lcd_text) { | 56 if (can_use_lcd_text_ != can_use_lcd_text) { |
57 can_use_lcd_text_ = can_use_lcd_text; | 57 can_use_lcd_text_ = can_use_lcd_text; |
58 invalidation->Union(gfx::Rect(GetSize())); | 58 invalidation->Union(gfx::Rect(GetSize())); |
(...skipping 15 matching lines...) Expand all Loading... | |
74 Region no_longer_exposed_region(old_recorded_viewport); | 74 Region no_longer_exposed_region(old_recorded_viewport); |
75 no_longer_exposed_region.Subtract(recorded_viewport_); | 75 no_longer_exposed_region.Subtract(recorded_viewport_); |
76 invalidation->Union(no_longer_exposed_region); | 76 invalidation->Union(no_longer_exposed_region); |
77 | 77 |
78 updated = true; | 78 updated = true; |
79 } | 79 } |
80 | 80 |
81 if (!updated && !invalidation->Intersects(recorded_viewport_)) | 81 if (!updated && !invalidation->Intersects(recorded_viewport_)) |
82 return false; | 82 return false; |
83 | 83 |
84 // TODO(ajuma): Does repeating this way really makes sense with display lists? | 84 ContentLayerClient::PaintingControlSetting painting_control = |
85 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL; | |
86 | |
87 switch (recording_mode) { | |
88 case RECORD_NORMALLY: | |
89 // Already setup for normal recording. | |
90 break; | |
91 case RECORD_WITH_SK_NULL_CANVAS: | |
92 // TODO(schenney): Remove this when DisplayList recording is the only | |
93 // option. For now, fall through and disable construction. | |
94 case RECORD_WITH_PAINTING_DISABLED: | |
95 painting_control = ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED; | |
96 break; | |
97 case RECORD_WITH_CACHING_DISABLED: | |
98 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED; | |
99 break; | |
100 default: | |
101 NOTREACHED(); | |
102 } | |
103 | |
104 // TODO(ajuma): Does repeating this way really make sense with display lists? | |
85 // With Blink caching recordings, repeated calls will not cause re-recording. | 105 // With Blink caching recordings, repeated calls will not cause re-recording. |
ajuma
2015/02/04 22:47:33
This TODO can be removed now that we're choosing w
Stephen Chennney
2015/02/05 14:57:42
I reworked the logic to force non-caching if the r
| |
86 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); | 106 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); |
87 for (int i = 0; i < repeat_count; ++i) { | 107 for (int i = 0; i < repeat_count; ++i) { |
88 display_list_ = painter->PaintContentsToDisplayList( | 108 display_list_ = painter->PaintContentsToDisplayList(recorded_viewport_, |
89 recorded_viewport_, ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); | 109 painting_control); |
90 } | 110 } |
91 display_list_->set_layer_rect(recorded_viewport_); | 111 display_list_->set_layer_rect(recorded_viewport_); |
92 is_suitable_for_gpu_rasterization_ = | 112 is_suitable_for_gpu_rasterization_ = |
93 display_list_->IsSuitableForGpuRasterization(); | 113 display_list_->IsSuitableForGpuRasterization(); |
94 | 114 |
95 DetermineIfSolidColor(); | 115 DetermineIfSolidColor(); |
96 display_list_->EmitTraceSnapshot(); | 116 display_list_->EmitTraceSnapshot(); |
97 return true; | 117 return true; |
98 } | 118 } |
99 | 119 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 162 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
143 } | 163 } |
144 | 164 |
145 void DisplayListRecordingSource::Clear() { | 165 void DisplayListRecordingSource::Clear() { |
146 recorded_viewport_ = gfx::Rect(); | 166 recorded_viewport_ = gfx::Rect(); |
147 display_list_ = NULL; | 167 display_list_ = NULL; |
148 is_solid_color_ = false; | 168 is_solid_color_ = false; |
149 } | 169 } |
150 | 170 |
151 } // namespace cc | 171 } // namespace cc |
OLD | NEW |