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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/debug/rendering_stats_instrumentation.h" | 15 #include "cc/debug/rendering_stats_instrumentation.h" |
16 #include "cc/resources/picture_pile.h" | 16 #include "cc/resources/picture_pile.h" |
17 #include "cc/resources/raster_source.h" | 17 #include "cc/resources/raster_source.h" |
18 #include "skia/ext/analysis_canvas.h" | 18 #include "skia/ext/analysis_canvas.h" |
19 #include "skia/ext/refptr.h" | 19 #include "skia/ext/refptr.h" |
20 #include "third_party/skia/include/core/SkPicture.h" | 20 |
| 21 class SkCanvas; |
| 22 class SkPicture; |
| 23 class SkPixelRef; |
| 24 |
| 25 namespace gfx { |
| 26 class Rect; |
| 27 } |
21 | 28 |
22 namespace cc { | 29 namespace cc { |
23 | 30 |
24 class CC_EXPORT PicturePileImpl : public RasterSource { | 31 class CC_EXPORT PicturePileImpl : public RasterSource { |
25 public: | 32 public: |
26 static scoped_refptr<PicturePileImpl> Create(); | 33 static scoped_refptr<PicturePileImpl> Create(); |
27 static scoped_refptr<PicturePileImpl> CreateFromPicturePile( | 34 static scoped_refptr<PicturePileImpl> CreateFromPicturePile( |
28 const PicturePile* other); | 35 const PicturePile* other); |
29 | 36 |
30 // RasterSource overrides. See RasterSource header for full description. | 37 // RasterSource overrides. See RasterSource header for full description. |
31 // When slow-down-raster-scale-factor is set to a value greater than 1, the | 38 // When slow-down-raster-scale-factor is set to a value greater than 1, the |
32 // reported rasterize time (in stats_instrumentation) is the minimum measured | 39 // reported rasterize time (in stats_instrumentation) is the minimum measured |
33 // value over all runs. | 40 // value over all runs. |
34 void PlaybackToCanvas(SkCanvas* canvas, | 41 void PlaybackToCanvas(SkCanvas* canvas, |
35 const gfx::Rect& canvas_rect, | 42 const gfx::Rect& canvas_rect, |
36 float contents_scale) const override; | 43 float contents_scale) const override; |
37 void PlaybackToSharedCanvas(SkCanvas* canvas, | 44 void PlaybackToSharedCanvas(SkCanvas* canvas, |
38 const gfx::Rect& canvas_rect, | 45 const gfx::Rect& canvas_rect, |
39 float contents_scale) const override; | 46 float contents_scale) const override; |
40 void PerformSolidColorAnalysis( | 47 void PerformSolidColorAnalysis( |
41 const gfx::Rect& content_rect, | 48 const gfx::Rect& content_rect, |
42 float contents_scale, | 49 float contents_scale, |
43 RasterSource::SolidColorAnalysis* analysis) const override; | 50 RasterSource::SolidColorAnalysis* analysis) const override; |
44 void GatherPixelRefs(const gfx::Rect& content_rect, | 51 void GatherPixelRefs(const gfx::Rect& content_rect, |
45 float contents_scale, | 52 float contents_scale, |
46 std::vector<SkPixelRef*>* pixel_refs) const override; | 53 std::vector<SkPixelRef*>* pixel_refs) const override; |
47 bool CoversRect(const gfx::Rect& content_rect, | 54 bool CoversRect(const gfx::Rect& content_rect, |
48 float contents_scale) const override; | 55 float contents_scale) const override; |
49 void SetShouldAttemptToUseDistanceFieldText() override; | 56 void SetShouldAttemptToUseDistanceFieldText() override; |
| 57 void SetBackgoundColor(SkColor background_color) override; |
| 58 void SetRequiresClear(bool requires_clear) override; |
50 bool ShouldAttemptToUseDistanceFieldText() const override; | 59 bool ShouldAttemptToUseDistanceFieldText() const override; |
51 gfx::Size GetSize() const override; | 60 gfx::Size GetSize() const override; |
52 bool IsSolidColor() const override; | 61 bool IsSolidColor() const override; |
53 SkColor GetSolidColor() const override; | 62 SkColor GetSolidColor() const override; |
54 bool HasRecordings() const override; | 63 bool HasRecordings() const override; |
55 bool IsMask() const override; | |
56 | 64 |
57 // Tracing functionality. | 65 // Tracing functionality. |
58 void DidBeginTracing() override; | 66 void DidBeginTracing() override; |
59 void AsValueInto(base::debug::TracedValue* array) const override; | 67 void AsValueInto(base::debug::TracedValue* array) const override; |
60 skia::RefPtr<SkPicture> GetFlattenedPicture() override; | 68 skia::RefPtr<SkPicture> GetFlattenedPicture() override; |
61 | 69 |
62 // Iterator used to return SkPixelRefs from this picture pile. | 70 // Iterator used to return SkPixelRefs from this picture pile. |
63 // Public for testing. | 71 // Public for testing. |
64 class CC_EXPORT PixelRefIterator { | 72 class CC_EXPORT PixelRefIterator { |
65 public: | 73 public: |
(...skipping 28 matching lines...) Expand all Loading... |
94 | 102 |
95 PicturePileImpl(); | 103 PicturePileImpl(); |
96 explicit PicturePileImpl(const PicturePile* other); | 104 explicit PicturePileImpl(const PicturePile* other); |
97 ~PicturePileImpl() override; | 105 ~PicturePileImpl() override; |
98 | 106 |
99 int buffer_pixels() const { return tiling_.border_texels(); } | 107 int buffer_pixels() const { return tiling_.border_texels(); } |
100 | 108 |
101 PictureMap picture_map_; | 109 PictureMap picture_map_; |
102 TilingData tiling_; | 110 TilingData tiling_; |
103 SkColor background_color_; | 111 SkColor background_color_; |
104 bool contents_opaque_; | 112 bool requires_clear_; |
105 bool contents_fill_bounds_completely_; | |
106 bool is_solid_color_; | 113 bool is_solid_color_; |
107 SkColor solid_color_; | 114 SkColor solid_color_; |
108 gfx::Rect recorded_viewport_; | 115 gfx::Rect recorded_viewport_; |
109 bool has_any_recordings_; | 116 bool has_any_recordings_; |
110 bool is_mask_; | |
111 bool clear_canvas_with_debug_color_; | 117 bool clear_canvas_with_debug_color_; |
112 float min_contents_scale_; | 118 float min_contents_scale_; |
113 int slow_down_raster_scale_factor_for_debug_; | 119 int slow_down_raster_scale_factor_for_debug_; |
114 | 120 |
115 private: | 121 private: |
116 typedef std::map<const Picture*, Region> PictureRegionMap; | 122 typedef std::map<const Picture*, Region> PictureRegionMap; |
117 | 123 |
118 // Called when analyzing a tile. We can use AnalysisCanvas as | 124 // Called when analyzing a tile. We can use AnalysisCanvas as |
119 // SkDrawPictureCallback, which allows us to early out from analysis. | 125 // SkDrawPictureCallback, which allows us to early out from analysis. |
120 void RasterForAnalysis(skia::AnalysisCanvas* canvas, | 126 void RasterForAnalysis(skia::AnalysisCanvas* canvas, |
(...skipping 19 matching lines...) Expand all Loading... |
140 gfx::Rect PaddedRect(const PictureMapKey& key) const; | 146 gfx::Rect PaddedRect(const PictureMapKey& key) const; |
141 | 147 |
142 bool should_attempt_to_use_distance_field_text_; | 148 bool should_attempt_to_use_distance_field_text_; |
143 | 149 |
144 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 150 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
145 }; | 151 }; |
146 | 152 |
147 } // namespace cc | 153 } // namespace cc |
148 | 154 |
149 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 155 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
OLD | NEW |