Flutter Engine
 
Loading...
Searching...
No Matches
clip_path_layer.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7namespace flutter {
8
9ClipPathLayer::ClipPathLayer(const DlPath& clip_path, Clip clip_behavior)
10 : ClipShapeLayer(clip_path, clip_behavior) {}
11
15
17 bool is_aa = clip_behavior() != Clip::kHardEdge;
18 DlRect rect;
19 if (clip_shape().IsRect(&rect)) {
20 mutator.clipRect(rect, is_aa);
21 } else if (clip_shape().IsOval(&rect)) {
22 mutator.clipRRect(DlRoundRect::MakeOval(rect), is_aa);
23 } else {
24 DlRoundRect rrect;
25 if (clip_shape().IsRoundRect(&rrect)) {
26 mutator.clipRRect(rrect, is_aa);
27 } else {
29 mutator.clipPath(clip_shape(), is_aa);
30 }
31 }
32}
33
34} // namespace flutter
void ApplyClip(LayerStateStack::MutatorContext &mutator) const override
const DlRect clip_shape_bounds() const override
ClipPathLayer(const DlPath &clip_path, Clip clip_behavior=Clip::kAntiAlias)
const ClipShape & clip_shape() const
DlRect GetBounds() const override
Definition dl_path.cc:243
void WillRenderSkPath() const
Definition dl_path.cc:174
void clipPath(const DlPath &path, bool is_aa)
void clipRRect(const DlRoundRect &rrect, bool is_aa)
void clipRect(const DlRect &rect, bool is_aa)
@ kHardEdge
Definition layer.h:43
static RoundRect MakeOval(const Rect &rect)
Definition round_rect.h:23