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_TILE_H_ | 5 #ifndef CC_TILE_H_ |
6 #define CC_TILE_H_ | 6 #define CC_TILE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" |
9 #include "cc/picture_pile.h" | 11 #include "cc/picture_pile.h" |
10 #include "cc/resource_provider.h" | 12 #include "cc/resource_provider.h" |
11 #include "cc/tile_priority.h" | 13 #include "cc/tile_priority.h" |
12 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
13 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
14 | 16 |
15 namespace cc { | 17 namespace cc { |
16 | 18 |
| 19 class Tile; |
17 class TileManager; | 20 class TileManager; |
18 | 21 |
19 enum TileQuality { | 22 enum TileQuality { |
20 LOW_TILE_QUALITY, | 23 LOW_TILE_QUALITY, |
21 NORMAL_TILE_QUALITY | 24 NORMAL_TILE_QUALITY |
22 }; | 25 }; |
23 | 26 |
| 27 class TileVersion { |
| 28 public: |
| 29 TileVersion(Tile* tile, int frame_number, |
| 30 PicturePile* picture_pile) |
| 31 : tile_(tile), |
| 32 frame_number_(frame_number), |
| 33 picture_pile_(picture_pile), |
| 34 resource_id_(0) {} |
| 35 |
| 36 int frame_number() const { return frame_number_; } |
| 37 |
| 38 const PicturePile* picture_pile() const { |
| 39 return picture_pile_; |
| 40 } |
| 41 |
| 42 const TilePriority& priority() const { |
| 43 return priority_; |
| 44 } |
| 45 |
| 46 void ModifyPriority(const TilePriority& priority) { |
| 47 priority_ = priority; |
| 48 } |
| 49 |
| 50 ResourceProvider::ResourceId resource_id() const { |
| 51 return resource_id_; |
| 52 } |
| 53 |
| 54 private: |
| 55 Tile* tile_; |
| 56 int frame_number_; |
| 57 PicturePile* picture_pile_; |
| 58 TilePriority priority_; |
| 59 ResourceProvider::ResourceId resource_id_; |
| 60 }; |
| 61 |
24 class Tile : public base::RefCounted<Tile> { | 62 class Tile : public base::RefCounted<Tile> { |
25 public: | 63 public: |
26 Tile(TileManager* tile_manager, | 64 Tile(TileManager* tile_manager, |
27 gfx::Size tile_size, | 65 gfx::Size tile_size, |
| 66 GLenum format, |
28 gfx::Rect rect_inside_picture, | 67 gfx::Rect rect_inside_picture, |
29 TileQuality quality); | 68 TileQuality quality); |
30 | 69 |
31 void SetPicturePile(int frame_number, scoped_ptr<PicturePile> picture_pile) {} | 70 void SetPicturePile(int frame_number, PicturePile* picture_pile); |
32 void SetPriority(int frame_number, TilePriority) {} | 71 void ModifyPriority(int frame_number, const TilePriority& priority); |
33 | 72 |
34 bool IsDrawable(int frame_number) { return false; } | 73 // Returns 0 if not drawable. |
35 ResourceProvider::ResourceId GetDrawableResourceId(int frame_number) { return
0; } | 74 ResourceProvider::ResourceId GetDrawableResourceId(int frame_number); |
| 75 |
| 76 protected: |
| 77 // Methods called by TileManager. |
| 78 void DeleteVersionOnRequestOfTileManager(int frame_number); |
36 | 79 |
37 private: | 80 private: |
38 friend class base::RefCounted<Tile>; | 81 friend class base::RefCounted<Tile>; |
39 friend class TileManager; | 82 friend class TileManager; |
40 | 83 |
| 84 TileVersion* GetVersion(int frame_number); |
41 ~Tile(); | 85 ~Tile(); |
42 | 86 |
43 TileManager* tile_manager_; | 87 TileManager* tile_manager_; |
44 gfx::Rect tile_size_; | 88 gfx::Rect tile_size_; |
| 89 GLenum format_; |
45 gfx::Rect rect_inside_picture_; | 90 gfx::Rect rect_inside_picture_; |
46 TileQuality quality_; | 91 TileQuality quality_; |
| 92 ScopedVector<TileVersion> versions_; |
47 }; | 93 }; |
48 | 94 |
| 95 |
49 } // namespace cc | 96 } // namespace cc |
50 #endif | 97 #endif |
OLD | NEW |