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/devtools_instrumentation.h" | 9 #include "cc/base/devtools_instrumentation.h" |
10 #include "cc/base/invalidation_region.h" | 10 #include "cc/base/invalidation_region.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 SetLayerMaskType(LayerMaskType mask_type) override; | 39 void SetLayerMaskType(LayerMaskType mask_type) override; |
38 sk_sp<SkPicture> GetPicture() const override; | 40 sk_sp<SkPicture> GetPicture() const override; |
39 | 41 |
40 bool IsSuitableForGpuRasterization() const override; | 42 bool IsSuitableForGpuRasterization() const override; |
41 | 43 |
42 void RunMicroBenchmark(MicroBenchmark* benchmark) override; | 44 void RunMicroBenchmark(MicroBenchmark* benchmark) override; |
43 | 45 |
44 ContentLayerClient* client() { return picture_layer_inputs_.client; } | 46 ContentLayerClient* client() { return picture_layer_inputs_.client; } |
45 | 47 |
46 RecordingSource* GetRecordingSourceForTesting() { | 48 RecordingSource* GetRecordingSourceForTesting() { |
47 return recording_source_.get(); | 49 return recording_source_.get(); |
48 } | 50 } |
49 | 51 |
50 const DisplayItemList* GetDisplayItemList(); | 52 const DisplayItemList* GetDisplayItemList(); |
51 | 53 |
52 protected: | 54 protected: |
53 // Encapsulates all data, callbacks or interfaces received from the embedder. | 55 // Encapsulates all data, callbacks or interfaces received from the embedder. |
54 struct PictureLayerInputs { | 56 struct PictureLayerInputs { |
55 PictureLayerInputs(); | 57 PictureLayerInputs(); |
56 ~PictureLayerInputs(); | 58 ~PictureLayerInputs(); |
57 | 59 |
58 ContentLayerClient* client = nullptr; | 60 ContentLayerClient* client = nullptr; |
59 bool nearest_neighbor = false; | 61 bool nearest_neighbor = false; |
| 62 bool allow_transformed_rasterization = false; |
60 gfx::Rect recorded_viewport; | 63 gfx::Rect recorded_viewport; |
61 scoped_refptr<DisplayItemList> display_list; | 64 scoped_refptr<DisplayItemList> display_list; |
62 size_t painter_reported_memory_usage = 0; | 65 size_t painter_reported_memory_usage = 0; |
63 }; | 66 }; |
64 | 67 |
65 explicit PictureLayer(ContentLayerClient* client); | 68 explicit PictureLayer(ContentLayerClient* client); |
66 // Allow tests to inject a recording source. | 69 // Allow tests to inject a recording source. |
67 PictureLayer(ContentLayerClient* client, | 70 PictureLayer(ContentLayerClient* client, |
68 std::unique_ptr<RecordingSource> source); | 71 std::unique_ptr<RecordingSource> source); |
69 ~PictureLayer() override; | 72 ~PictureLayer() override; |
70 | 73 |
71 bool HasDrawableContent() const override; | 74 bool HasDrawableContent() const override; |
72 | 75 |
73 LayerMaskType mask_type() { return mask_type_; } | 76 LayerMaskType mask_type() { return mask_type_; } |
74 | 77 |
75 PictureLayerInputs picture_layer_inputs_; | 78 PictureLayerInputs picture_layer_inputs_; |
76 | 79 |
77 private: | 80 private: |
78 friend class TestSerializationPictureLayer; | 81 friend class TestSerializationPictureLayer; |
79 | 82 |
80 void DropRecordingSourceContentIfInvalid(); | 83 void DropRecordingSourceContentIfInvalid(); |
81 | 84 |
| 85 bool ShouldUseTransformedRasterization() const; |
| 86 |
82 std::unique_ptr<RecordingSource> recording_source_; | 87 std::unique_ptr<RecordingSource> recording_source_; |
83 devtools_instrumentation:: | 88 devtools_instrumentation:: |
84 ScopedLayerObjectTracker instrumentation_object_tracker_; | 89 ScopedLayerObjectTracker instrumentation_object_tracker_; |
85 | 90 |
86 Region last_updated_invalidation_; | 91 Region last_updated_invalidation_; |
87 | 92 |
88 int update_source_frame_number_; | 93 int update_source_frame_number_; |
89 LayerMaskType mask_type_; | 94 LayerMaskType mask_type_; |
90 | 95 |
91 DISALLOW_COPY_AND_ASSIGN(PictureLayer); | 96 DISALLOW_COPY_AND_ASSIGN(PictureLayer); |
92 }; | 97 }; |
93 | 98 |
94 } // namespace cc | 99 } // namespace cc |
95 | 100 |
96 #endif // CC_LAYERS_PICTURE_LAYER_H_ | 101 #endif // CC_LAYERS_PICTURE_LAYER_H_ |
OLD | NEW |