| 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_RASTER_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_RASTER_SOURCE_H_ |
| 6 #define CC_PLAYBACK_RASTER_SOURCE_H_ | 6 #define CC_PLAYBACK_RASTER_SOURCE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
| 15 #include "cc/debug/rendering_stats_instrumentation.h" | 15 #include "cc/debug/rendering_stats_instrumentation.h" |
| 16 #include "cc/playback/image_id.h" | 16 #include "cc/playback/image_id.h" |
| 17 #include "cc/playback/recording_source.h" | 17 #include "cc/playback/recording_source.h" |
| 18 #include "skia/ext/analysis_canvas.h" | 18 #include "skia/ext/analysis_canvas.h" |
| 19 #include "third_party/skia/include/core/SkPicture.h" | 19 #include "third_party/skia/include/core/SkPicture.h" |
| 20 #include "ui/gfx/color_space.h" |
| 20 | 21 |
| 21 namespace cc { | 22 namespace cc { |
| 22 class DisplayItemList; | 23 class DisplayItemList; |
| 23 class DrawImage; | 24 class DrawImage; |
| 24 class ImageDecodeCache; | 25 class ImageDecodeCache; |
| 25 | 26 |
| 26 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { | 27 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { |
| 27 public: | 28 public: |
| 28 struct CC_EXPORT PlaybackSettings { | 29 struct CC_EXPORT PlaybackSettings { |
| 29 PlaybackSettings(); | 30 PlaybackSettings(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 // crbug.com/691076. | 49 // crbug.com/691076. |
| 49 ImageIdFlatSet images_to_skip; | 50 ImageIdFlatSet images_to_skip; |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 static scoped_refptr<RasterSource> CreateFromRecordingSource( | 53 static scoped_refptr<RasterSource> CreateFromRecordingSource( |
| 53 const RecordingSource* other, | 54 const RecordingSource* other, |
| 54 bool can_use_lcd_text); | 55 bool can_use_lcd_text); |
| 55 | 56 |
| 56 // TODO(trchen): Deprecated. | 57 // TODO(trchen): Deprecated. |
| 57 void PlaybackToCanvas(SkCanvas* canvas, | 58 void PlaybackToCanvas(SkCanvas* canvas, |
| 59 const gfx::ColorSpace& canvas_color_space, |
| 58 const gfx::Rect& canvas_bitmap_rect, | 60 const gfx::Rect& canvas_bitmap_rect, |
| 59 const gfx::Rect& canvas_playback_rect, | 61 const gfx::Rect& canvas_playback_rect, |
| 60 float contents_scale, | 62 float contents_scale, |
| 61 const PlaybackSettings& settings) const; | 63 const PlaybackSettings& settings) const; |
| 62 | 64 |
| 63 // Raster this RasterSource into the given canvas. Canvas states such as | 65 // Raster this RasterSource into the given canvas. Canvas states such as |
| 64 // CTM and clip region will be respected. This function will replace pixels | 66 // CTM and clip region will be respected. This function will replace pixels |
| 65 // in the clip region without blending. It is assumed that existing pixels | 67 // in the clip region without blending. It is assumed that existing pixels |
| 66 // may be uninitialized and will be cleared before playback. | 68 // may be uninitialized and will be cleared before playback. |
| 67 // | 69 // |
| 68 // Virtual for testing. | 70 // Virtual for testing. |
| 69 // | 71 // |
| 70 // Note that this should only be called after the image decode controller has | 72 // Note that this should only be called after the image decode controller has |
| 71 // been set, which happens during commit. | 73 // been set, which happens during commit. |
| 72 virtual void PlaybackToCanvas(SkCanvas* canvas, | 74 virtual void PlaybackToCanvas(SkCanvas* canvas, |
| 75 const gfx::ColorSpace& canvas_color_space, |
| 73 const PlaybackSettings& settings) const; | 76 const PlaybackSettings& settings) const; |
| 74 | 77 |
| 75 // Returns whether the given rect at given scale is of solid color in | 78 // Returns whether the given rect at given scale is of solid color in |
| 76 // this raster source, as well as the solid color value. | 79 // this raster source, as well as the solid color value. |
| 77 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, | 80 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, |
| 78 float contents_scale, | 81 float contents_scale, |
| 79 SkColor* color) const; | 82 SkColor* color) const; |
| 80 | 83 |
| 81 // Returns true iff the whole raster source is of solid color. | 84 // Returns true iff the whole raster source is of solid color. |
| 82 bool IsSolidColor() const; | 85 bool IsSolidColor() const; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const gfx::Rect recorded_viewport_; | 147 const gfx::Rect recorded_viewport_; |
| 145 const gfx::Size size_; | 148 const gfx::Size size_; |
| 146 const bool clear_canvas_with_debug_color_; | 149 const bool clear_canvas_with_debug_color_; |
| 147 const int slow_down_raster_scale_factor_for_debug_; | 150 const int slow_down_raster_scale_factor_for_debug_; |
| 148 | 151 |
| 149 // In practice, this is only set once before raster begins, so it's ok with | 152 // In practice, this is only set once before raster begins, so it's ok with |
| 150 // respect to threading. | 153 // respect to threading. |
| 151 ImageDecodeCache* image_decode_cache_; | 154 ImageDecodeCache* image_decode_cache_; |
| 152 | 155 |
| 153 private: | 156 private: |
| 154 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; | 157 void RasterCommon(SkCanvas* canvas, |
| 158 const gfx::ColorSpace& canvas_color_space, |
| 159 SkPicture::AbortCallback* callback) const; |
| 155 | 160 |
| 156 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; | 161 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; |
| 157 | 162 |
| 158 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 163 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 159 }; | 164 }; |
| 160 | 165 |
| 161 } // namespace cc | 166 } // namespace cc |
| 162 | 167 |
| 163 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ | 168 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ |
| OLD | NEW |