Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: cc/picture_layer_tiling.h

Issue 11417111: cc: Add PictureLayerTilingSet to manage PictureLayerTiling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win_rel Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/picture_layer_impl.cc ('k') | cc/picture_layer_tiling.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_PICTURE_LAYER_TILING_H_ 5 #ifndef CC_PICTURE_LAYER_TILING_H_
6 #define CC_PICTURE_LAYER_TILING_H_ 6 #define CC_PICTURE_LAYER_TILING_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 10 matching lines...) Expand all
21 21
22 class PictureLayerTilingClient { 22 class PictureLayerTilingClient {
23 public: 23 public:
24 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0; 24 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0;
25 }; 25 };
26 26
27 class CC_EXPORT PictureLayerTiling { 27 class CC_EXPORT PictureLayerTiling {
28 public: 28 public:
29 ~PictureLayerTiling(); 29 ~PictureLayerTiling();
30 30
31 static scoped_ptr<PictureLayerTiling> Create(gfx::Size tile_size); 31 static scoped_ptr<PictureLayerTiling> Create(float contents_scale,
32 gfx::Size tile_size);
32 scoped_ptr<PictureLayerTiling> Clone() const; 33 scoped_ptr<PictureLayerTiling> Clone() const;
33 34
34 const PictureLayerTiling& operator=(const PictureLayerTiling&); 35 const PictureLayerTiling& operator=(const PictureLayerTiling&);
35 36
36 void SetBounds(gfx::Size); 37 void SetLayerBounds(gfx::Size layer_bounds);
37 gfx::Size bounds() const { return tiling_data_.total_size(); } 38 void Invalidate(const Region& layer_invalidation);
38 39
39 void create_tiles(gfx::Rect); 40 void SetClient(PictureLayerTilingClient* client);
40 void set_client(PictureLayerTilingClient* client);
41 41
42 class Iterator { 42 gfx::Rect ContentRect() const;
43 float contents_scale() const { return contents_scale_; }
44
45 // Iterate over all tiles to fill content_rect. Even if tiles are invalid
46 // (i.e. no valid resource) this tiling should still iterate over them.
47 // The union of all geometry_rect calls for each element iterated over should
48 // exactly equal content_rect and no two geometry_rects should intersect.
49 class CC_EXPORT Iterator {
43 public: 50 public:
44 Iterator(PictureLayerTiling* tiling, gfx::Rect content_rect); 51 Iterator();
52 Iterator(PictureLayerTiling* tiling, float dest_scale, gfx::Rect rect);
45 ~Iterator(); 53 ~Iterator();
46 54
47 // Visible rect (no borders) 55 // Visible rect (no borders), always in the space of content_rect,
56 // regardless of the contents scale of the tiling.
48 gfx::Rect geometry_rect() const; 57 gfx::Rect geometry_rect() const;
49 // Full tile rect (not clipped, with borders)
50 gfx::Rect full_tile_rect() const;
51 // Texture rect (in texels) for geometry_rect 58 // Texture rect (in texels) for geometry_rect
52 gfx::Rect texture_rect() const; 59 gfx::RectF texture_rect() const;
53 gfx::Rect opaque_rect() const;
54 gfx::Size texture_size() const; 60 gfx::Size texture_size() const;
55 61
56 Tile* operator->() const { return current_tile_; } 62 Tile* operator->() const { return current_tile_; }
57 Tile* operator*() const { return current_tile_; } 63 Tile* operator*() const { return current_tile_; }
58 64
59 Iterator& operator++(); 65 Iterator& operator++();
60 bool operator==(const Iterator& other) const;
61 bool operator!=(const Iterator& other) const;
62 operator bool() const { return current_tile_; } 66 operator bool() const { return current_tile_; }
63 67
64 private: 68 private:
65 PictureLayerTiling* tiling_; 69 PictureLayerTiling* tiling_;
70 gfx::Rect dest_rect_;
71 float dest_to_content_scale_;
72
66 Tile* current_tile_; 73 Tile* current_tile_;
67 gfx::Rect content_rect_; 74 gfx::Rect current_geometry_rect_;
68 int tile_i_; 75 int tile_i_;
69 int tile_j_; 76 int tile_j_;
70 int left_; 77 int left_;
71 int top_; 78 int top_;
72 int right_; 79 int right_;
73 int bottom_; 80 int bottom_;
74 81
75 friend class PictureLayerTiling; 82 friend class PictureLayerTiling;
76 }; 83 };
77 84
78 Region OpaqueRegionInContentRect(const gfx::Rect&) const; 85 Region OpaqueRegionInContentRect(const gfx::Rect&) const;
79 86
80 void Reset() { return tiles_.clear(); } 87 void Reset() { return tiles_.clear(); }
81 88
82 protected: 89 protected:
83 typedef std::pair<int, int> TileMapKey; 90 typedef std::pair<int, int> TileMapKey;
84 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; 91 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap;
85 92
86 PictureLayerTiling(gfx::Size tileSize); 93 PictureLayerTiling(float contents_scale, gfx::Size tileSize);
87 Tile* TileAt(int, int) const; 94 Tile* TileAt(int, int) const;
95 void CreateTile(int i, int j);
88 96
89 PictureLayerTilingClient* client_; 97 PictureLayerTilingClient* client_;
98 float contents_scale_;
99 gfx::Size layer_bounds_;
90 TileMap tiles_; 100 TileMap tiles_;
91 TilingData tiling_data_; 101 TilingData tiling_data_;
92 102
93 friend class Iterator; 103 friend class Iterator;
94 }; 104 };
95 105
96 } // namespace cc 106 } // namespace cc
97 107
98 #endif // CC_PICTURE_LAYER_TILING_H_ 108 #endif // CC_PICTURE_LAYER_TILING_H_
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.cc ('k') | cc/picture_layer_tiling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698