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

Unified Diff: cc/raster/raster_source.cc

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: nits Created 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/raster/raster_source.cc
diff --git a/cc/raster/raster_source.cc b/cc/raster/raster_source.cc
index 9294cd6a7a75d3158f32cd46cd00d09cd5ec7efb..ebba8286e8912e3fdc3a9c8b23c470c3785e87b2 100644
--- a/cc/raster/raster_source.cc
+++ b/cc/raster/raster_source.cc
@@ -80,7 +80,8 @@ void RasterSource::PlaybackToCanvas(
raster_canvas->clipRect(SkRect::MakeFromIRect(raster_bounds));
raster_canvas->translate(raster_transform.translation().x(),
raster_transform.translation().y());
- raster_canvas->scale(raster_transform.scale(), raster_transform.scale());
+ if (!display_list_->pixel_canvas_enabled())
+ raster_canvas->scale(raster_transform.scale(), raster_transform.scale());
PlaybackToCanvas(raster_canvas, target_color_space, settings);
raster_canvas->restore();
}
@@ -237,17 +238,22 @@ size_t RasterSource::GetMemoryUsage() const {
return display_list_->BytesUsed() + painter_reported_memory_usage_;
}
-bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect,
- float contents_scale,
- SkColor* color) const {
+bool RasterSource::PerformSolidColorAnalysis(
+ gfx::Rect content_rect,
+ const gfx::AxisTransform2d& raster_transform,
+ SkColor* color) const {
TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis");
+ if (display_list_->pixel_canvas_enabled()) {
+ content_rect.Intersect(
+ gfx::ScaleToEnclosingRect(gfx::Rect(size_), raster_transform.scale()));
+ } else {
+ content_rect = gfx::ToEnclosingRect(
+ raster_transform.InverseMapRect(gfx::RectF(content_rect)));
+ content_rect.Intersect(gfx::Rect(size_));
+ }
+ skia::AnalysisCanvas canvas(content_rect.width(), content_rect.height());
+ canvas.translate(-content_rect.x(), -content_rect.y());
- gfx::Rect layer_rect =
- gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale);
-
- layer_rect.Intersect(gfx::Rect(size_));
- skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height());
- canvas.translate(-layer_rect.x(), -layer_rect.y());
// Note that because no color conversion is applied to solid color analysis,
// the resulting solid color will be known to be sRGB.
RasterCommon(&canvas, &canvas);

Powered by Google App Engine
This is Rietveld 408576698