Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrDefaultGeoProcFactory.h
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 */
7
8#ifndef GrDefaultGeoProcFactory_DEFINED
9#define GrDefaultGeoProcFactory_DEFINED
10
13
14#include <cstdint>
15
17class SkArenaAlloc;
18class SkMatrix;
19
20/*
21 * A factory for creating default Geometry Processors which simply multiply position by the uniform
22 * view matrix and wire through color, coverage, UV coords if requested.
23 */
43
44 struct Coverage {
45 enum Type {
50 kAttributeUnclamped_Type, // Fragment shader will call saturate(coverage) before using.
51 // (Not compatible with kAttributeTweakAlpha_Type.)
52 };
53 explicit Coverage(uint8_t coverage) : fType(kUniform_Type), fCoverage(coverage) {}
57
59 uint8_t fCoverage;
60 };
61
62 struct LocalCoords {
69 LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(matrix) {
71 }
72 bool hasLocalMatrix() const { return nullptr != fMatrix; }
73
76 };
77
79 const Color&,
80 const Coverage&,
81 const LocalCoords&,
82 const SkMatrix& viewMatrix);
83
84 /*
85 * Use this factory to create a GrGeometryProcessor that expects a device space vertex position
86 * attribute. The view matrix must still be provided to compute correctly transformed
87 * coordinates for GrFragmentProcessors. It may fail if the view matrix is not invertible.
88 */
90 const Color&,
91 const Coverage&,
92 const LocalCoords&,
93 const SkMatrix& viewMatrix);
94} // namespace GrDefaultGeoProcFactory
95
96#endif
SkColor4f color
#define SkASSERT(cond)
Definition SkAssert.h:116
constexpr SkPMColor4f SK_PMColor4fILLEGAL
GrGeometryProcessor * Make(SkArenaAlloc *, const Color &, const Coverage &, const LocalCoords &, const SkMatrix &viewMatrix)
GrGeometryProcessor * MakeForDeviceSpace(SkArenaAlloc *, const Color &, const Coverage &, const LocalCoords &, const SkMatrix &viewMatrix)
LocalCoords(Type type, const SkMatrix *matrix)