Flutter Engine
The Flutter Engine
GrMatrixEffect.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
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#ifndef GrMatrixEffect_DEFINED
9#define GrMatrixEffect_DEFINED
10
17
18#include <memory>
19#include <utility>
20
21namespace skgpu { class KeyBuilder; }
22struct GrShaderCaps;
23
25public:
26 static std::unique_ptr<GrFragmentProcessor> Make(const SkMatrix& matrix,
27 std::unique_ptr<GrFragmentProcessor> child);
28
29 std::unique_ptr<GrFragmentProcessor> clone() const override;
30 const char* name() const override { return "MatrixEffect"; }
31
32private:
34
35 GrMatrixEffect(SkMatrix matrix, std::unique_ptr<GrFragmentProcessor> child)
37 , fMatrix(matrix) {
38 SkASSERT(child);
39 this->registerChild(std::move(child),
41 }
42
43 std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
44 void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
45 bool onIsEqual(const GrFragmentProcessor&) const override;
46 SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& inputColor) const override {
47 return ConstantOutputForConstantInput(this->childProcessor(0), inputColor);
48 }
49
50 SkMatrix fMatrix;
51
53 using INHERITED = GrFragmentProcessor;
54};
55#endif
#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
#define SkASSERT(cond)
Definition: SkAssert.h:116
GrFragmentProcessor(ClassID classID, OptimizationFlags optimizationFlags)
static OptimizationFlags ProcessorOptimizationFlags(const GrFragmentProcessor *fp)
GrFragmentProcessor * childProcessor(int index)
void registerChild(std::unique_ptr< GrFragmentProcessor > child, SkSL::SampleUsage sampleUsage=SkSL::SampleUsage::PassThrough())
static SkPMColor4f ConstantOutputForConstantInput(const GrFragmentProcessor *fp, const SkPMColor4f &input)
const char * name() const override
std::unique_ptr< GrFragmentProcessor > clone() const override
static std::unique_ptr< GrFragmentProcessor > Make(const SkMatrix &matrix, std::unique_ptr< GrFragmentProcessor > child)
@ kGrMatrixEffect_ClassID
Definition: GrProcessor.h:62
static SampleUsage UniformMatrix(bool hasPerspective)
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
const myers::Point & get(const myers::Segment &)
Definition: GpuTools.h:21