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

Side by Side Diff: cc/picture_layer_tiling.h

Issue 11377176: cc: Add PictureLayerTiling for impl-side painting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win builder /o\ 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_PICTURE_LAYER_TILING_H_
6 #define CC_PICTURE_LAYER_TILING_H_
7
8 #include "base/basictypes.h"
9 #include "base/hash_tables.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/cc_export.h"
12 #include "cc/hash_pair.h"
13 #include "cc/region.h"
14 #include "cc/tile.h"
15 #include "cc/tiling_data.h"
16 #include "ui/gfx/rect.h"
17
18 namespace cc {
19
20 class PictureLayerTiling;
21
22 class PictureLayerTilingClient {
23 public:
24 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0;
25 };
26
27 class CC_EXPORT PictureLayerTiling {
28 public:
29 ~PictureLayerTiling();
30
31 static scoped_ptr<PictureLayerTiling> Create(gfx::Size tile_size);
32 scoped_ptr<PictureLayerTiling> Clone() const;
33
34 const PictureLayerTiling& operator=(const PictureLayerTiling&);
35
36 void SetBounds(gfx::Size);
37 gfx::Size bounds() const { return tiling_data_.total_size(); }
38
39 void create_tiles(gfx::Rect);
40 void set_client(PictureLayerTilingClient* client);
41
42 class Iterator {
43 public:
44 Iterator(PictureLayerTiling* tiling, gfx::Rect content_rect);
45 ~Iterator();
46
47 // Visible rect (no borders)
48 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
52 gfx::Rect texture_rect() const;
53 gfx::Rect opaque_rect() const;
54 gfx::Size texture_size() const;
55
56 Tile* operator->() const { return current_tile_; }
57 Tile* operator*() const { return current_tile_; }
58
59 Iterator& operator++();
60 bool operator==(const Iterator& other) const;
61 bool operator!=(const Iterator& other) const;
62 operator bool() const { return current_tile_; }
63
64 private:
65 PictureLayerTiling* tiling_;
66 Tile* current_tile_;
67 gfx::Rect content_rect_;
68 int tile_i_;
69 int tile_j_;
70 int left_;
71 int top_;
72 int right_;
73 int bottom_;
74
75 friend class PictureLayerTiling;
76 };
77
78 Region OpaqueRegionInContentRect(const gfx::Rect&) const;
79
80 void Reset() { return tiles_.clear(); }
81
82 protected:
83 typedef std::pair<int, int> TileMapKey;
84 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap;
85
86 PictureLayerTiling(gfx::Size tileSize);
87 Tile* TileAt(int, int) const;
88
89 PictureLayerTilingClient* client_;
90 TileMap tiles_;
91 TilingData tiling_data_;
92
93 friend class Iterator;
94 };
95
96 } // namespace cc
97
98 #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