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 10 matching lines...) Expand all Loading... | |
21 public: | 21 public: |
22 static scoped_refptr<PictureLayer> Create(ContentLayerClient* client); | 22 static scoped_refptr<PictureLayer> Create(ContentLayerClient* client); |
23 | 23 |
24 void ClearClient(); | 24 void ClearClient(); |
25 | 25 |
26 void SetNearestNeighbor(bool nearest_neighbor); | 26 void SetNearestNeighbor(bool nearest_neighbor); |
27 bool nearest_neighbor() const { | 27 bool nearest_neighbor() const { |
28 return picture_layer_inputs_.nearest_neighbor; | 28 return picture_layer_inputs_.nearest_neighbor; |
29 } | 29 } |
30 | 30 |
31 void SetAllowTransformedRasterization(bool allowed); | |
32 | |
31 // Layer interface. | 33 // Layer interface. |
32 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 34 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
33 void SetLayerTreeHost(LayerTreeHost* host) override; | 35 void SetLayerTreeHost(LayerTreeHost* host) override; |
34 void PushPropertiesTo(LayerImpl* layer) override; | 36 void PushPropertiesTo(LayerImpl* layer) override; |
35 void SetNeedsDisplayRect(const gfx::Rect& layer_rect) override; | 37 void SetNeedsDisplayRect(const gfx::Rect& layer_rect) override; |
36 bool Update() override; | 38 bool Update() override; |
37 void SetIsMask(bool is_mask) override; | 39 void SetIsMask(bool is_mask) override; |
38 sk_sp<SkPicture> GetPicture() const override; | 40 sk_sp<SkPicture> GetPicture() const override; |
39 | 41 |
40 void SetTypeForProtoSerialization(proto::LayerNode* proto) const override; | 42 void SetTypeForProtoSerialization(proto::LayerNode* proto) const override; |
(...skipping 12 matching lines...) Expand all Loading... | |
53 const DisplayItemList* GetDisplayItemList(); | 55 const DisplayItemList* GetDisplayItemList(); |
54 | 56 |
55 protected: | 57 protected: |
56 // Encapsulates all data, callbacks or interfaces received from the embedder. | 58 // Encapsulates all data, callbacks or interfaces received from the embedder. |
57 struct PictureLayerInputs { | 59 struct PictureLayerInputs { |
58 PictureLayerInputs(); | 60 PictureLayerInputs(); |
59 ~PictureLayerInputs(); | 61 ~PictureLayerInputs(); |
60 | 62 |
61 ContentLayerClient* client = nullptr; | 63 ContentLayerClient* client = nullptr; |
62 bool nearest_neighbor = false; | 64 bool nearest_neighbor = false; |
65 bool allow_transformed_rasterization = false; | |
63 gfx::Rect recorded_viewport; | 66 gfx::Rect recorded_viewport; |
64 scoped_refptr<DisplayItemList> display_list; | 67 scoped_refptr<DisplayItemList> display_list; |
65 size_t painter_reported_memory_usage = 0; | 68 size_t painter_reported_memory_usage = 0; |
66 }; | 69 }; |
67 | 70 |
68 explicit PictureLayer(ContentLayerClient* client); | 71 explicit PictureLayer(ContentLayerClient* client); |
69 // Allow tests to inject a recording source. | 72 // Allow tests to inject a recording source. |
70 PictureLayer(ContentLayerClient* client, | 73 PictureLayer(ContentLayerClient* client, |
71 std::unique_ptr<RecordingSource> source); | 74 std::unique_ptr<RecordingSource> source); |
72 ~PictureLayer() override; | 75 ~PictureLayer() override; |
73 | 76 |
74 bool HasDrawableContent() const override; | 77 bool HasDrawableContent() const override; |
75 | 78 |
76 bool is_mask() const { return is_mask_; } | 79 bool is_mask() const { return is_mask_; } |
77 | 80 |
78 PictureLayerInputs picture_layer_inputs_; | 81 PictureLayerInputs picture_layer_inputs_; |
79 | 82 |
80 private: | 83 private: |
81 friend class TestSerializationPictureLayer; | 84 friend class TestSerializationPictureLayer; |
82 | 85 |
83 void DropRecordingSourceContentIfInvalid(); | 86 void DropRecordingSourceContentIfInvalid(); |
84 | 87 |
88 bool UseTransformedRasterization() const; | |
enne (OOO)
2017/01/03 22:53:01
style nit: maybe this should be "ShouldUseTransfor
| |
89 | |
85 std::unique_ptr<RecordingSource> recording_source_; | 90 std::unique_ptr<RecordingSource> recording_source_; |
86 devtools_instrumentation:: | 91 devtools_instrumentation:: |
87 ScopedLayerObjectTracker instrumentation_object_tracker_; | 92 ScopedLayerObjectTracker instrumentation_object_tracker_; |
88 | 93 |
89 Region last_updated_invalidation_; | 94 Region last_updated_invalidation_; |
90 | 95 |
91 int update_source_frame_number_; | 96 int update_source_frame_number_; |
92 bool is_mask_; | 97 bool is_mask_; |
93 | 98 |
94 DISALLOW_COPY_AND_ASSIGN(PictureLayer); | 99 DISALLOW_COPY_AND_ASSIGN(PictureLayer); |
95 }; | 100 }; |
96 | 101 |
97 } // namespace cc | 102 } // namespace cc |
98 | 103 |
99 #endif // CC_LAYERS_PICTURE_LAYER_H_ | 104 #endif // CC_LAYERS_PICTURE_LAYER_H_ |
OLD | NEW |