Simplify directly composited rotated images
Prior to this patch, if you had a directly composited 100x50 image and
it respected image-orientation: from-image, this resulted in:
* Blink decoding the image and rastering a bitmap with the rotation
baked in. No image caching or ahead of time decoding.
* A PictureImageLayer with bounds 100x50 and a scale transform on that
layer of (0.5, 2.0, 1.0) which led to a contents scale of 2.0 (the max
scale) and a contents bounds of 200x100.
* An extra scale on the recording to squish the contents to the right
size.
* This path also didn't work in OOP because OOP doesn't support sending raw
bitmaps yet.
This simplifies the path to pass a matrix all the way through to the
resulting PictureImageLayer to handle the transformation at paint time
instead of decoding in Blink. It also sets the bounds correctly on the
PictureImageLayer so no weird scales are needed for images from Blink.
Scales are still needed for masks however, because their bounds must
match the bounds of the layer they are masking.
An alternate path considered here was to not handle the rotation at
paint time and instead do it at compositing time, by baking the image
orientation into the layer transform. However, because these transforms
can involve flips and layers can care about backface-visibility, this
has to be done at paint time to keep this layer's facing unchanged.
Bug: 809147
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ib6b275e8f7d47687336054c78772354ef8855a80
Reviewed-on: https://chromium-review.googlesource.com/912433
Commit-Queue: enne <[email protected]>
Reviewed-by: Chris Harrelson <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Khushal <[email protected]>
Cr-Commit-Position: refs/heads/master@{#536557}
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 9c551267..02aa215 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -51,7 +51,8 @@
sad_layer->SetImage(cc::PaintImageBuilder::WithDefault()
.set_id(cc::PaintImage::kNonLazyStableId)
.set_image(SkImage::MakeFromBitmap(*sad_bitmap))
- .TakePaintImage());
+ .TakePaintImage(),
+ SkMatrix::I(), false);
sad_layer->SetBounds(
gfx::Size(sad_bitmap->width() * device_scale_factor,
sad_bitmap->height() * device_scale_factor));