Skip to content

Commit

Permalink
Initialize OpacityLayer's matrix to identity (flutter#8467)
Browse files Browse the repository at this point in the history
Should have flutter/flutter#30586 fixed once the engine rolls.
  • Loading branch information
liyuqian authored Apr 6, 2019
1 parent 7fd4caf commit 0c2a2c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flow/layers/opacity_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ void OpacityLayer::EnsureSingleChild() {
}

auto new_child = std::make_shared<flow::TransformLayer>();

// Be careful: SkMatrix's default constructor doesn't initialize the matrix to
// identity. Hence we have to explicitly call SkMatrix::setIdentity.
SkMatrix identity;
identity.setIdentity();

new_child->set_transform(identity);
for (auto& child : layers()) {
new_child->Add(child);
}
Expand Down
2 changes: 2 additions & 0 deletions flow/layers/transform_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace flow {

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

0 comments on commit 0c2a2c1

Please sign in to comment.