[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 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 | |||||
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 10 | #include "base/hash_tables.h" |
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 11 | #include "base/memory/ref_counted.h" |
12 | #include "cc/cc_export.h" | ||||
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 13 | #include "cc/hash_pair.h" |
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 14 | #include "cc/picture.h" |
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 15 | #include "cc/region.h" |
16 | #include "cc/tiling_data.h" | ||||
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 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 | |||||
25 | void Resize(gfx::Size size); | ||||
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 26 | gfx::Size size() const { return tiling_.total_size(); } |
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 27 | void SetMinContentsScale(float min_contents_scale); |
28 | |||||
29 | void PushPropertiesTo(PicturePileBase* other); | ||||
30 | |||||
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 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); | ||||
[email protected] | b06a972d | 2013-02-27 02:03:04 | [diff] [blame] | 38 | bool CanRaster(float contents_scale, gfx::Rect content_rect); |
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 39 | |
[email protected] | f974be6 | 2013-02-28 19:12:26 | [diff] [blame] | 40 | void SetTileGridSize(const gfx::Size& tile_grid_size); |
41 | |||||
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 42 | protected: |
[email protected] | c059dab | 2013-01-25 10:39:54 | [diff] [blame] | 43 | virtual ~PicturePileBase(); |
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 44 | |
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 45 | int buffer_pixels() const { return tiling_.border_texels(); } |
46 | void Clear(); | ||||
47 | |||||
48 | typedef std::pair<int, int> PictureListMapKey; | ||||
49 | typedef std::list<scoped_refptr<Picture> > PictureList; | ||||
50 | typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; | ||||
51 | |||||
52 | // A picture pile is a tiled set of picture lists. The picture list map | ||||
53 | // is a map of tile indices to picture lists. | ||||
54 | PictureListMap picture_list_map_; | ||||
55 | TilingData tiling_; | ||||
56 | Region recorded_region_; | ||||
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 57 | float min_contents_scale_; |
[email protected] | f974be6 | 2013-02-28 19:12:26 | [diff] [blame] | 58 | SkTileGridPicture::TileGridInfo tile_grid_info_; |
[email protected] | 43f7c3d | 2013-03-02 18:00:40 | [diff] [blame] | 59 | SkColor background_color_; |
[email protected] | e6ac3a7 | 2013-03-13 03:50:53 | [diff] [blame] | 60 | int slow_down_raster_scale_factor_for_debug_; |
[email protected] | fd3eec6 | 2013-01-24 19:54:03 | [diff] [blame] | 61 | |
62 | private: | ||||
63 | void SetBufferPixels(int buffer_pixels); | ||||
[email protected] | 8433943 | 2013-01-17 03:00:11 | [diff] [blame] | 64 | |
65 | friend class base::RefCounted<PicturePileBase>; | ||||
66 | DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | ||||
67 | }; | ||||
68 | |||||
69 | } // namespace cc | ||||
70 | |||||
71 | #endif // CC_PICTURE_PILE_H_ |