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

Side by Side Diff: cc/picture_layer_tiling_set.h

Issue 11704002: cc: Generate tilings at other scales for impl-side painting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 7 years, 11 months 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
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_SET_H_ 5 #ifndef CC_PICTURE_LAYER_TILING_SET_H_
6 #define CC_PICTURE_LAYER_TILING_SET_H_ 6 #define CC_PICTURE_LAYER_TILING_SET_H_
7 7
8 #include "cc/picture_layer_tiling.h" 8 #include "cc/picture_layer_tiling.h"
9 #include "cc/region.h" 9 #include "cc/region.h"
10 #include "cc/scoped_ptr_vector.h" 10 #include "cc/scoped_ptr_vector.h"
11 #include "ui/gfx/size.h" 11 #include "ui/gfx/size.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class CC_EXPORT PictureLayerTilingSet { 15 class CC_EXPORT PictureLayerTilingSet {
16 public: 16 public:
17 PictureLayerTilingSet(PictureLayerTilingClient* client); 17 PictureLayerTilingSet(PictureLayerTilingClient* client);
18 ~PictureLayerTilingSet(); 18 ~PictureLayerTilingSet();
19 19
20 // Shallow copies all data (except client and bounds from other). 20 // Shallow copies all data (except client and bounds from other).
21 void CloneAll( 21 void CloneAll(
22 const PictureLayerTilingSet& other, 22 const PictureLayerTilingSet& other,
23 const Region& invalidation); 23 const Region& invalidation);
24 void Clone(const PictureLayerTiling* tiling, const Region& invalidation); 24 void Clone(const PictureLayerTiling* tiling, const Region& invalidation);
25 25
26 void SetLayerBounds(gfx::Size layer_bounds); 26 void SetLayerBounds(gfx::Size layer_bounds);
27 gfx::Size LayerBounds() const; 27 gfx::Size LayerBounds() const;
28 28
29 const PictureLayerTiling* AddTiling( 29 PictureLayerTiling* AddTiling(
30 float contents_scale, 30 float contents_scale,
31 gfx::Size tile_size); 31 gfx::Size tile_size);
32 size_t num_tilings() const { return tilings_.size(); } 32 size_t num_tilings() const { return tilings_.size(); }
33 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } 33 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; }
34 34
35 // Remove all tilings.
36 void RemoveAll();
37
38 // Remove one tiling.
39 void Remove(PictureLayerTiling* tiling);
40
41 // Remove all tiles, but keep all tilings.
35 void Reset(); 42 void Reset();
36 43
37 void UpdateTilePriorities( 44 void UpdateTilePriorities(
38 WhichTree tree, 45 WhichTree tree,
39 const gfx::Size& device_viewport, 46 const gfx::Size& device_viewport,
40 float layer_content_scale_x, 47 float layer_content_scale_x,
41 float layer_content_scale_y, 48 float layer_content_scale_y,
42 const gfx::Transform& last_screen_transform, 49 const gfx::Transform& last_screen_transform,
43 const gfx::Transform& current_screen_transform, 50 const gfx::Transform& current_screen_transform,
44 double time_delta); 51 double time_delta);
45 52
46 // For a given rect, iterates through tiles that can fill it. If no 53 // For a given rect, iterates through tiles that can fill it. If no
47 // set of tiles with resources can fill the rect, then it will iterate 54 // set of tiles with resources can fill the rect, then it will iterate
48 // through null tiles with valid geometry_rect() until the rect is full. 55 // through null tiles with valid geometry_rect() until the rect is full.
49 // If all tiles have resources, the union of all geometry_rects will 56 // If all tiles have resources, the union of all geometry_rects will
50 // exactly fill rect with no overlap. 57 // exactly fill rect with no overlap.
51 class CC_EXPORT Iterator { 58 class CC_EXPORT Iterator {
52 public: 59 public:
53 Iterator( 60 Iterator(
54 const PictureLayerTilingSet* set, 61 const PictureLayerTilingSet* set,
55 float contents_scale, 62 float contents_scale,
56 gfx::Rect rect); 63 gfx::Rect content_rect,
64 float ideal_contents_scale);
57 ~Iterator(); 65 ~Iterator();
58 66
59 // Visible rect (no borders), always in the space of rect, 67 // Visible rect (no borders), always in the space of rect,
60 // regardless of the relative contents scale of the tiling. 68 // regardless of the relative contents scale of the tiling.
61 gfx::Rect geometry_rect() const; 69 gfx::Rect geometry_rect() const;
62 // Texture rect (in texels) for geometry_rect 70 // Texture rect (in texels) for geometry_rect
63 gfx::RectF texture_rect() const; 71 gfx::RectF texture_rect() const;
64 // Texture size in texels 72 // Texture size in texels
65 gfx::Size texture_size() const; 73 gfx::Size texture_size() const;
66 74
67 Tile* operator->() const; 75 Tile* operator->() const;
68 Tile* operator*() const; 76 Tile* operator*() const;
69 77
70 Iterator& operator++(); 78 Iterator& operator++();
71 operator bool() const; 79 operator bool() const;
72 80
81 PictureLayerTiling* CurrentTiling();
82
73 private: 83 private:
84 int NextTiling() const;
85
74 const PictureLayerTilingSet* set_; 86 const PictureLayerTilingSet* set_;
75 float contents_scale_; 87 float contents_scale_;
88 float ideal_contents_scale_;
76 PictureLayerTiling::Iterator tiling_iter_; 89 PictureLayerTiling::Iterator tiling_iter_;
77 int current_tiling_; 90 int current_tiling_;
91 int ideal_tiling_;
78 92
79 Region current_region_; 93 Region current_region_;
80 Region missing_region_; 94 Region missing_region_;
81 Region::Iterator region_iter_; 95 Region::Iterator region_iter_;
82 }; 96 };
83 97
84 private: 98 private:
85 PictureLayerTilingClient* client_; 99 PictureLayerTilingClient* client_;
86 gfx::Size layer_bounds_; 100 gfx::Size layer_bounds_;
87 ScopedPtrVector<PictureLayerTiling> tilings_; 101 ScopedPtrVector<PictureLayerTiling> tilings_;
88 Region invalidation_; 102 Region invalidation_;
89 103
90 friend class Iterator; 104 friend class Iterator;
91 }; 105 };
92 106
93 } // namespace cc 107 } // namespace cc
94 108
95 #endif // CC_PICTURE_LAYER_TILING_SET_H_ 109 #endif // CC_PICTURE_LAYER_TILING_SET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698