| 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_RASTER_RASTER_SOURCE_H_ | 5 #ifndef CC_RASTER_RASTER_SOURCE_H_ |
| 6 #define CC_RASTER_RASTER_SOURCE_H_ | 6 #define CC_RASTER_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/cc_export.h" | 14 #include "cc/cc_export.h" |
| 15 #include "cc/debug/rendering_stats_instrumentation.h" | 15 #include "cc/debug/rendering_stats_instrumentation.h" |
| 16 #include "cc/layers/recording_source.h" | 16 #include "cc/layers/recording_source.h" |
| 17 #include "cc/paint/image_id.h" | 17 #include "cc/paint/image_id.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 #include "ui/gfx/color_space.h" |
| 21 | 21 |
| 22 namespace gfx { |
| 23 class AxisTransform2d; |
| 24 } // namespace gfx |
| 25 |
| 22 namespace cc { | 26 namespace cc { |
| 23 class DisplayItemList; | 27 class DisplayItemList; |
| 24 class DrawImage; | 28 class DrawImage; |
| 25 class ImageDecodeCache; | 29 class ImageDecodeCache; |
| 26 | 30 |
| 27 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { | 31 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { |
| 28 public: | 32 public: |
| 29 struct CC_EXPORT PlaybackSettings { | 33 struct CC_EXPORT PlaybackSettings { |
| 30 PlaybackSettings(); | 34 PlaybackSettings(); |
| 31 PlaybackSettings(const PlaybackSettings&); | 35 PlaybackSettings(const PlaybackSettings&); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 47 // during raster. | 51 // during raster. |
| 48 // TODO(khushalsagar): Consolidate more settings for playback here? See | 52 // TODO(khushalsagar): Consolidate more settings for playback here? See |
| 49 // crbug.com/691076. | 53 // crbug.com/691076. |
| 50 ImageIdFlatSet images_to_skip; | 54 ImageIdFlatSet images_to_skip; |
| 51 }; | 55 }; |
| 52 | 56 |
| 53 static scoped_refptr<RasterSource> CreateFromRecordingSource( | 57 static scoped_refptr<RasterSource> CreateFromRecordingSource( |
| 54 const RecordingSource* other, | 58 const RecordingSource* other, |
| 55 bool can_use_lcd_text); | 59 bool can_use_lcd_text); |
| 56 | 60 |
| 57 // TODO(trchen): Deprecated. | 61 // Helper function to apply a few common operations before passing the canvas |
| 62 // to the shorter version. This is useful for rastering into tiles. |
| 63 // canvas is expected to be backed by a tile, with a default state. |
| 64 // raster_transform will be applied to the display list, rastering the list |
| 65 // into the "content space". |
| 66 // canvas_bitmap_rect defines the extent of the tile in the content space, |
| 67 // i.e. contents in the rect will be cropped and translated onto the canvas. |
| 68 // canvas_playback_rect can be used to replay only part of the recording in, |
| 69 // the content space, so only a sub-rect of the tile gets rastered. |
| 58 void PlaybackToCanvas(SkCanvas* canvas, | 70 void PlaybackToCanvas(SkCanvas* canvas, |
| 59 const gfx::ColorSpace& canvas_color_space, | 71 const gfx::ColorSpace& canvas_color_space, |
| 60 const gfx::Rect& canvas_bitmap_rect, | 72 const gfx::Rect& canvas_bitmap_rect, |
| 61 const gfx::Rect& canvas_playback_rect, | 73 const gfx::Rect& canvas_playback_rect, |
| 62 float contents_scale, | 74 const gfx::AxisTransform2d& raster_transform, |
| 63 const PlaybackSettings& settings) const; | 75 const PlaybackSettings& settings) const; |
| 64 | 76 |
| 65 // Raster this RasterSource into the given canvas. Canvas states such as | 77 // Raster this RasterSource into the given canvas. Canvas states such as |
| 66 // CTM and clip region will be respected. This function will replace pixels | 78 // CTM and clip region will be respected. This function will replace pixels |
| 67 // in the clip region without blending. It is assumed that existing pixels | 79 // in the clip region without blending. It is assumed that existing pixels |
| 68 // may be uninitialized and will be cleared before playback. | 80 // may be uninitialized and will be cleared before playback. |
| 69 // | 81 // |
| 70 // Virtual for testing. | 82 // Virtual for testing. |
| 71 // | 83 // |
| 72 // Note that this should only be called after the image decode controller has | 84 // Note that this should only be called after the image decode controller has |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 SkPicture::AbortCallback* callback) const; | 171 SkPicture::AbortCallback* callback) const; |
| 160 | 172 |
| 161 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; | 173 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; |
| 162 | 174 |
| 163 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 175 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 164 }; | 176 }; |
| 165 | 177 |
| 166 } // namespace cc | 178 } // namespace cc |
| 167 | 179 |
| 168 #endif // CC_RASTER_RASTER_SOURCE_H_ | 180 #endif // CC_RASTER_RASTER_SOURCE_H_ |
| OLD | NEW |