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(); |
30 PlaybackSettings(const PlaybackSettings&); | 31 PlaybackSettings(const PlaybackSettings&); |
31 PlaybackSettings(PlaybackSettings&&); | 32 PlaybackSettings(PlaybackSettings&&); |
32 ~PlaybackSettings(); | 33 ~PlaybackSettings(); |
33 | 34 |
34 // If set to true, this indicates that the canvas has already been | 35 // If set to true, this indicates that the canvas has already been |
35 // rasterized into. This means that the canvas cannot be cleared safely. | 36 // rasterized into. This means that the canvas cannot be cleared safely. |
36 bool playback_to_shared_canvas; | 37 bool playback_to_shared_canvas; |
37 | 38 |
38 // If set to true, none of the images will be rasterized. | 39 // If set to true, none of the images will be rasterized. |
39 bool skip_images; | 40 bool skip_images; |
40 | 41 |
41 // If set to true, we will use an image hijack canvas, which enables | 42 // If set to true, we will use an image hijack canvas, which enables |
42 // compositor image caching. | 43 // compositor image caching. |
43 bool use_image_hijack_canvas; | 44 bool use_image_hijack_canvas; |
44 | 45 |
46 // If set, use a SkColorSpaceXformCanvas to specify a transform all inputs | |
47 // to this color space. | |
48 gfx::ColorSpace target_color_space; | |
enne (OOO)
2017/03/15 22:15:40
Maybe I'm missing something, but would it make sen
ccameron
2017/03/16 05:11:34
That makes a lot of sense -- we can then the color
| |
49 | |
45 // If non-empty, an image hijack canvas will be used to skip these images | 50 // If non-empty, an image hijack canvas will be used to skip these images |
46 // during raster. | 51 // during raster. |
47 // TODO(khushalsagar): Consolidate more settings for playback here? See | 52 // TODO(khushalsagar): Consolidate more settings for playback here? See |
48 // crbug.com/691076. | 53 // crbug.com/691076. |
49 ImageIdFlatSet images_to_skip; | 54 ImageIdFlatSet images_to_skip; |
50 }; | 55 }; |
51 | 56 |
52 static scoped_refptr<RasterSource> CreateFromRecordingSource( | 57 static scoped_refptr<RasterSource> CreateFromRecordingSource( |
53 const RecordingSource* other, | 58 const RecordingSource* other, |
54 bool can_use_lcd_text); | 59 bool can_use_lcd_text); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 const gfx::Rect recorded_viewport_; | 149 const gfx::Rect recorded_viewport_; |
145 const gfx::Size size_; | 150 const gfx::Size size_; |
146 const bool clear_canvas_with_debug_color_; | 151 const bool clear_canvas_with_debug_color_; |
147 const int slow_down_raster_scale_factor_for_debug_; | 152 const int slow_down_raster_scale_factor_for_debug_; |
148 | 153 |
149 // In practice, this is only set once before raster begins, so it's ok with | 154 // In practice, this is only set once before raster begins, so it's ok with |
150 // respect to threading. | 155 // respect to threading. |
151 ImageDecodeCache* image_decode_cache_; | 156 ImageDecodeCache* image_decode_cache_; |
152 | 157 |
153 private: | 158 private: |
154 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; | 159 void RasterCommon(SkCanvas* canvas, |
160 const gfx::ColorSpace& target_color_space, | |
161 SkPicture::AbortCallback* callback) const; | |
155 | 162 |
156 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; | 163 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; |
157 | 164 |
158 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 165 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
159 }; | 166 }; |
160 | 167 |
161 } // namespace cc | 168 } // namespace cc |
162 | 169 |
163 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ | 170 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ |
OLD | NEW |