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(); | |
25 static scoped_refptr<DisplayListRasterSource> | 24 static scoped_refptr<DisplayListRasterSource> |
26 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other); | 25 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; |
55 | 56 |
56 protected: | 57 protected: |
57 DisplayListRasterSource(); | 58 DisplayListRasterSource(); |
58 explicit DisplayListRasterSource(const DisplayListRecordingSource* other); | 59 DisplayListRasterSource(const DisplayListRecordingSource* other, |
| 60 bool can_use_lcd_text); |
| 61 DisplayListRasterSource(const DisplayListRasterSource* other, |
| 62 bool can_use_lcd_text); |
59 ~DisplayListRasterSource() override; | 63 ~DisplayListRasterSource() override; |
60 | 64 |
61 // These members are const as this raster source may be in use on another | 65 // These members are const as this raster source may be in use on another |
62 // thread and so should not be touched after construction. | 66 // thread and so should not be touched after construction. |
63 const scoped_refptr<DisplayItemList> display_list_; | 67 const scoped_refptr<DisplayItemList> display_list_; |
64 const SkColor background_color_; | 68 const SkColor background_color_; |
65 const bool requires_clear_; | 69 const bool requires_clear_; |
66 const bool can_use_lcd_text_; | 70 const bool can_use_lcd_text_; |
67 const bool is_solid_color_; | 71 const bool is_solid_color_; |
68 const SkColor solid_color_; | 72 const SkColor solid_color_; |
(...skipping 17 matching lines...) Loading... |
86 const gfx::Rect& canvas_rect, | 90 const gfx::Rect& canvas_rect, |
87 float contents_scale, | 91 float contents_scale, |
88 bool is_analysis) const; | 92 bool is_analysis) const; |
89 | 93 |
90 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); | 94 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); |
91 }; | 95 }; |
92 | 96 |
93 } // namespace cc | 97 } // namespace cc |
94 | 98 |
95 #endif // CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ | 99 #endif // CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ |
OLD | NEW |