mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Revert "[fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (#9289)" This reverts commit f80ac5f571479053b134e60bca77603269b2ce2a. * Revert "Align fuchsia and non-fuchsia tracing (#9199)" This reverts commit 78265484623037c6544dfd5380367bca29fa27b0.
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "flutter/flow/layers/shader_mask_layer.h"
|
|
|
|
namespace flutter {
|
|
|
|
ShaderMaskLayer::ShaderMaskLayer(sk_sp<SkShader> shader,
|
|
const SkRect& mask_rect,
|
|
SkBlendMode blend_mode)
|
|
: shader_(shader), mask_rect_(mask_rect), blend_mode_(blend_mode) {}
|
|
|
|
ShaderMaskLayer::~ShaderMaskLayer() = default;
|
|
|
|
void ShaderMaskLayer::Paint(PaintContext& context) const {
|
|
TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint");
|
|
FML_DCHECK(needs_painting());
|
|
|
|
Layer::AutoSaveLayer save =
|
|
Layer::AutoSaveLayer::Create(context, paint_bounds(), nullptr);
|
|
PaintChildren(context);
|
|
|
|
SkPaint paint;
|
|
paint.setBlendMode(blend_mode_);
|
|
paint.setShader(shader_);
|
|
context.leaf_nodes_canvas->translate(mask_rect_.left(), mask_rect_.top());
|
|
context.leaf_nodes_canvas->drawRect(
|
|
SkRect::MakeWH(mask_rect_.width(), mask_rect_.height()), paint);
|
|
}
|
|
|
|
} // namespace flutter
|