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

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

Issue 1531013004: cc: Do solid color analysis before scheduling tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test. Created 4 years, 11 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_DISPLAY_LIST_RASTER_SOURCE_H_ 5 #ifndef CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
6 #define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ 6 #define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "cc/debug/rendering_stats_instrumentation.h" 12 #include "cc/debug/rendering_stats_instrumentation.h"
13 #include "cc/playback/display_list_recording_source.h" 13 #include "cc/playback/display_list_recording_source.h"
14 #include "skia/ext/analysis_canvas.h" 14 #include "skia/ext/analysis_canvas.h"
15 #include "skia/ext/refptr.h" 15 #include "skia/ext/refptr.h"
16 #include "third_party/skia/include/core/SkPicture.h" 16 #include "third_party/skia/include/core/SkPicture.h"
17 17
18 namespace cc { 18 namespace cc {
19 class DisplayItemList; 19 class DisplayItemList;
20 class DrawImage; 20 class DrawImage;
21 21
22 class CC_EXPORT DisplayListRasterSource 22 class CC_EXPORT DisplayListRasterSource
23 : public base::RefCountedThreadSafe<DisplayListRasterSource> { 23 : public base::RefCountedThreadSafe<DisplayListRasterSource> {
24 public: 24 public:
25 struct CC_EXPORT SolidColorAnalysis {
26 SolidColorAnalysis()
27 : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {}
28 ~SolidColorAnalysis() {}
29
30 bool is_solid_color;
31 SkColor solid_color;
32 };
33
34 static scoped_refptr<DisplayListRasterSource> 25 static scoped_refptr<DisplayListRasterSource>
35 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other, 26 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other,
36 bool can_use_lcd_text); 27 bool can_use_lcd_text);
37 28
38 // Raster a subrect of this RasterSource into the given canvas. It is 29 // Raster a subrect of this RasterSource into the given canvas. It is
39 // assumed that contents_scale has already been applied to this canvas. 30 // assumed that contents_scale has already been applied to this canvas.
40 // Writes the total number of pixels rasterized and the time spent 31 // Writes the total number of pixels rasterized and the time spent
41 // rasterizing to the stats if the respective pointer is not nullptr. 32 // rasterizing to the stats if the respective pointer is not nullptr.
42 // It is assumed that the canvas passed here will only be rasterized by 33 // It is assumed that the canvas passed here will only be rasterized by
43 // this raster source via this call. 34 // this raster source via this call.
44 // virtual for testing. 35 // virtual for testing.
45 virtual void PlaybackToCanvas(SkCanvas* canvas, 36 virtual void PlaybackToCanvas(SkCanvas* canvas,
46 const gfx::Rect& canvas_bitmap_rect, 37 const gfx::Rect& canvas_bitmap_rect,
47 const gfx::Rect& canvas_playback_rect, 38 const gfx::Rect& canvas_playback_rect,
48 float contents_scale) const; 39 float contents_scale) const;
49 40
50 // Similar to above, except that the canvas passed here can (or was already) 41 // Similar to above, except that the canvas passed here can (or was already)
51 // rasterized into by another raster source. That is, it is not safe to clear 42 // rasterized into by another raster source. That is, it is not safe to clear
52 // the canvas or discard its underlying memory. 43 // the canvas or discard its underlying memory.
53 void PlaybackToSharedCanvas(SkCanvas* canvas, 44 void PlaybackToSharedCanvas(SkCanvas* canvas,
54 const gfx::Rect& canvas_rect, 45 const gfx::Rect& canvas_rect,
55 float contents_scale) const; 46 float contents_scale) const;
56 47
57 // Analyze to determine if the given rect at given scale is of solid color in 48 // Analyze to determine if the given rect at given scale is of solid color in
58 // this raster source. 49 // this raster source.
59 void PerformSolidColorAnalysis(const gfx::Rect& content_rect, 50 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect,
vmpstr 2016/01/06 19:35:03 nit: Can you make a comment about the return value
sohanjg 2016/01/07 10:13:00 Done.
60 float contents_scale, 51 float contents_scale,
61 SolidColorAnalysis* analysis) const; 52 SkColor* color) const;
62 53
63 // Returns true iff the whole raster source is of solid color. 54 // Returns true iff the whole raster source is of solid color.
64 bool IsSolidColor() const; 55 bool IsSolidColor() const;
65 56
66 // Returns the color of the raster source if it is solid color. The results 57 // Returns the color of the raster source if it is solid color. The results
67 // are unspecified if IsSolidColor returns false. 58 // are unspecified if IsSolidColor returns false.
68 SkColor GetSolidColor() const; 59 SkColor GetSolidColor() const;
69 60
70 // Returns the size of this raster source. 61 // Returns the size of this raster source.
71 gfx::Size GetSize() const; 62 gfx::Size GetSize() const;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const gfx::Rect& canvas_bitmap_rect, 140 const gfx::Rect& canvas_bitmap_rect,
150 const gfx::Rect& canvas_playback_rect, 141 const gfx::Rect& canvas_playback_rect,
151 float contents_scale) const; 142 float contents_scale) const;
152 143
153 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); 144 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource);
154 }; 145 };
155 146
156 } // namespace cc 147 } // namespace cc
157 148
158 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ 149 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698