Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: cc/playback/raster_source.h

Issue 2141233002: cc: Clean up RecordingSource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/layers/picture_layer.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 24
25 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { 25 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
26 public: 26 public:
27 struct CC_EXPORT PlaybackSettings { 27 struct CC_EXPORT PlaybackSettings {
28 PlaybackSettings(); 28 PlaybackSettings();
29 29
30 // If set to true, this indicates that the canvas has already been 30 // If set to true, this indicates that the canvas has already been
31 // rasterized into. This means that the canvas cannot be cleared safely. 31 // rasterized into. This means that the canvas cannot be cleared safely.
32 bool playback_to_shared_canvas; 32 bool playback_to_shared_canvas;
33 33
34 // If set to true, none of the images will be rasterized. 34 // If set to true, none of the images will be rasterized.
35 bool skip_images; 35 bool skip_images;
36 36
37 // If set to true, we will use an image hijack canvas, which enables 37 // If set to true, we will use an image hijack canvas, which enables
38 // compositor image caching. 38 // compositor image caching.
39 bool use_image_hijack_canvas; 39 bool use_image_hijack_canvas;
40 }; 40 };
41 41
42 static scoped_refptr<RasterSource> CreateFromRecordingSource( 42 static scoped_refptr<RasterSource> CreateFromDataStruct(
43 const RecordingSource* other, 43 const PictureLayerData& layer_data,
44 const ContentLayerClientData& client_data,
44 bool can_use_lcd_text); 45 bool can_use_lcd_text);
45 46
46 // TODO(trchen): Deprecated. 47 // TODO(trchen): Deprecated.
47 void PlaybackToCanvas(SkCanvas* canvas, 48 void PlaybackToCanvas(SkCanvas* canvas,
48 const gfx::Rect& canvas_bitmap_rect, 49 const gfx::Rect& canvas_bitmap_rect,
49 const gfx::Rect& canvas_playback_rect, 50 const gfx::Rect& canvas_playback_rect,
50 float contents_scale, 51 float contents_scale,
51 const PlaybackSettings& settings) const; 52 const PlaybackSettings& settings) const;
52 53
53 // Raster this RasterSource into the given canvas. Canvas states such as 54 // Raster this RasterSource into the given canvas. Canvas states such as
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const; 116 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const;
116 117
117 // Image decode controller should be set once. Its lifetime has to exceed that 118 // Image decode controller should be set once. Its lifetime has to exceed that
118 // of the raster source, since the raster source will access it during raster. 119 // of the raster source, since the raster source will access it during raster.
119 void SetImageDecodeController(ImageDecodeController* image_decode_controller); 120 void SetImageDecodeController(ImageDecodeController* image_decode_controller);
120 121
121 protected: 122 protected:
122 friend class base::RefCountedThreadSafe<RasterSource>; 123 friend class base::RefCountedThreadSafe<RasterSource>;
123 124
124 RasterSource(const RecordingSource* other, bool can_use_lcd_text); 125 RasterSource(const PictureLayerData& layer_data,
126 const ContentLayerClientData& client_data,
127 bool can_use_lcd_text);
125 RasterSource(const RasterSource* other, bool can_use_lcd_text); 128 RasterSource(const RasterSource* other, bool can_use_lcd_text);
126 virtual ~RasterSource(); 129 virtual ~RasterSource();
127 130
128 // These members are const as this raster source may be in use on another 131 // These members are const as this raster source may be in use on another
129 // thread and so should not be touched after construction. 132 // thread and so should not be touched after construction.
130 const scoped_refptr<DisplayItemList> display_list_; 133 const scoped_refptr<DisplayItemList> display_list_;
131 const size_t painter_reported_memory_usage_; 134 const size_t painter_reported_memory_usage_;
132 const SkColor background_color_; 135 const SkColor background_color_;
133 const bool requires_clear_; 136 const bool requires_clear_;
134 const bool can_use_lcd_text_; 137 const bool can_use_lcd_text_;
(...skipping 15 matching lines...) Expand all
150 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; 153 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
151 154
152 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; 155 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const;
153 156
154 DISALLOW_COPY_AND_ASSIGN(RasterSource); 157 DISALLOW_COPY_AND_ASSIGN(RasterSource);
155 }; 158 };
156 159
157 } // namespace cc 160 } // namespace cc
158 161
159 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ 162 #endif // CC_PLAYBACK_RASTER_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698