Flutter Engine
The Flutter Engine
Functions
SkBlendShader.cpp File Reference
#include "src/shaders/SkBlendShader.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlender.h"
#include "include/core/SkData.h"
#include "include/core/SkFlattenable.h"
#include "include/effects/SkRuntimeEffect.h"
#include "src/base/SkArenaAlloc.h"
#include "src/core/SkBlendModePriv.h"
#include "src/core/SkBlenderBase.h"
#include "src/core/SkEffectPriv.h"
#include "src/core/SkKnownRuntimeEffects.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkRasterPipelineOpContexts.h"
#include "src/core/SkRasterPipelineOpList.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
#include "src/shaders/SkShaderBase.h"
#include <optional>

Go to the source code of this file.

Functions

static float * append_two_shaders (const SkStageRec &rec, const SkShaders::MatrixRec &mRec, SkShader *s0, SkShader *s1)
 
void SkRegisterBlendShaderFlattenable ()
 

Function Documentation

◆ append_two_shaders()

static float * append_two_shaders ( const SkStageRec rec,
const SkShaders::MatrixRec mRec,
SkShader s0,
SkShader s1 
)
static

Definition at line 58 of file SkBlendShader.cpp.

61 {
62 struct Storage {
63 float fCoords[2 * SkRasterPipeline_kMaxStride];
64 float fRes0[4 * SkRasterPipeline_kMaxStride];
65 };
66 auto storage = rec.fAlloc->make<Storage>();
67
68 // Note we cannot simply apply mRec here and then unconditionally store the coordinates. When
69 // building for Android Framework it would interrupt the backwards local matrix concatenation if
70 // mRec had a pending local matrix and either of the children also had a local matrix.
71 // b/256873449
73 rec.fPipeline->append(SkRasterPipelineOp::store_src_rg, storage->fCoords);
74 }
75 if (!as_SB(s0)->appendStages(rec, mRec)) {
76 return nullptr;
77 }
78 rec.fPipeline->append(SkRasterPipelineOp::store_src, storage->fRes0);
79
81 rec.fPipeline->append(SkRasterPipelineOp::load_src_rg, storage->fCoords);
82 }
83 if (!as_SB(s1)->appendStages(rec, mRec)) {
84 return nullptr;
85 }
86 return storage->fRes0;
87}
static constexpr int SkRasterPipeline_kMaxStride
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
Definition: SkArenaAlloc.h:120
void append(SkRasterPipelineOp, void *=nullptr)
virtual bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const =0
bool rasterPipelineCoordsAreSeeded() const
Definition: SkShaderBase.h:130
SkRasterPipeline * fPipeline
Definition: SkEffectPriv.h:21
SkArenaAlloc * fAlloc
Definition: SkEffectPriv.h:22

◆ SkRegisterBlendShaderFlattenable()

void SkRegisterBlendShaderFlattenable ( )

Definition at line 139 of file SkBlendShader.cpp.

139 {
141 // Previous name
142 SkFlattenable::Register("SkShader_Blend", SkBlendShader::CreateProc);
143}
#define SK_REGISTER_FLATTENABLE(type)
static void Register(const char name[], Factory)