| 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_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ | 5 #ifndef CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ |
| 6 #define CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ | 6 #define CC_RESOURCES_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/resources/display_list_recording_source.h" | 13 #include "cc/resources/display_list_recording_source.h" |
| 14 #include "cc/resources/raster_source.h" | 14 #include "cc/resources/raster_source.h" |
| 15 #include "skia/ext/analysis_canvas.h" | 15 #include "skia/ext/analysis_canvas.h" |
| 16 #include "skia/ext/refptr.h" | 16 #include "skia/ext/refptr.h" |
| 17 #include "third_party/skia/include/core/SkPicture.h" | 17 #include "third_party/skia/include/core/SkPicture.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 class DisplayItemList; | 20 class DisplayItemList; |
| 21 | 21 |
| 22 class CC_EXPORT DisplayListRasterSource : public RasterSource { | 22 class CC_EXPORT DisplayListRasterSource : public RasterSource { |
| 23 public: | 23 public: |
| 24 static scoped_refptr<DisplayListRasterSource> Create(); |
| 24 static scoped_refptr<DisplayListRasterSource> | 25 static scoped_refptr<DisplayListRasterSource> |
| 25 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other, | 26 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other); |
| 26 bool can_use_lcd_text); | |
| 27 | 27 |
| 28 // RasterSource overrides. | 28 // RasterSource overrides. |
| 29 void PlaybackToCanvas(SkCanvas* canvas, | 29 void PlaybackToCanvas(SkCanvas* canvas, |
| 30 const gfx::Rect& canvas_rect, | 30 const gfx::Rect& canvas_rect, |
| 31 float contents_scale) const override; | 31 float contents_scale) const override; |
| 32 void PlaybackToSharedCanvas(SkCanvas* canvas, | 32 void PlaybackToSharedCanvas(SkCanvas* canvas, |
| 33 const gfx::Rect& canvas_rect, | 33 const gfx::Rect& canvas_rect, |
| 34 float contents_scale) const override; | 34 float contents_scale) const override; |
| 35 void PerformSolidColorAnalysis( | 35 void PerformSolidColorAnalysis( |
| 36 const gfx::Rect& content_rect, | 36 const gfx::Rect& content_rect, |
| 37 float contents_scale, | 37 float contents_scale, |
| 38 RasterSource::SolidColorAnalysis* analysis) const override; | 38 RasterSource::SolidColorAnalysis* analysis) const override; |
| 39 bool IsSolidColor() const override; | 39 bool IsSolidColor() const override; |
| 40 SkColor GetSolidColor() const override; | 40 SkColor GetSolidColor() const override; |
| 41 gfx::Size GetSize() const override; | 41 gfx::Size GetSize() const override; |
| 42 void GatherPixelRefs(const gfx::Rect& content_rect, | 42 void GatherPixelRefs(const gfx::Rect& content_rect, |
| 43 float contents_scale, | 43 float contents_scale, |
| 44 std::vector<SkPixelRef*>* pixel_refs) const override; | 44 std::vector<SkPixelRef*>* pixel_refs) const override; |
| 45 bool CoversRect(const gfx::Rect& content_rect, | 45 bool CoversRect(const gfx::Rect& content_rect, |
| 46 float contents_scale) const override; | 46 float contents_scale) const override; |
| 47 bool HasRecordings() const override; | 47 bool HasRecordings() const override; |
| 48 void SetShouldAttemptToUseDistanceFieldText() override; | 48 void SetShouldAttemptToUseDistanceFieldText() override; |
| 49 bool ShouldAttemptToUseDistanceFieldText() const override; | 49 bool ShouldAttemptToUseDistanceFieldText() const override; |
| 50 void DidBeginTracing() override; | 50 void DidBeginTracing() override; |
| 51 void AsValueInto(base::trace_event::TracedValue* array) const override; | 51 void AsValueInto(base::trace_event::TracedValue* array) const override; |
| 52 skia::RefPtr<SkPicture> GetFlattenedPicture() override; | 52 skia::RefPtr<SkPicture> GetFlattenedPicture() override; |
| 53 size_t GetPictureMemoryUsage() const override; | 53 size_t GetPictureMemoryUsage() const override; |
| 54 bool CanUseLCDText() const override; | 54 bool CanUseLCDText() const override; |
| 55 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const override; | |
| 56 | 55 |
| 57 protected: | 56 protected: |
| 58 DisplayListRasterSource(); | 57 DisplayListRasterSource(); |
| 59 DisplayListRasterSource(const DisplayListRecordingSource* other, | 58 explicit DisplayListRasterSource(const DisplayListRecordingSource* other); |
| 60 bool can_use_lcd_text); | |
| 61 DisplayListRasterSource(const DisplayListRasterSource* other, | |
| 62 bool can_use_lcd_text); | |
| 63 ~DisplayListRasterSource() override; | 59 ~DisplayListRasterSource() override; |
| 64 | 60 |
| 65 // These members are const as this raster source may be in use on another | 61 // These members are const as this raster source may be in use on another |
| 66 // thread and so should not be touched after construction. | 62 // thread and so should not be touched after construction. |
| 67 const scoped_refptr<DisplayItemList> display_list_; | 63 const scoped_refptr<DisplayItemList> display_list_; |
| 68 const SkColor background_color_; | 64 const SkColor background_color_; |
| 69 const bool requires_clear_; | 65 const bool requires_clear_; |
| 70 const bool can_use_lcd_text_; | 66 const bool can_use_lcd_text_; |
| 71 const bool is_solid_color_; | 67 const bool is_solid_color_; |
| 72 const SkColor solid_color_; | 68 const SkColor solid_color_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 const gfx::Rect& canvas_rect, | 86 const gfx::Rect& canvas_rect, |
| 91 float contents_scale, | 87 float contents_scale, |
| 92 bool is_analysis) const; | 88 bool is_analysis) const; |
| 93 | 89 |
| 94 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); | 90 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); |
| 95 }; | 91 }; |
| 96 | 92 |
| 97 } // namespace cc | 93 } // namespace cc |
| 98 | 94 |
| 99 #endif // CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ | 95 #endif // CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ |
| OLD | NEW |