• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 // 2021.2.10 Increase the process used in native_view mode.
6 //           Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
7 
8 #include "flutter/flow/ohos_layers/transform_layer.h"
9 
10 #include "flutter/flow/ohos_layers/paint_context.h"
11 
12 namespace flutter::OHOS {
13 
Prepare(const SkMatrix & matrix)14 void TransformLayer::Prepare(const SkMatrix& matrix)
15 {
16     SkMatrix childMatrix;
17     childMatrix.setConcat(matrix, transform_);
18     SkRect childPaintBounds = SkRect::MakeEmpty();
19     PrepareChildren(childMatrix, childPaintBounds);
20     transform_.mapRect(&childPaintBounds);
21     SetPaintBounds(childPaintBounds);
22 }
23 
Paint(const PaintContext & paintContext) const24 void TransformLayer::Paint(const PaintContext& paintContext) const
25 {
26     SkAutoCanvasRestore save(paintContext.skCanvas, true);
27     paintContext.skCanvas->concat(transform_);
28     PaintChildren(paintContext);
29 }
30 
31 }  // namespace flutter::OHOS