OLD | NEW |
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_RESOURCES_PICTURE_PILE_IMPL_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
6 #define CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void PerformSolidColorAnalysis( | 45 void PerformSolidColorAnalysis( |
46 const gfx::Rect& content_rect, | 46 const gfx::Rect& content_rect, |
47 float contents_scale, | 47 float contents_scale, |
48 RasterSource::SolidColorAnalysis* analysis) const override; | 48 RasterSource::SolidColorAnalysis* analysis) const override; |
49 void GatherPixelRefs(const gfx::Rect& content_rect, | 49 void GatherPixelRefs(const gfx::Rect& content_rect, |
50 float contents_scale, | 50 float contents_scale, |
51 std::vector<SkPixelRef*>* pixel_refs) const override; | 51 std::vector<SkPixelRef*>* pixel_refs) const override; |
52 bool CoversRect(const gfx::Rect& content_rect, | 52 bool CoversRect(const gfx::Rect& content_rect, |
53 float contents_scale) const override; | 53 float contents_scale) const override; |
54 void SetShouldAttemptToUseDistanceFieldText() override; | 54 void SetShouldAttemptToUseDistanceFieldText() override; |
55 void SetBackgoundColor(SkColor background_color) override; | |
56 void SetRequiresClear(bool requires_clear) override; | |
57 bool ShouldAttemptToUseDistanceFieldText() const override; | 55 bool ShouldAttemptToUseDistanceFieldText() const override; |
58 gfx::Size GetSize() const override; | 56 gfx::Size GetSize() const override; |
59 bool IsSolidColor() const override; | 57 bool IsSolidColor() const override; |
60 SkColor GetSolidColor() const override; | 58 SkColor GetSolidColor() const override; |
61 bool HasRecordings() const override; | 59 bool HasRecordings() const override; |
62 bool CanUseLCDText() const override; | 60 bool CanUseLCDText() const override; |
63 | 61 |
64 // Tracing functionality. | 62 // Tracing functionality. |
65 void DidBeginTracing() override; | 63 void DidBeginTracing() override; |
66 void AsValueInto(base::debug::TracedValue* array) const override; | 64 void AsValueInto(base::trace_event::TracedValue* array) const override; |
67 skia::RefPtr<SkPicture> GetFlattenedPicture() override; | 65 skia::RefPtr<SkPicture> GetFlattenedPicture() override; |
68 size_t GetPictureMemoryUsage() const override; | 66 size_t GetPictureMemoryUsage() const override; |
69 | 67 |
70 // Iterator used to return SkPixelRefs from this picture pile. | 68 // Iterator used to return SkPixelRefs from this picture pile. |
71 // Public for testing. | 69 // Public for testing. |
72 class CC_EXPORT PixelRefIterator { | 70 class CC_EXPORT PixelRefIterator { |
73 public: | 71 public: |
74 PixelRefIterator(const gfx::Rect& content_rect, | 72 PixelRefIterator(const gfx::Rect& content_rect, |
75 float contents_scale, | 73 float contents_scale, |
76 const PicturePileImpl* picture_pile); | 74 const PicturePileImpl* picture_pile); |
(...skipping 22 matching lines...) Expand all Loading... |
99 using PictureMapKey = PicturePile::PictureMapKey; | 97 using PictureMapKey = PicturePile::PictureMapKey; |
100 using PictureMap = PicturePile::PictureMap; | 98 using PictureMap = PicturePile::PictureMap; |
101 using PictureInfo = PicturePile::PictureInfo; | 99 using PictureInfo = PicturePile::PictureInfo; |
102 | 100 |
103 PicturePileImpl(); | 101 PicturePileImpl(); |
104 explicit PicturePileImpl(const PicturePile* other); | 102 explicit PicturePileImpl(const PicturePile* other); |
105 ~PicturePileImpl() override; | 103 ~PicturePileImpl() override; |
106 | 104 |
107 int buffer_pixels() const { return tiling_.border_texels(); } | 105 int buffer_pixels() const { return tiling_.border_texels(); } |
108 | 106 |
109 PictureMap picture_map_; | 107 // These members are const as this raster source may be in use on another |
110 TilingData tiling_; | 108 // thread and so should not be touched after construction. |
111 SkColor background_color_; | 109 const PictureMap picture_map_; |
112 bool requires_clear_; | 110 const TilingData tiling_; |
113 bool can_use_lcd_text_; | 111 const SkColor background_color_; |
114 bool is_solid_color_; | 112 const bool requires_clear_; |
115 SkColor solid_color_; | 113 const bool can_use_lcd_text_; |
116 gfx::Rect recorded_viewport_; | 114 const bool is_solid_color_; |
117 bool has_any_recordings_; | 115 const SkColor solid_color_; |
118 bool clear_canvas_with_debug_color_; | 116 const gfx::Rect recorded_viewport_; |
119 float min_contents_scale_; | 117 const bool has_any_recordings_; |
120 int slow_down_raster_scale_factor_for_debug_; | 118 const bool clear_canvas_with_debug_color_; |
| 119 const float min_contents_scale_; |
| 120 const int slow_down_raster_scale_factor_for_debug_; |
| 121 // TODO(enne/vmiura): this has a read/write race between raster and compositor |
| 122 // threads with multi-threaded Ganesh. Make this const or remove it. |
| 123 bool should_attempt_to_use_distance_field_text_; |
121 | 124 |
122 private: | 125 private: |
123 typedef std::map<const Picture*, Region> PictureRegionMap; | 126 typedef std::map<const Picture*, Region> PictureRegionMap; |
124 | 127 |
125 // Called when analyzing a tile. We can use AnalysisCanvas as | 128 // Called when analyzing a tile. We can use AnalysisCanvas as |
126 // SkDrawPictureCallback, which allows us to early out from analysis. | 129 // SkDrawPictureCallback, which allows us to early out from analysis. |
127 void RasterForAnalysis(skia::AnalysisCanvas* canvas, | 130 void RasterForAnalysis(skia::AnalysisCanvas* canvas, |
128 const gfx::Rect& canvas_rect, | 131 const gfx::Rect& canvas_rect, |
129 float contents_scale) const; | 132 float contents_scale) const; |
130 | 133 |
131 void CoalesceRasters(const gfx::Rect& canvas_rect, | 134 void CoalesceRasters(const gfx::Rect& canvas_rect, |
132 const gfx::Rect& content_rect, | 135 const gfx::Rect& content_rect, |
133 float contents_scale, | 136 float contents_scale, |
134 PictureRegionMap* result) const; | 137 PictureRegionMap* result) const; |
135 | 138 |
136 void RasterCommon( | 139 void RasterCommon( |
137 SkCanvas* canvas, | 140 SkCanvas* canvas, |
138 SkDrawPictureCallback* callback, | 141 SkDrawPictureCallback* callback, |
139 const gfx::Rect& canvas_rect, | 142 const gfx::Rect& canvas_rect, |
140 float contents_scale, | 143 float contents_scale, |
141 bool is_analysis) const; | 144 bool is_analysis) const; |
142 | 145 |
143 // An internal CanRaster check that goes to the picture_map rather than | 146 // An internal CanRaster check that goes to the picture_map rather than |
144 // using the recorded_viewport hint. | 147 // using the recorded_viewport hint. |
145 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; | 148 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; |
146 | 149 |
147 gfx::Rect PaddedRect(const PictureMapKey& key) const; | 150 gfx::Rect PaddedRect(const PictureMapKey& key) const; |
148 | 151 |
149 bool should_attempt_to_use_distance_field_text_; | |
150 | |
151 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 152 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
152 }; | 153 }; |
153 | 154 |
154 } // namespace cc | 155 } // namespace cc |
155 | 156 |
156 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 157 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
OLD | NEW |