OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_PICTURE_PILE_BASE_H_ | |
6 #define CC_PICTURE_PILE_BASE_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "base/hash_tables.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "cc/base/cc_export.h" | |
13 #include "cc/base/hash_pair.h" | |
14 #include "cc/base/region.h" | |
15 #include "cc/base/tiling_data.h" | |
16 #include "cc/picture.h" | |
17 #include "ui/gfx/size.h" | |
18 | |
19 namespace cc { | |
20 | |
21 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { | |
22 public: | |
23 PicturePileBase(); | |
24 PicturePileBase(const PicturePileBase* other); | |
25 PicturePileBase(const PicturePileBase* other, unsigned thread_index); | |
26 | |
27 void Resize(gfx::Size size); | |
28 gfx::Size size() const { return tiling_.total_size(); } | |
29 void SetMinContentsScale(float min_contents_scale); | |
30 | |
31 void UpdateRecordedRegion(); | |
32 const Region& recorded_region() const { return recorded_region_; } | |
33 | |
34 int num_tiles_x() const { return tiling_.num_tiles_x(); } | |
35 int num_tiles_y() const { return tiling_.num_tiles_y(); } | |
36 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } | |
37 bool HasRecordingAt(int x, int y); | |
38 bool CanRaster(float contents_scale, gfx::Rect content_rect); | |
39 | |
40 void SetTileGridSize(const gfx::Size& tile_grid_size); | |
41 | |
42 protected: | |
43 virtual ~PicturePileBase(); | |
44 | |
45 int num_raster_threads() { return num_raster_threads_; } | |
46 int buffer_pixels() const { return tiling_.border_texels(); } | |
47 void Clear(); | |
48 | |
49 typedef std::pair<int, int> PictureListMapKey; | |
50 typedef std::list<scoped_refptr<Picture> > PictureList; | |
51 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; | |
52 | |
53 // A picture pile is a tiled set of picture lists. The picture list map | |
54 // is a map of tile indices to picture lists. | |
55 PictureListMap picture_list_map_; | |
56 TilingData tiling_; | |
57 Region recorded_region_; | |
58 float min_contents_scale_; | |
59 SkTileGridPicture::TileGridInfo tile_grid_info_; | |
60 SkColor background_color_; | |
61 int slow_down_raster_scale_factor_for_debug_; | |
62 int num_raster_threads_; | |
63 | |
64 private: | |
65 void SetBufferPixels(int buffer_pixels); | |
66 | |
67 friend class base::RefCounted<PicturePileBase>; | |
68 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | |
69 }; | |
70 | |
71 } // namespace cc | |
72 | |
73 #endif // CC_PICTURE_PILE_H_ | |
OLD | NEW |