Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
shaders
SkShader.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2006 The Android Open Source Project
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
#include "
include/core/SkShader.h
"
8
9
#include "
include/core/SkMatrix.h
"
10
#include "
include/core/SkRefCnt.h
"
11
#include "
src/shaders/SkColorFilterShader.h
"
12
#include "
src/shaders/SkLocalMatrixShader.h
"
13
#include "
src/shaders/SkShaderBase.h
"
14
#include "
src/shaders/SkWorkingColorSpaceShader.h
"
15
16
#include <utility>
17
18
class
SkColorFilter
;
19
class
SkImage
;
20
enum class
SkTileMode
;
21
22
SkImage
*
SkShader::isAImage
(
SkMatrix
* localMatrix,
SkTileMode
xy[2])
const
{
23
return
as_SB
(
this
)->
onIsAImage
(localMatrix, xy);
24
}
25
26
sk_sp<SkShader>
SkShader::makeWithLocalMatrix
(
const
SkMatrix
& localMatrix)
const
{
27
const
SkMatrix
* lm = &localMatrix;
28
29
sk_sp<SkShader>
baseShader;
30
SkMatrix
otherLocalMatrix;
31
sk_sp<SkShader>
proxy =
as_SB
(
this
)->
makeAsALocalMatrixShader
(&otherLocalMatrix);
32
if
(proxy) {
33
otherLocalMatrix =
SkShaderBase::ConcatLocalMatrices
(localMatrix, otherLocalMatrix);
34
lm = &otherLocalMatrix;
35
baseShader = proxy;
36
}
else
{
37
baseShader =
sk_ref_sp
(
const_cast<
SkShader
*
>
(
this
));
38
}
39
40
return
sk_make_sp<SkLocalMatrixShader>(std::move(baseShader), *lm);
41
}
42
43
sk_sp<SkShader>
SkShader::makeWithColorFilter
(
sk_sp<SkColorFilter>
filter)
const
{
44
SkShader
*
base
=
const_cast<
SkShader
*
>
(
this
);
45
if
(!filter) {
46
return
sk_ref_sp
(
base
);
47
}
48
return
sk_make_sp<SkColorFilterShader>(
sk_ref_sp
(
base
), 1.0f, std::move(filter));
49
}
50
51
sk_sp<SkShader>
SkShader::makeWithWorkingColorSpace
(
sk_sp<SkColorSpace>
workingSpace)
const
{
52
SkShader
*
base
=
const_cast<
SkShader
*
>
(
this
);
53
if
(!workingSpace) {
54
return
sk_ref_sp
(
base
);
55
}
56
return
sk_make_sp<SkWorkingColorSpaceShader>(
sk_ref_sp
(
base
), std::move(workingSpace));
57
}
SkColorFilterShader.h
SkLocalMatrixShader.h
SkMatrix.h
SkRefCnt.h
sk_ref_sp
sk_sp< T > sk_ref_sp(T *obj)
Definition
SkRefCnt.h:381
SkShaderBase.h
as_SB
SkShaderBase * as_SB(SkShader *shader)
Definition
SkShaderBase.h:412
SkShader.h
SkTileMode
SkTileMode
Definition
SkTileMode.h:13
SkWorkingColorSpaceShader.h
SkColorFilter
Definition
SkColorFilter.h:35
SkImage
Definition
SkImage.h:272
SkMatrix
Definition
SkMatrix.h:54
SkShaderBase::ConcatLocalMatrices
static SkMatrix ConcatLocalMatrices(const SkMatrix &parentLM, const SkMatrix &childLM)
Definition
SkShaderBase.h:384
SkShaderBase::onIsAImage
virtual SkImage * onIsAImage(SkMatrix *, SkTileMode[2]) const
Definition
SkShaderBase.h:362
SkShaderBase::makeAsALocalMatrixShader
virtual sk_sp< SkShader > makeAsALocalMatrixShader(SkMatrix *localMatrix) const
Definition
SkShaderBase.cpp:130
SkShader
Definition
SkShader.h:36
SkShader::isAImage
bool isAImage() const
Definition
SkShader.h:52
SkShader::makeWithWorkingColorSpace
sk_sp< SkShader > makeWithWorkingColorSpace(sk_sp< SkColorSpace >) const
Definition
SkShader.cpp:51
SkShader::makeWithColorFilter
sk_sp< SkShader > makeWithColorFilter(sk_sp< SkColorFilter >) const
Definition
SkShader.cpp:43
SkShader::makeWithLocalMatrix
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
Definition
SkShader.cpp:26
sk_sp
Definition
SkRefCnt.h:220
base
Definition
ax_tree_id_registry.h:17
Generated on Fri Apr 26 2024 06:17:28 for Flutter Engine by
1.9.8