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

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

Issue 1418573002: cc: Add image decode control in the compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « cc/playback/display_item_list.cc ('k') | cc/playback/display_list_raster_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.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/display_list_recording_source.h" 16 #include "cc/playback/display_list_recording_source.h"
17 #include "skia/ext/analysis_canvas.h" 17 #include "skia/ext/analysis_canvas.h"
18 #include "skia/ext/refptr.h" 18 #include "skia/ext/refptr.h"
19 #include "third_party/skia/include/core/SkPicture.h" 19 #include "third_party/skia/include/core/SkPicture.h"
20 20
21 namespace cc { 21 namespace cc {
22 class DisplayItemList; 22 class DisplayItemList;
23 class DrawImage; 23 class DrawImage;
24 class ImageDecodeController;
24 25
25 class CC_EXPORT DisplayListRasterSource 26 class CC_EXPORT DisplayListRasterSource
26 : public base::RefCountedThreadSafe<DisplayListRasterSource> { 27 : public base::RefCountedThreadSafe<DisplayListRasterSource> {
27 public: 28 public:
28 static scoped_refptr<DisplayListRasterSource> 29 static scoped_refptr<DisplayListRasterSource>
29 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other, 30 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other,
30 bool can_use_lcd_text); 31 bool can_use_lcd_text);
31 32
32 // Raster a subrect of this RasterSource into the given canvas. It is 33 // Raster a subrect of this RasterSource into the given canvas. It is
33 // assumed that contents_scale has already been applied to this canvas. 34 // assumed that contents_scale has already been applied to this canvas.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 virtual void DidBeginTracing(); 96 virtual void DidBeginTracing();
96 virtual void AsValueInto(base::trace_event::TracedValue* array) const; 97 virtual void AsValueInto(base::trace_event::TracedValue* array) const;
97 virtual skia::RefPtr<SkPicture> GetFlattenedPicture(); 98 virtual skia::RefPtr<SkPicture> GetFlattenedPicture();
98 virtual size_t GetPictureMemoryUsage() const; 99 virtual size_t GetPictureMemoryUsage() const;
99 100
100 // Return true if LCD anti-aliasing may be used when rastering text. 101 // Return true if LCD anti-aliasing may be used when rastering text.
101 virtual bool CanUseLCDText() const; 102 virtual bool CanUseLCDText() const;
102 103
103 scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const; 104 scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const;
104 105
106 // Image decode controller should be set once. Its lifetime has to exceed that
107 // of the raster source, since the raster source will access it during raster.
108 void SetImageDecodeController(ImageDecodeController* image_decode_controller);
109
105 protected: 110 protected:
106 friend class base::RefCountedThreadSafe<DisplayListRasterSource>; 111 friend class base::RefCountedThreadSafe<DisplayListRasterSource>;
107 112
108 DisplayListRasterSource(const DisplayListRecordingSource* other, 113 DisplayListRasterSource(const DisplayListRecordingSource* other,
109 bool can_use_lcd_text); 114 bool can_use_lcd_text);
110 DisplayListRasterSource(const DisplayListRasterSource* other, 115 DisplayListRasterSource(const DisplayListRasterSource* other,
111 bool can_use_lcd_text); 116 bool can_use_lcd_text);
112 virtual ~DisplayListRasterSource(); 117 virtual ~DisplayListRasterSource();
113 118
114 // These members are const as this raster source may be in use on another 119 // These members are const as this raster source may be in use on another
115 // thread and so should not be touched after construction. 120 // thread and so should not be touched after construction.
116 const scoped_refptr<DisplayItemList> display_list_; 121 const scoped_refptr<DisplayItemList> display_list_;
117 const size_t painter_reported_memory_usage_; 122 const size_t painter_reported_memory_usage_;
118 const SkColor background_color_; 123 const SkColor background_color_;
119 const bool requires_clear_; 124 const bool requires_clear_;
120 const bool can_use_lcd_text_; 125 const bool can_use_lcd_text_;
121 const bool is_solid_color_; 126 const bool is_solid_color_;
122 const SkColor solid_color_; 127 const SkColor solid_color_;
123 const gfx::Rect recorded_viewport_; 128 const gfx::Rect recorded_viewport_;
124 const gfx::Size size_; 129 const gfx::Size size_;
125 const bool clear_canvas_with_debug_color_; 130 const bool clear_canvas_with_debug_color_;
126 const int slow_down_raster_scale_factor_for_debug_; 131 const int slow_down_raster_scale_factor_for_debug_;
127 // TODO(enne/vmiura): this has a read/write race between raster and compositor 132 // TODO(enne/vmiura): this has a read/write race between raster and compositor
128 // threads with multi-threaded Ganesh. Make this const or remove it. 133 // threads with multi-threaded Ganesh. Make this const or remove it.
129 bool should_attempt_to_use_distance_field_text_; 134 bool should_attempt_to_use_distance_field_text_;
130 135
136 // In practice, this is only set once before raster begins, so it's ok with
137 // respect to threading.
138 ImageDecodeController* image_decode_controller_;
139
131 private: 140 private:
132 // Called when analyzing a tile. We can use AnalysisCanvas as 141 // Called when analyzing a tile. We can use AnalysisCanvas as
133 // SkPicture::AbortCallback, which allows us to early out from analysis. 142 // SkPicture::AbortCallback, which allows us to early out from analysis.
134 void RasterForAnalysis(skia::AnalysisCanvas* canvas, 143 void RasterForAnalysis(skia::AnalysisCanvas* canvas,
135 const gfx::Rect& canvas_rect, 144 const gfx::Rect& canvas_rect,
136 float contents_scale) const; 145 float contents_scale) const;
137 146
138 void RasterCommon(SkCanvas* canvas, 147 void RasterCommon(SkCanvas* canvas,
139 SkPicture::AbortCallback* callback, 148 SkPicture::AbortCallback* callback,
140 const gfx::Rect& canvas_bitmap_rect, 149 const gfx::Rect& canvas_bitmap_rect,
141 const gfx::Rect& canvas_playback_rect, 150 const gfx::Rect& canvas_playback_rect,
142 float contents_scale) const; 151 float contents_scale) const;
143 152
144 void PrepareForPlaybackToCanvas(SkCanvas* canvas, 153 void PrepareForPlaybackToCanvas(SkCanvas* canvas,
145 const gfx::Rect& canvas_bitmap_rect, 154 const gfx::Rect& canvas_bitmap_rect,
146 const gfx::Rect& canvas_playback_rect, 155 const gfx::Rect& canvas_playback_rect,
147 float contents_scale) const; 156 float contents_scale) const;
148 157
149 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); 158 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource);
150 }; 159 };
151 160
152 } // namespace cc 161 } // namespace cc
153 162
154 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ 163 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/playback/display_item_list.cc ('k') | cc/playback/display_list_raster_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698