OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ |
6 #define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ | 6 #define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 #include "cc/debug/rendering_stats_instrumentation.h" | 12 #include "cc/debug/rendering_stats_instrumentation.h" |
13 #include "cc/playback/display_list_recording_source.h" | 13 #include "cc/playback/display_list_recording_source.h" |
14 #include "skia/ext/analysis_canvas.h" | 14 #include "skia/ext/analysis_canvas.h" |
15 #include "skia/ext/refptr.h" | 15 #include "skia/ext/refptr.h" |
16 #include "third_party/skia/include/core/SkPicture.h" | 16 #include "third_party/skia/include/core/SkPicture.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 class DisplayItemList; | 19 class DisplayItemList; |
20 class DrawImage; | 20 class DrawImage; |
21 class ImageDecodeController; | |
21 | 22 |
22 class CC_EXPORT DisplayListRasterSource | 23 class CC_EXPORT DisplayListRasterSource |
23 : public base::RefCountedThreadSafe<DisplayListRasterSource> { | 24 : public base::RefCountedThreadSafe<DisplayListRasterSource> { |
24 public: | 25 public: |
25 struct CC_EXPORT SolidColorAnalysis { | 26 struct CC_EXPORT SolidColorAnalysis { |
26 SolidColorAnalysis() | 27 SolidColorAnalysis() |
27 : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {} | 28 : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {} |
28 ~SolidColorAnalysis() {} | 29 ~SolidColorAnalysis() {} |
29 | 30 |
30 bool is_solid_color; | 31 bool is_solid_color; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 virtual void DidBeginTracing(); | 100 virtual void DidBeginTracing(); |
100 virtual void AsValueInto(base::trace_event::TracedValue* array) const; | 101 virtual void AsValueInto(base::trace_event::TracedValue* array) const; |
101 virtual skia::RefPtr<SkPicture> GetFlattenedPicture(); | 102 virtual skia::RefPtr<SkPicture> GetFlattenedPicture(); |
102 virtual size_t GetPictureMemoryUsage() const; | 103 virtual size_t GetPictureMemoryUsage() const; |
103 | 104 |
104 // Return true if LCD anti-aliasing may be used when rastering text. | 105 // Return true if LCD anti-aliasing may be used when rastering text. |
105 virtual bool CanUseLCDText() const; | 106 virtual bool CanUseLCDText() const; |
106 | 107 |
107 scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const; | 108 scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const; |
108 | 109 |
110 // Image decode controller should be set once. It's lifetime has to exceed | |
enne (OOO)
2015/12/02 23:33:25
s/'//
vmpstr
2015/12/03 21:20:23
Done.
| |
111 // that of the raster source, since the raster source will access it during | |
112 // raster. | |
113 void SetImageDecodeController(ImageDecodeController* image_decode_controller); | |
114 | |
109 protected: | 115 protected: |
110 friend class base::RefCountedThreadSafe<DisplayListRasterSource>; | 116 friend class base::RefCountedThreadSafe<DisplayListRasterSource>; |
111 | 117 |
112 DisplayListRasterSource(const DisplayListRecordingSource* other, | 118 DisplayListRasterSource(const DisplayListRecordingSource* other, |
113 bool can_use_lcd_text); | 119 bool can_use_lcd_text); |
114 DisplayListRasterSource(const DisplayListRasterSource* other, | 120 DisplayListRasterSource(const DisplayListRasterSource* other, |
115 bool can_use_lcd_text); | 121 bool can_use_lcd_text); |
116 virtual ~DisplayListRasterSource(); | 122 virtual ~DisplayListRasterSource(); |
117 | 123 |
118 // These members are const as this raster source may be in use on another | 124 // These members are const as this raster source may be in use on another |
119 // thread and so should not be touched after construction. | 125 // thread and so should not be touched after construction. |
120 const scoped_refptr<DisplayItemList> display_list_; | 126 const scoped_refptr<DisplayItemList> display_list_; |
121 const size_t painter_reported_memory_usage_; | 127 const size_t painter_reported_memory_usage_; |
122 const SkColor background_color_; | 128 const SkColor background_color_; |
123 const bool requires_clear_; | 129 const bool requires_clear_; |
124 const bool can_use_lcd_text_; | 130 const bool can_use_lcd_text_; |
125 const bool is_solid_color_; | 131 const bool is_solid_color_; |
126 const SkColor solid_color_; | 132 const SkColor solid_color_; |
127 const gfx::Rect recorded_viewport_; | 133 const gfx::Rect recorded_viewport_; |
128 const gfx::Size size_; | 134 const gfx::Size size_; |
129 const bool clear_canvas_with_debug_color_; | 135 const bool clear_canvas_with_debug_color_; |
130 const int slow_down_raster_scale_factor_for_debug_; | 136 const int slow_down_raster_scale_factor_for_debug_; |
131 // TODO(enne/vmiura): this has a read/write race between raster and compositor | 137 // TODO(enne/vmiura): this has a read/write race between raster and compositor |
132 // threads with multi-threaded Ganesh. Make this const or remove it. | 138 // threads with multi-threaded Ganesh. Make this const or remove it. |
133 bool should_attempt_to_use_distance_field_text_; | 139 bool should_attempt_to_use_distance_field_text_; |
134 | 140 |
141 ImageDecodeController* image_decode_controller_; | |
142 | |
135 private: | 143 private: |
136 // Called when analyzing a tile. We can use AnalysisCanvas as | 144 // Called when analyzing a tile. We can use AnalysisCanvas as |
137 // SkPicture::AbortCallback, which allows us to early out from analysis. | 145 // SkPicture::AbortCallback, which allows us to early out from analysis. |
138 void RasterForAnalysis(skia::AnalysisCanvas* canvas, | 146 void RasterForAnalysis(skia::AnalysisCanvas* canvas, |
139 const gfx::Rect& canvas_rect, | 147 const gfx::Rect& canvas_rect, |
140 float contents_scale) const; | 148 float contents_scale) const; |
141 | 149 |
142 void RasterCommon(SkCanvas* canvas, | 150 void RasterCommon(SkCanvas* canvas, |
143 SkPicture::AbortCallback* callback, | 151 SkPicture::AbortCallback* callback, |
144 const gfx::Rect& canvas_bitmap_rect, | 152 const gfx::Rect& canvas_bitmap_rect, |
145 const gfx::Rect& canvas_playback_rect, | 153 const gfx::Rect& canvas_playback_rect, |
146 float contents_scale) const; | 154 float contents_scale) const; |
147 | 155 |
148 void PrepareForPlaybackToCanvas(SkCanvas* canvas, | 156 void PrepareForPlaybackToCanvas(SkCanvas* canvas, |
149 const gfx::Rect& canvas_bitmap_rect, | 157 const gfx::Rect& canvas_bitmap_rect, |
150 const gfx::Rect& canvas_playback_rect, | 158 const gfx::Rect& canvas_playback_rect, |
151 float contents_scale) const; | 159 float contents_scale) const; |
152 | 160 |
153 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); | 161 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); |
154 }; | 162 }; |
155 | 163 |
156 } // namespace cc | 164 } // namespace cc |
157 | 165 |
158 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ | 166 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ |
OLD | NEW |