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

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

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « cc/resources/picture_layer_tiling_unittest.cc ('k') | cc/resources/picture_pile.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_RESOURCES_PICTURE_PILE_H_
6 #define CC_RESOURCES_PICTURE_PILE_H_
7
8 #include <bitset>
9 #include <utility>
10 #include <vector>
11
12 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h"
14 #include "cc/base/tiling_data.h"
15 #include "cc/resources/picture.h"
16
17 namespace cc {
18 class PicturePileImpl;
19
20 class CC_EXPORT PicturePile : public RecordingSource {
21 public:
22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size);
23 ~PicturePile() override;
24
25 // RecordingSource overrides.
26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter,
27 Region* invalidation,
28 const gfx::Size& layer_size,
29 const gfx::Rect& visible_layer_rect,
30 int frame_number,
31 RecordingMode recording_mode) override;
32 void DidMoveToNewCompositor() override;
33 scoped_refptr<RasterSource> CreateRasterSource(
34 bool can_use_lcd_text) const override;
35 gfx::Size GetSize() const final;
36 void SetEmptyBounds() override;
37 void SetSlowdownRasterScaleFactor(int factor) override;
38 void SetGatherPixelRefs(bool gather_pixel_refs) override;
39 void SetBackgroundColor(SkColor background_color) override;
40 void SetRequiresClear(bool requires_clear) override;
41 bool IsSuitableForGpuRasterization() const override;
42 void SetUnsuitableForGpuRasterizationForTesting() override;
43 gfx::Size GetTileGridSizeForTesting() const override;
44
45 protected:
46 class CC_EXPORT PictureInfo {
47 public:
48 enum { INVALIDATION_FRAMES_TRACKED = 32 };
49
50 PictureInfo();
51 ~PictureInfo();
52
53 bool Invalidate(int frame_number);
54 bool NeedsRecording(int frame_number, int distance_to_visible);
55 void SetPicture(scoped_refptr<Picture> picture);
56 const Picture* GetPicture() const;
57
58 float GetInvalidationFrequencyForTesting() const {
59 return GetInvalidationFrequency();
60 }
61
62 void ResetInvalidationHistory();
63
64 private:
65 void AdvanceInvalidationHistory(int frame_number);
66 float GetInvalidationFrequency() const;
67
68 int last_frame_number_;
69 scoped_refptr<const Picture> picture_;
70 std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_;
71 };
72
73 typedef std::pair<int, int> PictureMapKey;
74 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap;
75
76 // An internal CanRaster check that goes to the picture_map rather than
77 // using the recorded_viewport hint.
78 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const;
79
80 void Clear();
81
82 void SetMinContentsScale(float min_contents_scale);
83 void SetTileGridSize(const gfx::Size& tile_grid_size);
84
85 gfx::Rect PaddedRect(const PictureMapKey& key) const;
86 gfx::Rect PadRect(const gfx::Rect& rect) const;
87
88 int buffer_pixels() const { return tiling_.border_texels(); }
89
90 // A picture pile is a tiled set of pictures. The picture map is a map of tile
91 // indices to picture infos.
92 PictureMap picture_map_;
93 TilingData tiling_;
94
95 // If non-empty, all pictures tiles inside this rect are recorded. There may
96 // be recordings outside this rect, but everything inside the rect is
97 // recorded.
98 gfx::Rect recorded_viewport_;
99 float min_contents_scale_;
100 gfx::Size tile_grid_size_;
101 int slow_down_raster_scale_factor_for_debug_;
102 bool gather_pixel_refs_;
103 // A hint about whether there are any recordings. This may be a false
104 // positive.
105 bool has_any_recordings_;
106 bool clear_canvas_with_debug_color_;
107 bool requires_clear_;
108 bool is_solid_color_;
109 SkColor solid_color_;
110 SkColor background_color_;
111 int pixel_record_distance_;
112
113 private:
114 friend class PicturePileImpl;
115
116 void CreatePictures(ContentLayerClient* painter,
117 RecordingMode recording_mode,
118 const std::vector<gfx::Rect>& record_rects);
119 void GetInvalidTileRects(const gfx::Rect& interest_rect,
120 Region* invalidation,
121 const gfx::Rect& visible_layer_rect,
122 int frame_number,
123 std::vector<gfx::Rect>* invalid_tiles);
124 bool ApplyInvalidationAndResize(const gfx::Rect& interest_rect,
125 Region* invalidation,
126 const gfx::Size& layer_size,
127 int frame_number);
128 void DetermineIfSolidColor();
129 void SetBufferPixels(int buffer_pixels);
130
131 bool is_suitable_for_gpu_rasterization_;
132
133 DISALLOW_COPY_AND_ASSIGN(PicturePile);
134 };
135
136 } // namespace cc
137
138 #endif // CC_RESOURCES_PICTURE_PILE_H_
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_unittest.cc ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698