| 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_RESOURCES_PICTURE_PILE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_H_ |
| 6 #define CC_RESOURCES_PICTURE_PILE_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_H_ |
| 7 | 7 |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "cc/base/tiling_data.h" | 14 #include "cc/base/tiling_data.h" |
| 15 #include "cc/resources/recording_source.h" | 15 #include "cc/resources/recording_source.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 class PicturePileImpl; | 18 class PicturePileImpl; |
| 19 class LayerTreeSettings; | |
| 20 | 19 |
| 21 class CC_EXPORT PicturePile : public RecordingSource { | 20 class CC_EXPORT PicturePile : public RecordingSource { |
| 22 public: | 21 public: |
| 23 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); | 22 PicturePile(); |
| 24 ~PicturePile() override; | 23 ~PicturePile() override; |
| 25 | 24 |
| 26 // RecordingSource overrides. | 25 // RecordingSource overrides. |
| 27 bool UpdateAndExpandInvalidation( | 26 bool UpdateAndExpandInvalidation( |
| 28 ContentLayerClient* painter, | 27 ContentLayerClient* painter, |
| 29 Region* invalidation, | 28 Region* invalidation, |
| 30 bool can_use_lcd_text, | 29 bool can_use_lcd_text, |
| 31 const gfx::Size& layer_size, | 30 const gfx::Size& layer_size, |
| 32 const gfx::Rect& visible_layer_rect, | 31 const gfx::Rect& visible_layer_rect, |
| 33 int frame_number, | 32 int frame_number, |
| 34 Picture::RecordingMode recording_mode) override; | 33 Picture::RecordingMode recording_mode) override; |
| 35 scoped_refptr<RasterSource> CreateRasterSource() const override; | 34 scoped_refptr<RasterSource> CreateRasterSource() const override; |
| 36 gfx::Size GetSize() const final; | 35 gfx::Size GetSize() const final; |
| 37 void SetEmptyBounds() override; | 36 void SetEmptyBounds() override; |
| 37 void SetMinContentsScale(float min_contents_scale) override; |
| 38 void SetSlowdownRasterScaleFactor(int factor) override; | 38 void SetSlowdownRasterScaleFactor(int factor) override; |
| 39 bool IsSuitableForGpuRasterization() const override; | 39 bool IsSuitableForGpuRasterization() const override; |
| 40 void SetTileGridSize(const gfx::Size& tile_grid_size) override; |
| 40 void SetUnsuitableForGpuRasterizationForTesting() override; | 41 void SetUnsuitableForGpuRasterizationForTesting() override; |
| 41 SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const override; | 42 SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const override; |
| 42 | 43 |
| 43 static void ComputeTileGridInfo(const gfx::Size& tile_grid_size, | 44 static void ComputeTileGridInfo(const gfx::Size& tile_grid_size, |
| 44 SkTileGridFactory::TileGridInfo* info); | 45 SkTileGridFactory::TileGridInfo* info); |
| 45 | 46 |
| 46 protected: | 47 protected: |
| 47 class CC_EXPORT PictureInfo { | 48 class CC_EXPORT PictureInfo { |
| 48 public: | 49 public: |
| 49 enum { INVALIDATION_FRAMES_TRACKED = 32 }; | 50 enum { INVALIDATION_FRAMES_TRACKED = 32 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 | 72 |
| 72 typedef std::pair<int, int> PictureMapKey; | 73 typedef std::pair<int, int> PictureMapKey; |
| 73 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap; | 74 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap; |
| 74 | 75 |
| 75 // An internal CanRaster check that goes to the picture_map rather than | 76 // An internal CanRaster check that goes to the picture_map rather than |
| 76 // using the recorded_viewport hint. | 77 // using the recorded_viewport hint. |
| 77 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; | 78 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; |
| 78 | 79 |
| 79 void Clear(); | 80 void Clear(); |
| 80 | 81 |
| 81 void SetMinContentsScale(float min_contents_scale); | |
| 82 void SetTileGridSize(const gfx::Size& tile_grid_size); | |
| 83 | |
| 84 gfx::Rect PaddedRect(const PictureMapKey& key) const; | 82 gfx::Rect PaddedRect(const PictureMapKey& key) const; |
| 85 gfx::Rect PadRect(const gfx::Rect& rect) const; | 83 gfx::Rect PadRect(const gfx::Rect& rect) const; |
| 86 | 84 |
| 87 int buffer_pixels() const { return tiling_.border_texels(); } | 85 int buffer_pixels() const { return tiling_.border_texels(); } |
| 88 | 86 |
| 89 // A picture pile is a tiled set of pictures. The picture map is a map of tile | 87 // A picture pile is a tiled set of pictures. The picture map is a map of tile |
| 90 // indices to picture infos. | 88 // indices to picture infos. |
| 91 PictureMap picture_map_; | 89 PictureMap picture_map_; |
| 92 TilingData tiling_; | 90 TilingData tiling_; |
| 93 | 91 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void SetBufferPixels(int buffer_pixels); | 124 void SetBufferPixels(int buffer_pixels); |
| 127 | 125 |
| 128 bool is_suitable_for_gpu_rasterization_; | 126 bool is_suitable_for_gpu_rasterization_; |
| 129 | 127 |
| 130 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 128 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
| 131 }; | 129 }; |
| 132 | 130 |
| 133 } // namespace cc | 131 } // namespace cc |
| 134 | 132 |
| 135 #endif // CC_RESOURCES_PICTURE_PILE_H_ | 133 #endif // CC_RESOURCES_PICTURE_PILE_H_ |
| OLD | NEW |