Chromium Code Reviews| 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/recording_source.h" | 16 #include "cc/playback/recording_source.h" |
| 17 #include "skia/ext/analysis_canvas.h" | 17 #include "skia/ext/analysis_canvas.h" |
| 18 #include "third_party/skia/include/core/SkPicture.h" | 18 #include "third_party/skia/include/core/SkPicture.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 class DisplayItemList; | 21 class DisplayItemList; |
| 22 class DrawImage; | 22 class DrawImage; |
| 23 class ImageDecodeController; | 23 class ImageDecodeController; |
| 24 class ScaleTranslate2d; | |
| 24 | 25 |
| 25 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { | 26 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { |
| 26 public: | 27 public: |
| 27 struct CC_EXPORT PlaybackSettings { | 28 struct CC_EXPORT PlaybackSettings { |
| 28 PlaybackSettings(); | 29 PlaybackSettings(); |
| 29 | 30 |
| 30 // If set to true, this indicates that the canvas has already been | 31 // If set to true, this indicates that the canvas has already been |
| 31 // rasterized into. This means that the canvas cannot be cleared safely. | 32 // rasterized into. This means that the canvas cannot be cleared safely. |
| 32 bool playback_to_shared_canvas; | 33 bool playback_to_shared_canvas; |
| 33 | 34 |
| 34 // If set to true, none of the images will be rasterized. | 35 // If set to true, none of the images will be rasterized. |
| 35 bool skip_images; | 36 bool skip_images; |
| 36 | 37 |
| 37 // If set to true, we will use an image hijack canvas, which enables | 38 // If set to true, we will use an image hijack canvas, which enables |
| 38 // compositor image caching. | 39 // compositor image caching. |
| 39 bool use_image_hijack_canvas; | 40 bool use_image_hijack_canvas; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 static scoped_refptr<RasterSource> CreateFromRecordingSource( | 43 static scoped_refptr<RasterSource> CreateFromRecordingSource( |
| 43 const RecordingSource* other, | 44 const RecordingSource* other, |
| 44 bool can_use_lcd_text); | 45 bool can_use_lcd_text); |
| 45 | 46 |
| 46 // TODO(trchen): Deprecated. | 47 // Helper function to apply a few common operations before passing the canvas |
| 48 // to the shorter version. This is useful for rastering into tiles. | |
| 49 // canvas is expected to be backed by a tile, with a default state. | |
| 50 // contents_transform will be applied to the display list, rastering the list | |
| 51 // into the "content space". | |
| 52 // canvas_bitmap_rect defines the extent of the tile in the content space, | |
| 53 // i.e. contents in the rect will be cropped and translated onto the canvas. | |
| 54 // canvas_playback_rect defines the damange rect in the content space. | |
|
enne (OOO)
2016/08/29 20:21:19
It's true that the canvas_playback_rect is the dam
| |
| 47 void PlaybackToCanvas(SkCanvas* canvas, | 55 void PlaybackToCanvas(SkCanvas* canvas, |
| 48 const gfx::Rect& canvas_bitmap_rect, | 56 const gfx::Rect& canvas_bitmap_rect, |
| 49 const gfx::Rect& canvas_playback_rect, | 57 const gfx::Rect& canvas_playback_rect, |
| 50 float contents_scale, | 58 const ScaleTranslate2d& contents_transform, |
| 51 const PlaybackSettings& settings) const; | 59 const PlaybackSettings& settings) const; |
| 52 | 60 |
| 53 // Raster this RasterSource into the given canvas. Canvas states such as | 61 // Raster this RasterSource into the given canvas. Canvas states such as |
| 54 // CTM and clip region will be respected. This function will replace pixels | 62 // CTM and clip region will be respected. This function will replace pixels |
| 55 // in the clip region without blending. It is assumed that existing pixels | 63 // in the clip region without blending. It is assumed that existing pixels |
| 56 // may be uninitialized and will be cleared before playback. | 64 // may be uninitialized and will be cleared before playback. |
| 57 // | 65 // |
| 58 // Virtual for testing. | 66 // Virtual for testing. |
| 59 // | 67 // |
| 60 // Note that this should only be called after the image decode controller has | 68 // Note that this should only be called after the image decode controller has |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; | 173 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; |
| 166 | 174 |
| 167 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; | 175 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; |
| 168 | 176 |
| 169 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 177 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 170 }; | 178 }; |
| 171 | 179 |
| 172 } // namespace cc | 180 } // namespace cc |
| 173 | 181 |
| 174 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ | 182 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ |
| OLD | NEW |