Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
utils
SkClipStackUtils.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2019 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
src/utils/SkClipStackUtils.h
"
9
10
#include "
include/core/SkPath.h
"
11
#include "
include/core/SkPathTypes.h
"
12
#include "
include/pathops/SkPathOps.h
"
13
#include "
src/core/SkClipStack.h
"
14
15
enum class
SkClipOp
;
16
17
void
SkClipStack_AsPath
(
const
SkClipStack
& cs,
SkPath
* path) {
18
path->reset();
19
path->setFillType(
SkPathFillType::kInverseEvenOdd
);
20
21
SkClipStack::Iter
iter(cs,
SkClipStack::Iter::kBottom_IterStart
);
22
while
(
const
SkClipStack::Element
* element = iter.
next
()) {
23
if
(element->getDeviceSpaceType() ==
SkClipStack::Element::DeviceSpaceType::kShader
) {
24
// TODO: Handle DeviceSpaceType::kShader somehow; it can't be turned into an SkPath
25
// but perhaps the pdf backend can apply shaders in another way.
26
continue
;
27
}
28
SkPath
operand;
29
if
(element->getDeviceSpaceType() !=
SkClipStack::Element::DeviceSpaceType::kEmpty
) {
30
element->asDeviceSpacePath(&operand);
31
}
32
33
SkClipOp
elementOp = element->getOp();
34
if
(element->isReplaceOp()) {
35
*path = operand;
36
// TODO: Once expanding clip ops are removed, we can switch the iterator to be top
37
// to bottom, which allows us to break here on encountering a replace op.
38
}
else
{
39
Op(*path, operand, (
SkPathOp
)elementOp, path);
40
}
41
}
42
}
SkClipOp
SkClipOp
Definition
SkClipOp.h:13
SkClipStack_AsPath
void SkClipStack_AsPath(const SkClipStack &cs, SkPath *path)
Definition
SkClipStackUtils.cpp:17
SkClipStackUtils.h
SkClipStack.h
SkPathOps.h
SkPathOp
SkPathOp
Definition
SkPathOps.h:22
SkPathTypes.h
SkPathFillType::kInverseEvenOdd
@ kInverseEvenOdd
SkPath.h
SkClipStack::Element
Definition
SkClipStack.h:49
SkClipStack::Element::DeviceSpaceType::kEmpty
@ kEmpty
This element makes the clip empty (regardless of previous elements).
SkClipStack::Element::DeviceSpaceType::kShader
@ kShader
SkClipStack::Iter
Definition
SkClipStack.h:399
SkClipStack::Iter::kBottom_IterStart
@ kBottom_IterStart
Definition
SkClipStack.h:402
SkClipStack::Iter::next
const Element * next()
Definition
SkClipStack.cpp:794
SkClipStack
Definition
SkClipStack.h:32
SkPath
Definition
SkPath.h:59
Generated on Fri Apr 26 2024 06:17:36 for Flutter Engine by
1.9.8