| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 pending_invalidation_.Union(rect); | 83 pending_invalidation_.Union(rect); |
| 83 } | 84 } |
| 84 Layer::SetNeedsDisplayRect(layer_rect); | 85 Layer::SetNeedsDisplayRect(layer_rect); |
| 85 } | 86 } |
| 86 | 87 |
| 87 bool PictureLayer::Update(ResourceUpdateQueue* queue, | 88 bool PictureLayer::Update(ResourceUpdateQueue* queue, |
| 88 const OcclusionTracker<Layer>* occlusion) { | 89 const OcclusionTracker<Layer>* occlusion) { |
| 89 update_source_frame_number_ = layer_tree_host()->source_frame_number(); | 90 update_source_frame_number_ = layer_tree_host()->source_frame_number(); |
| 90 bool updated = Layer::Update(queue, occlusion); | 91 bool updated = Layer::Update(queue, occlusion); |
| 91 | 92 |
| 92 UpdateCanUseLCDText(); | 93 { |
| 94 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, |
| 95 true); |
| 96 UpdateCanUseLCDText(); |
| 97 } |
| 93 | 98 |
| 94 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 99 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
| 95 visible_content_rect(), 1.f / contents_scale_x()); | 100 visible_content_rect(), 1.f / contents_scale_x()); |
| 96 gfx::Size layer_size = paint_properties().bounds; | 101 gfx::Size layer_size = paint_properties().bounds; |
| 97 | 102 |
| 98 if (last_updated_visible_content_rect_ == visible_content_rect() && | 103 if (last_updated_visible_content_rect_ == visible_content_rect() && |
| 99 pile_->tiling_size() == layer_size && pending_invalidation_.IsEmpty()) { | 104 pile_->tiling_size() == layer_size && pending_invalidation_.IsEmpty()) { |
| 100 // Only early out if the visible content rect of this layer hasn't changed. | 105 // Only early out if the visible content rect of this layer hasn't changed. |
| 101 return updated; | 106 return updated; |
| 102 } | 107 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 203 |
| 199 bool PictureLayer::IsSuitableForGpuRasterization() const { | 204 bool PictureLayer::IsSuitableForGpuRasterization() const { |
| 200 return pile_->is_suitable_for_gpu_rasterization(); | 205 return pile_->is_suitable_for_gpu_rasterization(); |
| 201 } | 206 } |
| 202 | 207 |
| 203 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 204 benchmark->RunOnLayer(this); | 209 benchmark->RunOnLayer(this); |
| 205 } | 210 } |
| 206 | 211 |
| 207 } // namespace cc | 212 } // namespace cc |
| OLD | NEW |