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

Unified Diff: cc/layers/surface_layer_impl.cc

Issue 2495373003: Match html canvas which is transferred to OffscreenCanvas to CSS style (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/surface_layer_impl.cc
diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc
index 2289a29326f449746f68eb7ddff19fd3a0ba58bf..273734ea4335540121142696821a88f33fc7b33b 100644
--- a/cc/layers/surface_layer_impl.cc
+++ b/cc/layers/surface_layer_impl.cc
@@ -68,7 +68,27 @@ void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass,
SharedQuadState* shared_quad_state =
render_pass->CreateAndAppendSharedQuadState();
- PopulateScaledSharedQuadState(shared_quad_state, surface_scale_);
+ gfx::Transform scaled_draw_transform =
danakj 2016/11/14 20:44:06 New code requires new unit tests of the class.
xlai (Olivia) 2016/11/15 16:36:20 Done.
+ draw_properties().target_space_transform;
+
+ float boundsWidth = bounds().width();
+ float boundsHeight = bounds().height();
+ float surfaceSizeWidth = surface_size_.width();
+ float surfaceSizeHeight = surface_size_.height();
+ float scale_x = surfaceSizeWidth / boundsWidth * surface_scale_;
+ float scale_y = surfaceSizeHeight / boundsHeight * surface_scale_;
+
+ scaled_draw_transform.Scale(SK_MScalar1 / scale_x, SK_MScalar1 / scale_y);
Justin Novosad 2016/11/14 20:41:27 How does this affect other uses of surface_layer?
xlai (Olivia) 2016/11/15 16:36:20 I don't think it will not affect other uses of sur
+
+ gfx::Size scaled_bounds = gfx::ScaleToCeiledSize(bounds(), surface_scale_);
+ gfx::Rect scaled_visible_layer_rect =
+ gfx::ScaleToEnclosingRect(visible_layer_rect(), surface_scale_);
+ scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds));
+
+ shared_quad_state->SetAll(
+ scaled_draw_transform, scaled_bounds, scaled_visible_layer_rect,
+ draw_properties().clip_rect, draw_properties().is_clipped,
+ draw_properties().opacity, draw_blend_mode(), sorting_context_id_);
if (!surface_id_.is_valid())
return;
« no previous file with comments | « no previous file | content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698