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

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

Issue 2566613002: [4/5] Add translated rasterization support for PictureLayerTilingSet & below (Closed)
Patch Set: Created 4 years 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/raster_source.h" 5 #include "cc/playback/raster_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 size_t RasterSource::GetPictureMemoryUsage() const { 214 size_t RasterSource::GetPictureMemoryUsage() const {
215 if (!display_list_) 215 if (!display_list_)
216 return 0; 216 return 0;
217 return display_list_->ApproximateMemoryUsage() + 217 return display_list_->ApproximateMemoryUsage() +
218 painter_reported_memory_usage_; 218 painter_reported_memory_usage_;
219 } 219 }
220 220
221 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, 221 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect,
222 const gfx::SizeF& raster_scales, 222 float raster_scale,
223 SkColor* color) const { 223 SkColor* color) const {
224 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); 224 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis");
225 225
226 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( 226 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect(
227 content_rect, 1.f / raster_scales.width(), 1.f / raster_scales.height()); 227 content_rect, 1.f / raster_scale);
228 228
229 layer_rect.Intersect(gfx::Rect(size_)); 229 layer_rect.Intersect(gfx::Rect(size_));
230 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); 230 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height());
231 canvas.translate(-layer_rect.x(), -layer_rect.y()); 231 canvas.translate(-layer_rect.x(), -layer_rect.y());
232 RasterCommon(&canvas, &canvas); 232 RasterCommon(&canvas, &canvas);
233 return canvas.GetColorIfSolid(color); 233 return canvas.GetColorIfSolid(color);
234 } 234 }
235 235
236 void RasterSource::GetDiscardableImagesInRect( 236 void RasterSource::GetDiscardableImagesInRect(
237 const gfx::Rect& layer_rect, 237 const gfx::Rect& layer_rect,
238 const gfx::SizeF& raster_scales, 238 float raster_scale,
239 std::vector<DrawImage>* images) const { 239 std::vector<DrawImage>* images) const {
240 DCHECK_EQ(0u, images->size()); 240 DCHECK_EQ(0u, images->size());
241 display_list_->GetDiscardableImagesInRect(layer_rect, raster_scales, images); 241 display_list_->GetDiscardableImagesInRect(layer_rect, raster_scale, images);
242 } 242 }
243 243
244 bool RasterSource::CoversRect(const gfx::Rect& layer_rect) const { 244 bool RasterSource::CoversRect(const gfx::Rect& layer_rect) const {
245 if (size_.IsEmpty()) 245 if (size_.IsEmpty())
246 return false; 246 return false;
247 gfx::Rect bounded_rect = layer_rect; 247 gfx::Rect bounded_rect = layer_rect;
248 bounded_rect.Intersect(gfx::Rect(size_)); 248 bounded_rect.Intersect(gfx::Rect(size_));
249 return recorded_viewport_.Contains(bounded_rect); 249 return recorded_viewport_.Contains(bounded_rect);
250 } 250 }
251 251
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 bool can_use_lcd_text = false; 304 bool can_use_lcd_text = false;
305 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); 305 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text));
306 } 306 }
307 307
308 RasterSource::PlaybackSettings::PlaybackSettings() 308 RasterSource::PlaybackSettings::PlaybackSettings()
309 : playback_to_shared_canvas(false), 309 : playback_to_shared_canvas(false),
310 skip_images(false), 310 skip_images(false),
311 use_image_hijack_canvas(true) {} 311 use_image_hijack_canvas(true) {}
312 312
313 } // namespace cc 313 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698