Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4737fc5

Browse files
authored
Initialize OpacityLayer's matrix to identity (#8467) (#8548)
Should have flutter/flutter#30586 fixed once the engine rolls.
1 parent cc11550 commit 4737fc5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

flow/layers/opacity_layer.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ void OpacityLayer::EnsureSingleChild() {
2020
}
2121

2222
auto new_child = std::make_shared<flow::TransformLayer>();
23+
24+
// Be careful: SkMatrix's default constructor doesn't initialize the matrix to
25+
// identity. Hence we have to explicitly call SkMatrix::setIdentity.
26+
SkMatrix identity;
27+
identity.setIdentity();
28+
29+
new_child->set_transform(identity);
2330
for (auto& child : layers()) {
2431
new_child->Add(child);
2532
}

flow/layers/transform_layer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace flow {
1111

12+
// Be careful that SkMatrix's default constructor doesn't initialize the matrix
13+
// at all. Hence |set_transform| must be called with an initialized SkMatrix.
1214
class TransformLayer : public ContainerLayer {
1315
public:
1416
TransformLayer();

0 commit comments

Comments
 (0)