OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_BASE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_BASE_H_ |
6 #define CC_RESOURCES_PICTURE_PILE_BASE_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_BASE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
14 #include "cc/base/hash_pair.h" | 14 #include "cc/base/hash_pair.h" |
15 #include "cc/base/region.h" | 15 #include "cc/base/region.h" |
16 #include "cc/base/tiling_data.h" | 16 #include "cc/base/tiling_data.h" |
17 #include "cc/resources/picture.h" | 17 #include "cc/resources/picture.h" |
18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
19 | 19 |
| 20 namespace base { |
| 21 class Value; |
| 22 } |
| 23 |
20 namespace cc { | 24 namespace cc { |
21 | 25 |
22 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { | 26 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { |
23 public: | 27 public: |
24 PicturePileBase(); | 28 PicturePileBase(); |
25 explicit PicturePileBase(const PicturePileBase* other); | 29 explicit PicturePileBase(const PicturePileBase* other); |
26 PicturePileBase(const PicturePileBase* other, unsigned thread_index); | 30 PicturePileBase(const PicturePileBase* other, unsigned thread_index); |
27 | 31 |
28 void Resize(gfx::Size size); | 32 void Resize(gfx::Size size); |
29 gfx::Size size() const { return tiling_.total_size(); } | 33 gfx::Size size() const { return tiling_.total_size(); } |
30 void SetMinContentsScale(float min_contents_scale); | 34 void SetMinContentsScale(float min_contents_scale); |
31 | 35 |
32 void UpdateRecordedRegion(); | 36 void UpdateRecordedRegion(); |
33 const Region& recorded_region() const { return recorded_region_; } | 37 const Region& recorded_region() const { return recorded_region_; } |
34 | 38 |
35 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 39 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
36 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 40 int num_tiles_y() const { return tiling_.num_tiles_y(); } |
37 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } | 41 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } |
38 bool HasRecordingAt(int x, int y); | 42 bool HasRecordingAt(int x, int y); |
39 bool CanRaster(float contents_scale, gfx::Rect content_rect); | 43 bool CanRaster(float contents_scale, gfx::Rect content_rect); |
40 | 44 |
41 void SetTileGridSize(gfx::Size tile_grid_size); | 45 void SetTileGridSize(gfx::Size tile_grid_size); |
42 TilingData& tiling() { return tiling_; } | 46 TilingData& tiling() { return tiling_; } |
43 | 47 |
| 48 scoped_ptr<base::Value> AsValue() const; |
| 49 |
44 protected: | 50 protected: |
45 virtual ~PicturePileBase(); | 51 virtual ~PicturePileBase(); |
46 | 52 |
47 int num_raster_threads() { return num_raster_threads_; } | 53 int num_raster_threads() { return num_raster_threads_; } |
48 int buffer_pixels() const { return tiling_.border_texels(); } | 54 int buffer_pixels() const { return tiling_.border_texels(); } |
49 void Clear(); | 55 void Clear(); |
50 | 56 |
51 typedef std::pair<int, int> PictureListMapKey; | 57 typedef std::pair<int, int> PictureListMapKey; |
52 typedef std::list<scoped_refptr<Picture> > PictureList; | 58 typedef std::list<scoped_refptr<Picture> > PictureList; |
53 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; | 59 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; |
(...skipping 13 matching lines...) Expand all Loading... |
67 private: | 73 private: |
68 void SetBufferPixels(int buffer_pixels); | 74 void SetBufferPixels(int buffer_pixels); |
69 | 75 |
70 friend class base::RefCounted<PicturePileBase>; | 76 friend class base::RefCounted<PicturePileBase>; |
71 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | 77 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); |
72 }; | 78 }; |
73 | 79 |
74 } // namespace cc | 80 } // namespace cc |
75 | 81 |
76 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ | 82 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ |
OLD | NEW |