mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix Mozart blends of child views (flutter/engine#3248)
We need to compute the paint bounds of ChildViewLayers during Preroll. Also, we need to allocate a BlendPtr before writing into it.
This commit is contained in:
parent
3a1caa55b3
commit
85abbfaa3e
@ -19,6 +19,13 @@ void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
|
||||
transform_.preTranslate(offset_.x(), offset_.y());
|
||||
float inverse_device_pixel_ratio = 1.f / device_pixel_ratio_;
|
||||
transform_.preScale(inverse_device_pixel_ratio, inverse_device_pixel_ratio);
|
||||
|
||||
SkRect bounds = SkRect::MakeXYWH(
|
||||
offset_.x(), offset_.y(),
|
||||
physical_size_.width() * inverse_device_pixel_ratio,
|
||||
physical_size_.height() * inverse_device_pixel_ratio);
|
||||
set_paint_bounds(bounds);
|
||||
context->child_paint_bounds = bounds;
|
||||
}
|
||||
|
||||
void ChildSceneLayer::Paint(PaintContext& context) {
|
||||
|
||||
@ -23,6 +23,7 @@ void OpacityLayer::UpdateScene(SceneUpdateContext& context,
|
||||
node->op = mozart::NodeOp::New();
|
||||
node->op->set_layer(mozart::LayerNodeOp::New());
|
||||
node->op->get_layer()->layer_rect = mozart::RectF::From(paint_bounds());
|
||||
node->op->get_layer()->blend = mozart::Blend::New();
|
||||
node->op->get_layer()->blend->alpha = alpha_;
|
||||
UpdateSceneChildrenInsideNode(context, container, std::move(node));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user