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