| 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 void SetImageDecodeController(ImageDecodeController* image_decode_controller); |
| 111 |
| 109 protected: | 112 protected: |
| 110 friend class base::RefCountedThreadSafe<DisplayListRasterSource>; | 113 friend class base::RefCountedThreadSafe<DisplayListRasterSource>; |
| 111 | 114 |
| 112 DisplayListRasterSource(const DisplayListRecordingSource* other, | 115 DisplayListRasterSource(const DisplayListRecordingSource* other, |
| 113 bool can_use_lcd_text); | 116 bool can_use_lcd_text); |
| 114 DisplayListRasterSource(const DisplayListRasterSource* other, | 117 DisplayListRasterSource(const DisplayListRasterSource* other, |
| 115 bool can_use_lcd_text); | 118 bool can_use_lcd_text); |
| 116 virtual ~DisplayListRasterSource(); | 119 virtual ~DisplayListRasterSource(); |
| 117 | 120 |
| 118 // These members are const as this raster source may be in use on another | 121 // These members are const as this raster source may be in use on another |
| 119 // thread and so should not be touched after construction. | 122 // thread and so should not be touched after construction. |
| 120 const scoped_refptr<DisplayItemList> display_list_; | 123 const scoped_refptr<DisplayItemList> display_list_; |
| 121 const size_t painter_reported_memory_usage_; | 124 const size_t painter_reported_memory_usage_; |
| 122 const SkColor background_color_; | 125 const SkColor background_color_; |
| 123 const bool requires_clear_; | 126 const bool requires_clear_; |
| 124 const bool can_use_lcd_text_; | 127 const bool can_use_lcd_text_; |
| 125 const bool is_solid_color_; | 128 const bool is_solid_color_; |
| 126 const SkColor solid_color_; | 129 const SkColor solid_color_; |
| 127 const gfx::Rect recorded_viewport_; | 130 const gfx::Rect recorded_viewport_; |
| 128 const gfx::Size size_; | 131 const gfx::Size size_; |
| 129 const bool clear_canvas_with_debug_color_; | 132 const bool clear_canvas_with_debug_color_; |
| 130 const int slow_down_raster_scale_factor_for_debug_; | 133 const int slow_down_raster_scale_factor_for_debug_; |
| 131 // TODO(enne/vmiura): this has a read/write race between raster and compositor | 134 // 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. | 135 // threads with multi-threaded Ganesh. Make this const or remove it. |
| 133 bool should_attempt_to_use_distance_field_text_; | 136 bool should_attempt_to_use_distance_field_text_; |
| 134 | 137 |
| 138 ImageDecodeController* image_decode_controller_; |
| 139 |
| 135 private: | 140 private: |
| 136 // Called when analyzing a tile. We can use AnalysisCanvas as | 141 // Called when analyzing a tile. We can use AnalysisCanvas as |
| 137 // SkPicture::AbortCallback, which allows us to early out from analysis. | 142 // SkPicture::AbortCallback, which allows us to early out from analysis. |
| 138 void RasterForAnalysis(skia::AnalysisCanvas* canvas, | 143 void RasterForAnalysis(skia::AnalysisCanvas* canvas, |
| 139 const gfx::Rect& canvas_rect, | 144 const gfx::Rect& canvas_rect, |
| 140 float contents_scale) const; | 145 float contents_scale) const; |
| 141 | 146 |
| 142 void RasterCommon(SkCanvas* canvas, | 147 void RasterCommon(SkCanvas* canvas, |
| 143 SkPicture::AbortCallback* callback, | 148 SkPicture::AbortCallback* callback, |
| 144 const gfx::Rect& canvas_bitmap_rect, | 149 const gfx::Rect& canvas_bitmap_rect, |
| 145 const gfx::Rect& canvas_playback_rect, | 150 const gfx::Rect& canvas_playback_rect, |
| 146 float contents_scale) const; | 151 float contents_scale) const; |
| 147 | 152 |
| 148 void PrepareForPlaybackToCanvas(SkCanvas* canvas, | 153 void PrepareForPlaybackToCanvas(SkCanvas* canvas, |
| 149 const gfx::Rect& canvas_bitmap_rect, | 154 const gfx::Rect& canvas_bitmap_rect, |
| 150 const gfx::Rect& canvas_playback_rect, | 155 const gfx::Rect& canvas_playback_rect, |
| 151 float contents_scale) const; | 156 float contents_scale) const; |
| 152 | 157 |
| 153 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); | 158 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); |
| 154 }; | 159 }; |
| 155 | 160 |
| 156 } // namespace cc | 161 } // namespace cc |
| 157 | 162 |
| 158 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ | 163 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ |
| OLD | NEW |