OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
| 7 #include "base/auto_reset.h" |
7 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
10 #include "third_party/skia/include/core/SkPictureRecorder.h" | 11 #include "third_party/skia/include/core/SkPictureRecorder.h" |
11 #include "ui/gfx/rect_conversions.h" | 12 #include "ui/gfx/rect_conversions.h" |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { | 16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
16 return make_scoped_refptr(new PictureLayer(client)); | 17 return make_scoped_refptr(new PictureLayer(client)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 pending_invalidation_.Union(rect); | 79 pending_invalidation_.Union(rect); |
79 } | 80 } |
80 Layer::SetNeedsDisplayRect(layer_rect); | 81 Layer::SetNeedsDisplayRect(layer_rect); |
81 } | 82 } |
82 | 83 |
83 bool PictureLayer::Update(ResourceUpdateQueue* queue, | 84 bool PictureLayer::Update(ResourceUpdateQueue* queue, |
84 const OcclusionTracker<Layer>* occlusion) { | 85 const OcclusionTracker<Layer>* occlusion) { |
85 update_source_frame_number_ = layer_tree_host()->source_frame_number(); | 86 update_source_frame_number_ = layer_tree_host()->source_frame_number(); |
86 bool updated = Layer::Update(queue, occlusion); | 87 bool updated = Layer::Update(queue, occlusion); |
87 | 88 |
88 UpdateCanUseLCDText(); | 89 { |
| 90 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, |
| 91 true); |
| 92 UpdateCanUseLCDText(); |
| 93 } |
89 | 94 |
90 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 95 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
91 visible_content_rect(), 1.f / contents_scale_x()); | 96 visible_content_rect(), 1.f / contents_scale_x()); |
92 gfx::Size layer_size = paint_properties().bounds; | 97 gfx::Size layer_size = paint_properties().bounds; |
93 | 98 |
94 if (last_updated_visible_content_rect_ == visible_content_rect() && | 99 if (last_updated_visible_content_rect_ == visible_content_rect() && |
95 pile_->tiling_size() == layer_size && pending_invalidation_.IsEmpty()) { | 100 pile_->tiling_size() == layer_size && pending_invalidation_.IsEmpty()) { |
96 // Only early out if the visible content rect of this layer hasn't changed. | 101 // Only early out if the visible content rect of this layer hasn't changed. |
97 return updated; | 102 return updated; |
98 } | 103 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 208 |
204 bool PictureLayer::HasDrawableContent() const { | 209 bool PictureLayer::HasDrawableContent() const { |
205 return client_ && Layer::HasDrawableContent(); | 210 return client_ && Layer::HasDrawableContent(); |
206 } | 211 } |
207 | 212 |
208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
209 benchmark->RunOnLayer(this); | 214 benchmark->RunOnLayer(this); |
210 } | 215 } |
211 | 216 |
212 } // namespace cc | 217 } // namespace cc |
OLD | NEW |