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

Side by Side Diff: cc/playback/display_list_recording_source.cc

Issue 1405883002: cc: Remove the base RasterSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: :/ Created 5 years, 2 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 #include "cc/playback/display_list_recording_source.h" 5 #include "cc/playback/display_list_recording_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/numerics/safe_math.h" 9 #include "base/numerics/safe_math.h"
10 #include "cc/base/histograms.h" 10 #include "cc/base/histograms.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const { 223 bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const {
224 // The display list needs to be created (see: UpdateAndExpandInvalidation) 224 // The display list needs to be created (see: UpdateAndExpandInvalidation)
225 // before checking for suitability. There are cases where an update will not 225 // before checking for suitability. There are cases where an update will not
226 // create a display list (e.g., if the size is empty). We return true in these 226 // create a display list (e.g., if the size is empty). We return true in these
227 // cases because the gpu suitability bit sticks false. 227 // cases because the gpu suitability bit sticks false.
228 return !display_list_ || display_list_->IsSuitableForGpuRasterization(); 228 return !display_list_ || display_list_->IsSuitableForGpuRasterization();
229 } 229 }
230 230
231 scoped_refptr<RasterSource> DisplayListRecordingSource::CreateRasterSource( 231 scoped_refptr<DisplayListRasterSource>
232 bool can_use_lcd_text) const { 232 DisplayListRecordingSource::CreateRasterSource(bool can_use_lcd_text) const {
233 return scoped_refptr<RasterSource>( 233 return scoped_refptr<DisplayListRasterSource>(
234 DisplayListRasterSource::CreateFromDisplayListRecordingSource( 234 DisplayListRasterSource::CreateFromDisplayListRecordingSource(
235 this, can_use_lcd_text)); 235 this, can_use_lcd_text));
236 } 236 }
237 237
238 void DisplayListRecordingSource::DetermineIfSolidColor() { 238 void DisplayListRecordingSource::DetermineIfSolidColor() {
239 DCHECK(display_list_); 239 DCHECK(display_list_);
240 is_solid_color_ = false; 240 is_solid_color_ = false;
241 solid_color_ = SK_ColorTRANSPARENT; 241 solid_color_ = SK_ColorTRANSPARENT;
242 242
243 if (!display_list_->ShouldBeAnalyzedForSolidColor()) 243 if (!display_list_->ShouldBeAnalyzedForSolidColor())
244 return; 244 return;
245 245
246 gfx::Size layer_size = GetSize(); 246 gfx::Size layer_size = GetSize();
247 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); 247 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height());
248 display_list_->Raster(&canvas, nullptr, gfx::Rect(), 1.f); 248 display_list_->Raster(&canvas, nullptr, gfx::Rect(), 1.f);
249 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); 249 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_);
250 } 250 }
251 251
252 void DisplayListRecordingSource::Clear() { 252 void DisplayListRecordingSource::Clear() {
253 recorded_viewport_ = gfx::Rect(); 253 recorded_viewport_ = gfx::Rect();
254 display_list_ = nullptr; 254 display_list_ = nullptr;
255 painter_reported_memory_usage_ = 0; 255 painter_reported_memory_usage_ = 0;
256 is_solid_color_ = false; 256 is_solid_color_ = false;
257 } 257 }
258 258
259 } // namespace cc 259 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698