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

Unified Diff: cc/layers/surface_layer_impl.cc

Issue 2495373003: Match html canvas which is transferred to OffscreenCanvas to CSS style (Closed)
Patch Set: spelling error 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
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..5e745648bc5e058137bf0a5f89524941f8df300c 100644
--- a/cc/layers/surface_layer_impl.cc
+++ b/cc/layers/surface_layer_impl.cc
@@ -68,7 +68,26 @@ void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass,
SharedQuadState* shared_quad_state =
render_pass->CreateAndAppendSharedQuadState();
- PopulateScaledSharedQuadState(shared_quad_state, surface_scale_);
+ gfx::Transform scaled_draw_transform =
+ draw_properties().target_space_transform;
+
+ float boundsWidth = bounds().width();
danakj 2016/11/21 23:37:22 chromium style, though I'd drop these 4 temp vars
xlai (Olivia) 2016/11/22 16:55:59 Done. I was trying to force them (integer) to floa
danakj 2016/11/22 19:19:13 Ah, you can use a static cast for that, or use tem
+ float boundsHeight = bounds().height();
+ float surfaceSizeWidth = surface_size_.width();
+ float surfaceSizeHeight = surface_size_.height();
+ float scale_x = surfaceSizeWidth / boundsWidth;
danakj 2016/11/21 23:37:22 why not invert these, and then you don't have to r
xlai (Olivia) 2016/11/22 16:55:59 Done.
+ float scale_y = surfaceSizeHeight / boundsHeight;
+ scaled_draw_transform.Scale(SK_MScalar1 / scale_x, SK_MScalar1 / scale_y);
+
+ gfx::Size scaled_bounds = gfx::ScaleToCeiledSize(bounds(), surface_scale_);
danakj 2016/11/21 23:37:22 I'm very confused what the function of this surfac
xlai (Olivia) 2016/11/22 16:55:59 Actually, this part of code is exactly same as the
danakj 2016/11/22 19:19:13 My feeling is that it doesn't make sense to change
+ 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(
danakj 2016/11/21 23:37:22 If you can't just add params toPopulateScaledShare
xlai (Olivia) 2016/11/22 16:55:59 Done.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698