Flutter Engine
The Flutter Engine
SkLocalMatrixShader.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 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 */
8
11
12class SkImage;
13enum class SkTileMode;
14struct SkStageRec;
15
17 return as_SB(fWrappedShader)->isConstant();
18}
19
21 SkMatrix* localMatrix) const {
22 GradientType type = as_SB(fWrappedShader)->asGradient(info, localMatrix);
25 }
26 return type;
27}
28
29sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) {
30 SkMatrix lm;
31 buffer.readMatrix(&lm);
32 auto baseShader(buffer.readShader());
33 if (!baseShader) {
34 return nullptr;
35 }
36 return baseShader->makeWithLocalMatrix(lm);
37}
38
40 buffer.writeMatrix(fLocalMatrix);
41 buffer.writeFlattenable(fWrappedShader.get());
42}
43
44#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
45SkShaderBase::Context* SkLocalMatrixShader::onMakeContext(const ContextRec& rec,
46 SkArenaAlloc* alloc) const {
47 return as_SB(fWrappedShader)->makeContext(ContextRec::Concat(rec, fLocalMatrix), alloc);
48}
49#endif
50
52 SkMatrix imageMatrix;
53 SkImage* image = fWrappedShader->isAImage(&imageMatrix, mode);
54 if (image && outMatrix) {
55 *outMatrix = ConcatLocalMatrices(fLocalMatrix, imageMatrix);
56 }
57
58 return image;
59}
60
62 return as_SB(fWrappedShader)->asLuminanceColor(color);
63}
64
66 const SkShaders::MatrixRec& mRec) const {
67 return as_SB(fWrappedShader)->appendStages(rec, mRec.concat(fLocalMatrix));
68}
69
70////////////////////////////////////////////////////////////////////
71
73 : fProxyShader(std::move(proxy)), fCTM(ctm) {}
74
76 return as_SB(fProxyShader)->isConstant();
77}
78
80 SkMatrix* localMatrix) const {
81 return as_SB(fProxyShader)->asGradient(info, localMatrix);
82}
83
85 return as_SB(fProxyShader)->appendRootStages(rec, fCTM);
86}
87
88sk_sp<SkFlattenable> SkCTMShader::CreateProc(SkReadBuffer& buffer) {
89 SkASSERT(false);
90 return nullptr;
91}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
SkTileMode
Definition: SkTileMode.h:13
SkCTMShader(sk_sp< SkShader > proxy, const SkMatrix &ctm)
bool appendStages(const SkStageRec &rec, const SkShaders::MatrixRec &) const override
bool isConstant() const override
GradientType asGradient(GradientInfo *info, SkMatrix *localMatrix) const override
bool onAsLuminanceColor(SkColor4f *) const override
bool isConstant() const override
const SkMatrix & localMatrix() const
bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const override
SkImage * onIsAImage(SkMatrix *matrix, SkTileMode *mode) const override
void flatten(SkWriteBuffer &) const override
GradientType asGradient(GradientInfo *info, SkMatrix *localMatrix) const override
ShaderType type() const override
virtual GradientType asGradient(GradientInfo *info=nullptr, SkMatrix *localMatrix=nullptr) const
Definition: SkShaderBase.h:255
virtual bool isConstant() const
Definition: SkShaderBase.h:197
bool appendRootStages(const SkStageRec &rec, const SkMatrix &ctm) const
bool asLuminanceColor(SkColor4f *) const
static SkMatrix ConcatLocalMatrices(const SkMatrix &parentLM, const SkMatrix &childLM)
Definition: SkShaderBase.h:384
Context * makeContext(const ContextRec &, SkArenaAlloc *) const
virtual bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const =0
SkImage * isAImage(SkMatrix *localMatrix, SkTileMode xy[2]) const
Definition: SkShader.cpp:22
MatrixRec concat(const SkMatrix &m) const
T * get() const
Definition: SkRefCnt.h:303
DlColor color
sk_sp< const SkImage > image
Definition: SkRecords.h:269
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
Definition: ref_ptr.h:256
static ContextRec Concat(const ContextRec &parentRec, const SkMatrix &localM)
Definition: SkShaderBase.h:280