Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | |
|
tfarina
2012/11/15 01:49:28
2011 -> 2012?
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
|
tfarina
2012/11/15 01:49:28
rm extra blank line.
| |
| 5 | |
| 6 #ifndef CC_PICTURE_LAYER_TILING_H_ | |
| 7 #define CC_PICTURE_LAYER_TILING_H_ | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/hash_tables.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "cc/cc_export.h" | |
| 13 #include "cc/hash_pair.h" | |
| 14 #include "cc/region.h" | |
| 15 #include "cc/tile.h" | |
| 16 #include "cc/tiling_data.h" | |
| 17 #include "ui/gfx/rect.h" | |
| 18 | |
| 19 namespace cc { | |
| 20 | |
| 21 class PictureLayerTiling; | |
| 22 | |
| 23 class PictureLayerTilingClient { | |
| 24 public: | |
| 25 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0; | |
| 26 }; | |
| 27 | |
| 28 class CC_EXPORT PictureLayerTiling { | |
|
nduca
2012/11/15 02:19:05
I think this object probably needs to manage multi
| |
| 29 public: | |
| 30 ~PictureLayerTiling(); | |
| 31 | |
| 32 static scoped_ptr<PictureLayerTiling> Create(const gfx::Size& tile_size); | |
| 33 scoped_ptr<PictureLayerTiling> Clone() const; | |
| 34 | |
| 35 const PictureLayerTiling& operator=(const PictureLayerTiling&); | |
| 36 | |
| 37 void set_bounds(const gfx::Size&); | |
|
tfarina
2012/11/15 01:49:28
SetBounds
| |
| 38 gfx::Size bounds() const { return tiling_data_.total_size(); } | |
| 39 | |
| 40 void create_tiles(gfx::Rect); | |
|
tfarina
2012/11/15 01:49:28
we use to name the parameters in chromium
tfarina
2012/11/15 01:49:28
if you don't inline on the header file, i.e, if th
| |
| 41 void set_client(PictureLayerTilingClient* client); | |
| 42 | |
| 43 class Iterator { | |
| 44 public: | |
| 45 Iterator(PictureLayerTiling* tiling_, gfx::Rect content_rect); | |
|
tfarina
2012/11/15 01:49:28
trailing _ in tiling_
| |
| 46 ~Iterator(); | |
| 47 | |
| 48 // Visible rect (no borders) | |
| 49 gfx::Rect geometry_rect() const; | |
| 50 // Full tile rect (not clipped, with borders) | |
| 51 gfx::Rect full_tile_rect() const; | |
| 52 // Texture rect (in texels) for geometry_rect | |
| 53 gfx::Rect texture_rect() const; | |
| 54 gfx::Rect opaque_rect() const; | |
| 55 gfx::Size texture_size() const; | |
| 56 | |
| 57 Tile* operator->() const { return current_tile_; } | |
| 58 Tile* operator*() const { return current_tile_; } | |
| 59 | |
| 60 Iterator& operator++(); | |
| 61 bool operator==(const Iterator& other) const; | |
| 62 bool operator!=(const Iterator& other) const; | |
| 63 operator bool() const { return current_tile_; } | |
| 64 | |
| 65 private: | |
| 66 PictureLayerTiling* tiling_; | |
| 67 Tile* current_tile_; | |
| 68 gfx::Rect content_rect_; | |
| 69 int tile_i_; | |
| 70 int tile_j_; | |
| 71 int left_; | |
| 72 int top_; | |
| 73 int right_; | |
| 74 int bottom_; | |
| 75 | |
| 76 friend class PictureLayerTiling; | |
|
tfarina
2012/11/15 01:49:28
this goes at the beginning of the section.
| |
| 77 }; | |
| 78 | |
| 79 Region OpaqueRegionInContentRect(const gfx::Rect&) const; | |
| 80 | |
| 81 void Reset() { return tiles_.clear(); } | |
| 82 | |
| 83 protected: | |
| 84 typedef std::pair<int, int> TileMapKey; | |
| 85 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; | |
| 86 | |
| 87 PictureLayerTiling(const gfx::Size& tileSize); | |
|
tfarina
2012/11/15 01:49:28
I though James and Dana wanted to pass small struc
| |
| 88 Tile* TileAt(int, int) const; | |
| 89 | |
| 90 PictureLayerTilingClient* client_; | |
|
tfarina
2012/11/15 01:49:28
data member variables should be private
| |
| 91 TileMap tiles_; | |
| 92 TilingData tiling_data_; | |
| 93 | |
| 94 friend class Iterator; | |
|
tfarina
2012/11/15 01:49:28
this goes at the beginning of the section.
| |
| 95 }; | |
|
tfarina
2012/11/15 01:49:28
DISALLOW_CO...?
| |
| 96 | |
| 97 } // namespace cc | |
| 98 | |
| 99 #endif // CC_PICTURE_LAYER_TILING_H_ | |
| OLD | NEW |