| 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 | 19 |
| 20 class CC_EXPORT PicturePile : public RecordingSource { | 20 class CC_EXPORT PicturePile : public RecordingSource { |
| 21 public: | 21 public: |
| 22 PicturePile(); | 22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); |
| 23 ~PicturePile() override; | 23 ~PicturePile() override; |
| 24 | 24 |
| 25 // RecordingSource overrides. | 25 // RecordingSource overrides. |
| 26 bool UpdateAndExpandInvalidation( | 26 bool UpdateAndExpandInvalidation( |
| 27 ContentLayerClient* painter, | 27 ContentLayerClient* painter, |
| 28 Region* invalidation, | 28 Region* invalidation, |
| 29 bool can_use_lcd_text, | 29 bool can_use_lcd_text, |
| 30 const gfx::Size& layer_size, | 30 const gfx::Size& layer_size, |
| 31 const gfx::Rect& visible_layer_rect, | 31 const gfx::Rect& visible_layer_rect, |
| 32 int frame_number, | 32 int frame_number, |
| 33 Picture::RecordingMode recording_mode) override; | 33 Picture::RecordingMode recording_mode) override; |
| 34 scoped_refptr<RasterSource> CreateRasterSource() const override; | 34 scoped_refptr<RasterSource> CreateRasterSource() const override; |
| 35 gfx::Size GetSize() const final; | 35 gfx::Size GetSize() const final; |
| 36 void SetEmptyBounds() override; | 36 void SetEmptyBounds() override; |
| 37 void SetMinContentsScale(float min_contents_scale) override; | |
| 38 void SetSlowdownRasterScaleFactor(int factor) override; | 37 void SetSlowdownRasterScaleFactor(int factor) override; |
| 39 bool IsSuitableForGpuRasterization() const override; | 38 bool IsSuitableForGpuRasterization() const override; |
| 40 void SetTileGridSize(const gfx::Size& tile_grid_size) override; | |
| 41 void SetUnsuitableForGpuRasterizationForTesting() override; | 39 void SetUnsuitableForGpuRasterizationForTesting() override; |
| 42 gfx::Size GetTileGridSizeForTesting() const override; | 40 gfx::Size GetTileGridSizeForTesting() const override; |
| 43 | 41 |
| 44 protected: | 42 protected: |
| 45 class CC_EXPORT PictureInfo { | 43 class CC_EXPORT PictureInfo { |
| 46 public: | 44 public: |
| 47 enum { INVALIDATION_FRAMES_TRACKED = 32 }; | 45 enum { INVALIDATION_FRAMES_TRACKED = 32 }; |
| 48 | 46 |
| 49 PictureInfo(); | 47 PictureInfo(); |
| 50 ~PictureInfo(); | 48 ~PictureInfo(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 69 | 67 |
| 70 typedef std::pair<int, int> PictureMapKey; | 68 typedef std::pair<int, int> PictureMapKey; |
| 71 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap; | 69 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap; |
| 72 | 70 |
| 73 // An internal CanRaster check that goes to the picture_map rather than | 71 // An internal CanRaster check that goes to the picture_map rather than |
| 74 // using the recorded_viewport hint. | 72 // using the recorded_viewport hint. |
| 75 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; | 73 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; |
| 76 | 74 |
| 77 void Clear(); | 75 void Clear(); |
| 78 | 76 |
| 77 void SetMinContentsScale(float min_contents_scale); |
| 78 void SetTileGridSize(const gfx::Size& tile_grid_size); |
| 79 |
| 79 gfx::Rect PaddedRect(const PictureMapKey& key) const; | 80 gfx::Rect PaddedRect(const PictureMapKey& key) const; |
| 80 gfx::Rect PadRect(const gfx::Rect& rect) const; | 81 gfx::Rect PadRect(const gfx::Rect& rect) const; |
| 81 | 82 |
| 82 int buffer_pixels() const { return tiling_.border_texels(); } | 83 int buffer_pixels() const { return tiling_.border_texels(); } |
| 83 | 84 |
| 84 // A picture pile is a tiled set of pictures. The picture map is a map of tile | 85 // A picture pile is a tiled set of pictures. The picture map is a map of tile |
| 85 // indices to picture infos. | 86 // indices to picture infos. |
| 86 PictureMap picture_map_; | 87 PictureMap picture_map_; |
| 87 TilingData tiling_; | 88 TilingData tiling_; |
| 88 | 89 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void SetBufferPixels(int buffer_pixels); | 122 void SetBufferPixels(int buffer_pixels); |
| 122 | 123 |
| 123 bool is_suitable_for_gpu_rasterization_; | 124 bool is_suitable_for_gpu_rasterization_; |
| 124 | 125 |
| 125 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 126 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace cc | 129 } // namespace cc |
| 129 | 130 |
| 130 #endif // CC_RESOURCES_PICTURE_PILE_H_ | 131 #endif // CC_RESOURCES_PICTURE_PILE_H_ |
| OLD | NEW |