OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrCoordTransform_DEFINED | 8 #ifndef GrCoordTransform_DEFINED |
9 #define GrCoordTransform_DEFINED | 9 #define GrCoordTransform_DEFINED |
10 | 10 |
11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
14 #include "GrTypes.h" | 14 #include "GrTypes.h" |
15 #include "GrShaderVar.h" | 15 #include "GrShaderVar.h" |
16 | 16 |
17 /** | 17 /** |
18 * Coordinates available to GrProcessor subclasses for requesting transformation
s. Transformed | 18 * Coordinates available to GrProcessor subclasses for requesting transformation
s. Transformed |
19 * coordinates are made available in the the portion of fragment shader emitted
by the effect. | 19 * coordinates are made available in the the portion of fragment shader emitted
by the effect. |
20 * | 20 * |
21 * The precision of the shader var that interpolates the transformed coordinates
can be specified. | 21 * The precision of the shader var that interpolates the transformed coordinates
can be specified. |
22 */ | 22 */ |
23 enum GrCoordSet { | 23 enum GrCoordSet { |
24 /** | 24 /** |
25 * The user-space coordinates that map to the fragment being rendered. These
coords account for | 25 * The user-space coordinates that map to the fragment being rendered. This
is the space in |
26 * any change of coordinate system done on the CPU by GrContext before rende
ring, and also are | 26 * which SkShader operates. It is usually the space in which geometry passed
to SkCanvas is |
27 * correct for draws that take explicit local coords rather than inferring t
hem from the | 27 * specified (before the view matrix is applied). However, some draw calls t
ake explicit local |
28 * primitive's positions (e.g. drawVertices). These are usually the coords a
GrProcessor wants. | 28 * coords that map onto the geometry (e.g. drawVertices, drawBitmapRectToRec
t). |
29 */ | 29 */ |
30 kLocal_GrCoordSet, | 30 kLocal_GrCoordSet, |
31 | 31 |
32 /** | 32 /** |
33 * The actual vertex position. Note that GrContext may not draw using the or
iginal view matrix | 33 * The device space position of the fragment being shaded. |
34 * specified by the caller, as it may have transformed vertices into another
space. These are | |
35 * usually not the coordinates a GrProcessor wants. | |
36 */ | |
37 kPosition_GrCoordSet, | |
38 | |
39 /** | |
40 * The position after it has been transformed by the view matrix. | |
41 */ | 34 */ |
42 kDevice_GrCoordSet, | 35 kDevice_GrCoordSet, |
43 }; | 36 }; |
44 | 37 |
45 /** | 38 /** |
46 * A class representing a linear transformation from one of the built-in coordin
ate sets (local or | 39 * A class representing a linear transformation from one of the built-in coordin
ate sets (local or |
47 * position). GrProcessors just define these transformations, and the framework
does the rest of the | 40 * position). GrProcessors just define these transformations, and the framework
does the rest of the |
48 * work to make the transformed coordinates available in their fragment shader. | 41 * work to make the transformed coordinates available in their fragment shader. |
49 */ | 42 */ |
50 class GrCoordTransform : SkNoncopyable { | 43 class GrCoordTransform : SkNoncopyable { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 138 |
146 #ifdef SK_DEBUG | 139 #ifdef SK_DEBUG |
147 public: | 140 public: |
148 void setInProcessor() const { fInProcessor = true; } | 141 void setInProcessor() const { fInProcessor = true; } |
149 private: | 142 private: |
150 mutable bool fInProcessor; | 143 mutable bool fInProcessor; |
151 #endif | 144 #endif |
152 }; | 145 }; |
153 | 146 |
154 #endif | 147 #endif |
OLD | NEW |