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

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

Issue 2075873002: Support general raster matrix for RasterSource and DisplayItemList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a bug in PrepareForPlaybackToCanvas and fix cc_unittests Created 4 years, 6 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>
(...skipping 25 matching lines...) Expand all
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> CreateFromRecordingSource(
43 const RecordingSource* other, 43 const RecordingSource* other,
44 bool can_use_lcd_text); 44 bool can_use_lcd_text);
45 45
46 // Raster a subrect of this RasterSource into the given canvas. It is 46 // TODO(trchen): Deprecated.
47 // assumed that contents_scale has already been applied to this canvas. 47 void PlaybackToCanvas(SkCanvas* canvas,
48 // Writes the total number of pixels rasterized and the time spent 48 const gfx::Rect& canvas_bitmap_rect,
49 // rasterizing to the stats if the respective pointer is not nullptr. 49 const gfx::Rect& canvas_playback_rect,
50 // It is assumed that the canvas passed here will only be rasterized by 50 float contents_scale,
51 // this raster source via this call. 51 const PlaybackSettings& settings) const;
52
53 // Raster this RasterSource into the given canvas. Canvas states such as
54 // 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
56 // may be uninitialized and will be cleared before playback.
52 // 57 //
53 // Virtual for testing. 58 // Virtual for testing.
54 // 59 //
55 // Note that this should only be called after the image decode controller has 60 // Note that this should only be called after the image decode controller has
56 // been set, which happens during commit. 61 // been set, which happens during commit.
57 virtual void PlaybackToCanvas(SkCanvas* canvas, 62 virtual void PlaybackToCanvas(SkCanvas* canvas,
58 const gfx::Rect& canvas_bitmap_rect,
59 const gfx::Rect& canvas_playback_rect,
60 float contents_scale,
61 const PlaybackSettings& settings) const; 63 const PlaybackSettings& settings) const;
62 64
63 // Returns whether the given rect at given scale is of solid color in 65 // Returns whether the given rect at given scale is of solid color in
64 // this raster source, as well as the solid color value. 66 // this raster source, as well as the solid color value.
65 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, 67 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect,
66 float contents_scale, 68 float contents_scale,
67 SkColor* color) const; 69 SkColor* color) const;
68 70
69 // Returns true iff the whole raster source is of solid color. 71 // Returns true iff the whole raster source is of solid color.
70 bool IsSolidColor() const; 72 bool IsSolidColor() const;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const int slow_down_raster_scale_factor_for_debug_; 140 const int slow_down_raster_scale_factor_for_debug_;
139 // TODO(enne/vmiura): this has a read/write race between raster and compositor 141 // TODO(enne/vmiura): this has a read/write race between raster and compositor
140 // threads with multi-threaded Ganesh. Make this const or remove it. 142 // threads with multi-threaded Ganesh. Make this const or remove it.
141 bool should_attempt_to_use_distance_field_text_; 143 bool should_attempt_to_use_distance_field_text_;
142 144
143 // In practice, this is only set once before raster begins, so it's ok with 145 // In practice, this is only set once before raster begins, so it's ok with
144 // respect to threading. 146 // respect to threading.
145 ImageDecodeController* image_decode_controller_; 147 ImageDecodeController* image_decode_controller_;
146 148
147 private: 149 private:
148 void RasterCommon(SkCanvas* canvas, 150 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
149 SkPicture::AbortCallback* callback,
150 const gfx::Rect& canvas_bitmap_rect,
151 const gfx::Rect& canvas_playback_rect,
152 float contents_scale) const;
153 151
154 void PrepareForPlaybackToCanvas(SkCanvas* canvas, 152 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const;
155 const gfx::Rect& canvas_bitmap_rect,
156 const gfx::Rect& canvas_playback_rect,
157 float contents_scale) const;
158 153
159 DISALLOW_COPY_AND_ASSIGN(RasterSource); 154 DISALLOW_COPY_AND_ASSIGN(RasterSource);
160 }; 155 };
161 156
162 } // namespace cc 157 } // namespace cc
163 158
164 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ 159 #endif // CC_PLAYBACK_RASTER_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698