| 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_IMPL_H_ | 5 #ifndef CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } | 86 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } |
| 87 | 87 |
| 88 // Functions used by tile manager. | 88 // Functions used by tile manager. |
| 89 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 89 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
| 90 bool IsOnActiveOrPendingTree() const; | 90 bool IsOnActiveOrPendingTree() const; |
| 91 | 91 |
| 92 // Used for benchmarking | 92 // Used for benchmarking |
| 93 RasterSource* GetRasterSource() const { return raster_source_.get(); } | 93 RasterSource* GetRasterSource() const { return raster_source_.get(); } |
| 94 | 94 |
| 95 void set_is_directly_composited_image(bool is_directly_composited_image) { |
| 96 is_directly_composited_image_ = is_directly_composited_image; |
| 97 } |
| 98 |
| 95 protected: | 99 protected: |
| 96 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); | 100 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); |
| 97 PictureLayerTiling* AddTiling(float contents_scale); | 101 PictureLayerTiling* AddTiling(float contents_scale); |
| 98 void RemoveAllTilings(); | 102 void RemoveAllTilings(); |
| 99 void AddTilingsForRasterScale(); | 103 void AddTilingsForRasterScale(); |
| 100 void AddLowResolutionTilingIfNeeded(); | 104 void AddLowResolutionTilingIfNeeded(); |
| 101 virtual bool ShouldAdjustRasterScale() const; | 105 bool ShouldAdjustRasterScale() const; |
| 102 virtual void RecalculateRasterScales(); | 106 void RecalculateRasterScales(); |
| 103 void CleanUpTilingsOnActiveLayer( | 107 void CleanUpTilingsOnActiveLayer( |
| 104 const std::vector<PictureLayerTiling*>& used_tilings); | 108 const std::vector<PictureLayerTiling*>& used_tilings); |
| 105 float MinimumContentsScale() const; | 109 float MinimumContentsScale() const; |
| 106 float MaximumContentsScale() const; | 110 float MaximumContentsScale() const; |
| 107 void ResetRasterScale(); | 111 void ResetRasterScale(); |
| 108 void UpdateViewportRectForTilePriorityInContentSpace(); | 112 void UpdateViewportRectForTilePriorityInContentSpace(); |
| 109 PictureLayerImpl* GetRecycledTwinLayer() const; | 113 PictureLayerImpl* GetRecycledTwinLayer() const; |
| 110 | 114 |
| 111 void SanityCheckTilingState() const; | 115 void SanityCheckTilingState() const; |
| 112 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; | 116 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; |
| 113 | 117 |
| 114 void GetDebugBorderProperties(SkColor* color, float* width) const override; | 118 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
| 115 void GetAllPrioritizedTilesForTracing( | 119 void GetAllPrioritizedTilesForTracing( |
| 116 std::vector<PrioritizedTile>* prioritized_tiles) const override; | 120 std::vector<PrioritizedTile>* prioritized_tiles) const override; |
| 117 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 121 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
| 118 | 122 |
| 119 virtual void UpdateIdealScales(); | 123 void UpdateIdealScales(); |
| 120 float MaximumTilingContentsScale() const; | 124 float MaximumTilingContentsScale() const; |
| 121 std::unique_ptr<PictureLayerTilingSet> CreatePictureLayerTilingSet(); | 125 std::unique_ptr<PictureLayerTilingSet> CreatePictureLayerTilingSet(); |
| 122 | 126 |
| 123 PictureLayerImpl* twin_layer_; | 127 PictureLayerImpl* twin_layer_; |
| 124 | 128 |
| 125 std::unique_ptr<PictureLayerTilingSet> tilings_; | 129 std::unique_ptr<PictureLayerTilingSet> tilings_; |
| 126 scoped_refptr<RasterSource> raster_source_; | 130 scoped_refptr<RasterSource> raster_source_; |
| 127 Region invalidation_; | 131 Region invalidation_; |
| 128 | 132 |
| 129 float ideal_page_scale_; | 133 float ideal_page_scale_; |
| 130 float ideal_device_scale_; | 134 float ideal_device_scale_; |
| 131 float ideal_source_scale_; | 135 float ideal_source_scale_; |
| 132 float ideal_contents_scale_; | 136 float ideal_contents_scale_; |
| 133 | 137 |
| 134 float raster_page_scale_; | 138 float raster_page_scale_; |
| 135 float raster_device_scale_; | 139 float raster_device_scale_; |
| 136 float raster_source_scale_; | 140 float raster_source_scale_; |
| 137 float raster_contents_scale_; | 141 float raster_contents_scale_; |
| 138 float low_res_raster_contents_scale_; | 142 float low_res_raster_contents_scale_; |
| 139 | 143 |
| 140 bool was_screen_space_transform_animating_; | 144 bool was_screen_space_transform_animating_; |
| 141 bool only_used_low_res_last_append_quads_; | 145 bool only_used_low_res_last_append_quads_; |
| 142 const bool is_mask_; | 146 const bool is_mask_; |
| 143 | 147 |
| 144 bool nearest_neighbor_; | 148 bool nearest_neighbor_; |
| 149 bool is_directly_composited_image_; |
| 145 | 150 |
| 146 // Use this instead of |visible_layer_rect()| for tiling calculations. This | 151 // Use this instead of |visible_layer_rect()| for tiling calculations. This |
| 147 // takes external viewport and transform for tile priority into account. | 152 // takes external viewport and transform for tile priority into account. |
| 148 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; | 153 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; |
| 149 | 154 |
| 150 gfx::Size gpu_raster_max_texture_size_; | 155 gfx::Size gpu_raster_max_texture_size_; |
| 151 | 156 |
| 152 // List of tilings that were used last time we appended quads. This can be | 157 // List of tilings that were used last time we appended quads. This can be |
| 153 // used as an optimization not to remove tilings if they are still being | 158 // used as an optimization not to remove tilings if they are still being |
| 154 // drawn. Note that accessing this vector should only be done in the context | 159 // drawn. Note that accessing this vector should only be done in the context |
| 155 // of comparing pointers, since objects pointed to are not guaranteed to | 160 // of comparing pointers, since objects pointed to are not guaranteed to |
| 156 // exist. | 161 // exist. |
| 157 std::vector<PictureLayerTiling*> last_append_quads_tilings_; | 162 std::vector<PictureLayerTiling*> last_append_quads_tilings_; |
| 158 | 163 |
| 159 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 164 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 160 }; | 165 }; |
| 161 | 166 |
| 162 } // namespace cc | 167 } // namespace cc |
| 163 | 168 |
| 164 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 169 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |