| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 void SetBackgoundColor(SkColor background_color) override; | |
| 50 void SetRequiresClear(bool requires_clear) override; | |
| 51 bool ShouldAttemptToUseDistanceFieldText() const override; | 49 bool ShouldAttemptToUseDistanceFieldText() const override; |
| 52 void DidBeginTracing() override; | 50 void DidBeginTracing() override; |
| 53 void AsValueInto(base::debug::TracedValue* array) const override; | 51 void AsValueInto(base::trace_event::TracedValue* array) const override; |
| 54 skia::RefPtr<SkPicture> GetFlattenedPicture() override; | 52 skia::RefPtr<SkPicture> GetFlattenedPicture() override; |
| 55 size_t GetPictureMemoryUsage() const override; | 53 size_t GetPictureMemoryUsage() const override; |
| 56 bool CanUseLCDText() const override; | 54 bool CanUseLCDText() const override; |
| 57 | 55 |
| 58 protected: | 56 protected: |
| 59 DisplayListRasterSource(); | 57 DisplayListRasterSource(); |
| 60 explicit DisplayListRasterSource(const DisplayListRecordingSource* other); | 58 explicit DisplayListRasterSource(const DisplayListRecordingSource* other); |
| 61 ~DisplayListRasterSource() override; | 59 ~DisplayListRasterSource() override; |
| 62 | 60 |
| 63 scoped_refptr<DisplayItemList> display_list_; | 61 // These members are const as this raster source may be in use on another |
| 64 SkColor background_color_; | 62 // thread and so should not be touched after construction. |
| 65 bool requires_clear_; | 63 const scoped_refptr<DisplayItemList> display_list_; |
| 66 bool can_use_lcd_text_; | 64 const SkColor background_color_; |
| 67 bool is_solid_color_; | 65 const bool requires_clear_; |
| 68 SkColor solid_color_; | 66 const bool can_use_lcd_text_; |
| 69 gfx::Rect recorded_viewport_; | 67 const bool is_solid_color_; |
| 70 gfx::Size size_; | 68 const SkColor solid_color_; |
| 71 bool clear_canvas_with_debug_color_; | 69 const gfx::Rect recorded_viewport_; |
| 72 int slow_down_raster_scale_factor_for_debug_; | 70 const gfx::Size size_; |
| 71 const bool clear_canvas_with_debug_color_; |
| 72 const int slow_down_raster_scale_factor_for_debug_; |
| 73 // TODO(enne/vmiura): this has a read/write race between raster and compositor |
| 74 // threads with multi-threaded Ganesh. Make this const or remove it. |
| 75 bool should_attempt_to_use_distance_field_text_; |
| 73 | 76 |
| 74 private: | 77 private: |
| 75 // Called when analyzing a tile. We can use AnalysisCanvas as | 78 // Called when analyzing a tile. We can use AnalysisCanvas as |
| 76 // SkDrawPictureCallback, which allows us to early out from analysis. | 79 // SkDrawPictureCallback, which allows us to early out from analysis. |
| 77 void RasterForAnalysis(skia::AnalysisCanvas* canvas, | 80 void RasterForAnalysis(skia::AnalysisCanvas* canvas, |
| 78 const gfx::Rect& canvas_rect, | 81 const gfx::Rect& canvas_rect, |
| 79 float contents_scale) const; | 82 float contents_scale) const; |
| 80 | 83 |
| 81 void RasterCommon(SkCanvas* canvas, | 84 void RasterCommon(SkCanvas* canvas, |
| 82 SkDrawPictureCallback* callback, | 85 SkDrawPictureCallback* callback, |
| 83 const gfx::Rect& canvas_rect, | 86 const gfx::Rect& canvas_rect, |
| 84 float contents_scale, | 87 float contents_scale, |
| 85 bool is_analysis) const; | 88 bool is_analysis) const; |
| 86 | 89 |
| 87 bool should_attempt_to_use_distance_field_text_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); | 90 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace cc | 93 } // namespace cc |
| 93 | 94 |
| 94 #endif // CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ | 95 #endif // CC_RESOURCES_DISPLAY_LIST_RASTER_SOURCE_H_ |
| OLD | NEW |