| 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 #ifndef CC_LAYERS_PICTURE_LAYER_H_ | 5 #ifndef CC_LAYERS_PICTURE_LAYER_H_ |
| 6 #define CC_LAYERS_PICTURE_LAYER_H_ | 6 #define CC_LAYERS_PICTURE_LAYER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/base/invalidation_region.h" | 9 #include "cc/base/invalidation_region.h" |
| 10 #include "cc/debug/devtools_instrumentation.h" | 10 #include "cc/debug/devtools_instrumentation.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class RecordingSource; | 22 class RecordingSource; |
| 23 class ResourceUpdateQueue; | 23 class ResourceUpdateQueue; |
| 24 | 24 |
| 25 class CC_EXPORT PictureLayer : public Layer { | 25 class CC_EXPORT PictureLayer : public Layer { |
| 26 public: | 26 public: |
| 27 static scoped_refptr<PictureLayer> Create(ContentLayerClient* client); | 27 static scoped_refptr<PictureLayer> Create(ContentLayerClient* client); |
| 28 | 28 |
| 29 void ClearClient(); | 29 void ClearClient(); |
| 30 | 30 |
| 31 void SetNearestNeighbor(bool nearest_neighbor); | 31 void SetNearestNeighbor(bool nearest_neighbor); |
| 32 bool nearest_neighbor() const { |
| 33 return picture_layer_inputs_.nearest_neighbor; |
| 34 } |
| 32 | 35 |
| 33 // Layer interface. | 36 // Layer interface. |
| 34 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 37 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 35 void SetLayerTreeHost(LayerTreeHost* host) override; | 38 void SetLayerTreeHost(LayerTreeHost* host) override; |
| 36 void PushPropertiesTo(LayerImpl* layer) override; | 39 void PushPropertiesTo(LayerImpl* layer) override; |
| 37 void SetNeedsDisplayRect(const gfx::Rect& layer_rect) override; | 40 void SetNeedsDisplayRect(const gfx::Rect& layer_rect) override; |
| 38 bool Update() override; | 41 bool Update() override; |
| 39 void SetIsMask(bool is_mask) override; | 42 void SetIsMask(bool is_mask) override; |
| 40 sk_sp<SkPicture> GetPicture() const override; | 43 sk_sp<SkPicture> GetPicture() const override; |
| 41 | 44 |
| 45 void SetTypeForProtoSerialization(proto::LayerNode* proto) const override; |
| 46 void ToLayerPropertiesProto(proto::LayerProperties* proto) override; |
| 47 |
| 42 bool IsSuitableForGpuRasterization() const override; | 48 bool IsSuitableForGpuRasterization() const override; |
| 43 | 49 |
| 44 void RunMicroBenchmark(MicroBenchmark* benchmark) override; | 50 void RunMicroBenchmark(MicroBenchmark* benchmark) override; |
| 45 | 51 |
| 46 ContentLayerClient* client() { return picture_layer_inputs_.client; } | 52 ContentLayerClient* client() { return picture_layer_inputs_.client; } |
| 47 | 53 |
| 48 RecordingSource* GetRecordingSourceForTesting() { | 54 RecordingSource* GetRecordingSourceForTesting() { |
| 49 return recording_source_.get(); | 55 return recording_source_.get(); |
| 50 } | 56 } |
| 51 | 57 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 size_t painter_reported_memory_usage = 0; | 70 size_t painter_reported_memory_usage = 0; |
| 65 }; | 71 }; |
| 66 | 72 |
| 67 explicit PictureLayer(ContentLayerClient* client); | 73 explicit PictureLayer(ContentLayerClient* client); |
| 68 // Allow tests to inject a recording source. | 74 // Allow tests to inject a recording source. |
| 69 PictureLayer(ContentLayerClient* client, | 75 PictureLayer(ContentLayerClient* client, |
| 70 std::unique_ptr<RecordingSource> source); | 76 std::unique_ptr<RecordingSource> source); |
| 71 ~PictureLayer() override; | 77 ~PictureLayer() override; |
| 72 | 78 |
| 73 bool HasDrawableContent() const override; | 79 bool HasDrawableContent() const override; |
| 74 void SetTypeForProtoSerialization(proto::LayerNode* proto) const override; | |
| 75 void LayerSpecificPropertiesToProto(proto::LayerProperties* proto, | |
| 76 bool inputs_only) override; | |
| 77 void FromLayerSpecificPropertiesProto( | |
| 78 const proto::LayerProperties& proto) override; | |
| 79 | 80 |
| 80 bool is_mask() const { return is_mask_; } | 81 bool is_mask() const { return is_mask_; } |
| 81 | 82 |
| 82 PictureLayerInputs picture_layer_inputs_; | 83 PictureLayerInputs picture_layer_inputs_; |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 friend class TestSerializationPictureLayer; | 86 friend class TestSerializationPictureLayer; |
| 86 | 87 |
| 87 void DropRecordingSourceContentIfInvalid(); | 88 void DropRecordingSourceContentIfInvalid(); |
| 88 | 89 |
| 89 std::unique_ptr<RecordingSource> recording_source_; | 90 std::unique_ptr<RecordingSource> recording_source_; |
| 90 devtools_instrumentation:: | 91 devtools_instrumentation:: |
| 91 ScopedLayerObjectTracker instrumentation_object_tracker_; | 92 ScopedLayerObjectTracker instrumentation_object_tracker_; |
| 92 | 93 |
| 93 Region last_updated_invalidation_; | 94 Region last_updated_invalidation_; |
| 94 | 95 |
| 95 int update_source_frame_number_; | 96 int update_source_frame_number_; |
| 96 bool is_mask_; | 97 bool is_mask_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(PictureLayer); | 99 DISALLOW_COPY_AND_ASSIGN(PictureLayer); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace cc | 102 } // namespace cc |
| 102 | 103 |
| 103 #endif // CC_LAYERS_PICTURE_LAYER_H_ | 104 #endif // CC_LAYERS_PICTURE_LAYER_H_ |
| OLD | NEW |