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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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())); |
59 updated = true; | 59 updated = true; |
60 } | 60 } |
61 | 61 |
62 gfx::Rect old_recorded_viewport = recorded_viewport_; | 62 gfx::Rect old_recorded_viewport = recorded_viewport_; |
63 recorded_viewport_ = visible_layer_rect; | 63 // TODO(wangxianzhu): Blink slimming paint doesn't support incremental |
64 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_); | 64 // painting for now so we must record for the whole layer. Should measure |
65 recorded_viewport_.Intersect(gfx::Rect(GetSize())); | 65 // performance and determine the best choice. Consider display item caching. |
| 66 recorded_viewport_ = gfx::Rect(GetSize()); |
66 | 67 |
67 if (recorded_viewport_ != old_recorded_viewport) { | 68 if (recorded_viewport_ != old_recorded_viewport) { |
68 // Invalidate newly-exposed and no-longer-exposed areas. | 69 // Invalidate newly-exposed and no-longer-exposed areas. |
69 Region newly_exposed_region(recorded_viewport_); | 70 Region newly_exposed_region(recorded_viewport_); |
70 newly_exposed_region.Subtract(old_recorded_viewport); | 71 newly_exposed_region.Subtract(old_recorded_viewport); |
71 invalidation->Union(newly_exposed_region); | 72 invalidation->Union(newly_exposed_region); |
72 | 73 |
73 Region no_longer_exposed_region(old_recorded_viewport); | 74 Region no_longer_exposed_region(old_recorded_viewport); |
74 no_longer_exposed_region.Subtract(recorded_viewport_); | 75 no_longer_exposed_region.Subtract(recorded_viewport_); |
75 invalidation->Union(no_longer_exposed_region); | 76 invalidation->Union(no_longer_exposed_region); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 150 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
150 } | 151 } |
151 | 152 |
152 void DisplayListRecordingSource::Clear() { | 153 void DisplayListRecordingSource::Clear() { |
153 recorded_viewport_ = gfx::Rect(); | 154 recorded_viewport_ = gfx::Rect(); |
154 display_list_ = NULL; | 155 display_list_ = NULL; |
155 is_solid_color_ = false; | 156 is_solid_color_ = false; |
156 } | 157 } |
157 | 158 |
158 } // namespace cc | 159 } // namespace cc |
OLD | NEW |