Flutter Engine
The Flutter Engine
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 */
25 struct Color {
26 enum Type {
30 };
31 explicit Color(const SkPMColor4f& color)
33 , fColor(color) {}
35 : fType(type)
38 }
39
42 };
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 };
56 }
57
59 uint8_t fCoverage;
60 };
61
62 struct LocalCoords {
63 enum Type {
67 };
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
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr SkPMColor4f SK_PMColor4fILLEGAL
Definition: SkColorData.h:381
GLenum type
DlColor color
GrGeometryProcessor * Make(SkArenaAlloc *, const Color &, const Coverage &, const LocalCoords &, const SkMatrix &viewMatrix)
GrGeometryProcessor * MakeForDeviceSpace(SkArenaAlloc *, const Color &, const Coverage &, const LocalCoords &, const SkMatrix &viewMatrix)
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
LocalCoords(Type type, const SkMatrix *matrix)