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

Side by Side Diff: cc/resources/picture_pile_base.h

Issue 362073002: cc: Remove all traces of SkPicture cloning. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « cc/resources/picture_pile.cc ('k') | cc/resources/picture_pile_base.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_RESOURCES_PICTURE_PILE_BASE_H_ 5 #ifndef CC_RESOURCES_PICTURE_PILE_BASE_H_
6 #define CC_RESOURCES_PICTURE_PILE_BASE_H_ 6 #define CC_RESOURCES_PICTURE_PILE_BASE_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <list> 9 #include <list>
10 #include <utility> 10 #include <utility>
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 class Value; 24 class Value;
25 } 25 }
26 26
27 namespace cc { 27 namespace cc {
28 28
29 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { 29 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
30 public: 30 public:
31 PicturePileBase(); 31 PicturePileBase();
32 explicit PicturePileBase(const PicturePileBase* other); 32 explicit PicturePileBase(const PicturePileBase* other);
33 PicturePileBase(const PicturePileBase* other, unsigned thread_index);
34 33
35 gfx::Size tiling_size() const { return tiling_.tiling_size(); } 34 gfx::Size tiling_size() const { return tiling_.tiling_size(); }
36 void SetMinContentsScale(float min_contents_scale); 35 void SetMinContentsScale(float min_contents_scale);
37 36
38 // If non-empty, all pictures tiles inside this rect are recorded. There may 37 // If non-empty, all pictures tiles inside this rect are recorded. There may
39 // be recordings outside this rect, but everything inside the rect is 38 // be recordings outside this rect, but everything inside the rect is
40 // recorded. 39 // recorded.
41 gfx::Rect recorded_viewport() const { return recorded_viewport_; } 40 gfx::Rect recorded_viewport() const { return recorded_viewport_; }
42 41
43 int num_tiles_x() const { return tiling_.num_tiles_x(); } 42 int num_tiles_x() const { return tiling_.num_tiles_x(); }
(...skipping 21 matching lines...) Expand all
65 public: 64 public:
66 enum { 65 enum {
67 INVALIDATION_FRAMES_TRACKED = 32 66 INVALIDATION_FRAMES_TRACKED = 32
68 }; 67 };
69 68
70 PictureInfo(); 69 PictureInfo();
71 ~PictureInfo(); 70 ~PictureInfo();
72 71
73 bool Invalidate(int frame_number); 72 bool Invalidate(int frame_number);
74 bool NeedsRecording(int frame_number, int distance_to_visible); 73 bool NeedsRecording(int frame_number, int distance_to_visible);
75 PictureInfo CloneForThread(int thread_index) const;
76 void SetPicture(scoped_refptr<Picture> picture); 74 void SetPicture(scoped_refptr<Picture> picture);
77 Picture* GetPicture() const; 75 const Picture* GetPicture() const;
78 76
79 float GetInvalidationFrequencyForTesting() const { 77 float GetInvalidationFrequencyForTesting() const {
80 return GetInvalidationFrequency(); 78 return GetInvalidationFrequency();
81 } 79 }
82 80
83 private: 81 private:
84 void AdvanceInvalidationHistory(int frame_number); 82 void AdvanceInvalidationHistory(int frame_number);
85 float GetInvalidationFrequency() const; 83 float GetInvalidationFrequency() const;
86 84
87 int last_frame_number_; 85 int last_frame_number_;
88 scoped_refptr<Picture> picture_; 86 scoped_refptr<const Picture> picture_;
89 std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_; 87 std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_;
90 }; 88 };
91 89
92 typedef std::pair<int, int> PictureMapKey; 90 typedef std::pair<int, int> PictureMapKey;
93 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap; 91 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap;
94 92
95 virtual ~PicturePileBase(); 93 virtual ~PicturePileBase();
96 94
97 int buffer_pixels() const { return tiling_.border_texels(); } 95 int buffer_pixels() const { return tiling_.border_texels(); }
98 void Clear(); 96 void Clear();
99 97
100 gfx::Rect PaddedRect(const PictureMapKey& key); 98 gfx::Rect PaddedRect(const PictureMapKey& key) const;
101 gfx::Rect PadRect(const gfx::Rect& rect); 99 gfx::Rect PadRect(const gfx::Rect& rect) const;
102 100
103 // An internal CanRaster check that goes to the picture_map rather than 101 // An internal CanRaster check that goes to the picture_map rather than
104 // using the recorded_viewport hint. 102 // using the recorded_viewport hint.
105 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; 103 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const;
106 104
107 // A picture pile is a tiled set of pictures. The picture map is a map of tile 105 // A picture pile is a tiled set of pictures. The picture map is a map of tile
108 // indices to picture infos. 106 // indices to picture infos.
109 PictureMap picture_map_; 107 PictureMap picture_map_;
110 TilingData tiling_; 108 TilingData tiling_;
111 gfx::Rect recorded_viewport_; 109 gfx::Rect recorded_viewport_;
(...skipping 13 matching lines...) Expand all
125 private: 123 private:
126 void SetBufferPixels(int buffer_pixels); 124 void SetBufferPixels(int buffer_pixels);
127 125
128 friend class base::RefCounted<PicturePileBase>; 126 friend class base::RefCounted<PicturePileBase>;
129 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); 127 DISALLOW_COPY_AND_ASSIGN(PicturePileBase);
130 }; 128 };
131 129
132 } // namespace cc 130 } // namespace cc
133 131
134 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ 132 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_
OLDNEW
« no previous file with comments | « cc/resources/picture_pile.cc ('k') | cc/resources/picture_pile_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698