| 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 // TODO(wangxianzhu): Blink slimming paint doesn't support incremental | 63 recorded_viewport_ = visible_layer_rect; |
| 64 // painting for now so we must record for the whole layer. Should measure | 64 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_); |
| 65 // performance and determine the best choice. Consider display item caching. | 65 recorded_viewport_.Intersect(gfx::Rect(GetSize())); |
| 66 recorded_viewport_ = gfx::Rect(GetSize()); | |
| 67 | 66 |
| 68 if (recorded_viewport_ != old_recorded_viewport) { | 67 if (recorded_viewport_ != old_recorded_viewport) { |
| 69 // Invalidate newly-exposed and no-longer-exposed areas. | 68 // Invalidate newly-exposed and no-longer-exposed areas. |
| 70 Region newly_exposed_region(recorded_viewport_); | 69 Region newly_exposed_region(recorded_viewport_); |
| 71 newly_exposed_region.Subtract(old_recorded_viewport); | 70 newly_exposed_region.Subtract(old_recorded_viewport); |
| 72 invalidation->Union(newly_exposed_region); | 71 invalidation->Union(newly_exposed_region); |
| 73 | 72 |
| 74 Region no_longer_exposed_region(old_recorded_viewport); | 73 Region no_longer_exposed_region(old_recorded_viewport); |
| 75 no_longer_exposed_region.Subtract(recorded_viewport_); | 74 no_longer_exposed_region.Subtract(recorded_viewport_); |
| 76 invalidation->Union(no_longer_exposed_region); | 75 invalidation->Union(no_longer_exposed_region); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 166 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
| 168 } | 167 } |
| 169 | 168 |
| 170 void DisplayListRecordingSource::Clear() { | 169 void DisplayListRecordingSource::Clear() { |
| 171 recorded_viewport_ = gfx::Rect(); | 170 recorded_viewport_ = gfx::Rect(); |
| 172 display_list_ = NULL; | 171 display_list_ = NULL; |
| 173 is_solid_color_ = false; | 172 is_solid_color_ = false; |
| 174 } | 173 } |
| 175 | 174 |
| 176 } // namespace cc | 175 } // namespace cc |
| OLD | NEW |