| 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 "GrEffect.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 | 15 |
| 16 /** | 16 /** |
| 17 * Coordinates available to GrEffect subclasses for requesting transformations.
Transformed | 17 * Coordinates available to GrProcessor subclasses for requesting transformation
s. Transformed |
| 18 * coordinates are made available in the the portion of fragment shader emitted
by the effect. | 18 * coordinates are made available in the the portion of fragment shader emitted
by the effect. |
| 19 */ | 19 */ |
| 20 enum GrCoordSet { | 20 enum GrCoordSet { |
| 21 /** | 21 /** |
| 22 * The user-space coordinates that map to the fragment being rendered. These
coords account for | 22 * The user-space coordinates that map to the fragment being rendered. These
coords account for |
| 23 * any change of coordinate system done on the CPU by GrContext before rende
ring, and also are | 23 * any change of coordinate system done on the CPU by GrContext before rende
ring, and also are |
| 24 * correct for draws that take explicit local coords rather than inferring t
hem from the | 24 * correct for draws that take explicit local coords rather than inferring t
hem from the |
| 25 * primitive's positions (e.g. drawVertices). These are usually the coords a
GrEffect wants. | 25 * primitive's positions (e.g. drawVertices). These are usually the coords a
GrProcessor wants. |
| 26 */ | 26 */ |
| 27 kLocal_GrCoordSet, | 27 kLocal_GrCoordSet, |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * The actual vertex position. Note that GrContext may not draw using the or
iginal view matrix | 30 * The actual vertex position. Note that GrContext may not draw using the or
iginal view matrix |
| 31 * specified by the caller, as it may have transformed vertices into another
space. These are | 31 * specified by the caller, as it may have transformed vertices into another
space. These are |
| 32 * usually not the coordinates a GrEffect wants. | 32 * usually not the coordinates a GrProcessor wants. |
| 33 */ | 33 */ |
| 34 kPosition_GrCoordSet | 34 kPosition_GrCoordSet |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * A class representing a linear transformation from one of the built-in coordin
ate sets (local or | 38 * A class representing a linear transformation from one of the built-in coordin
ate sets (local or |
| 39 * position). GrEffects just define these transformations, and the framework doe
s the rest of the | 39 * position). GrProcessors just define these transformations, and the framework
does the rest of the |
| 40 * work to make the transformed coordinates available in their fragment shader. | 40 * work to make the transformed coordinates available in their fragment shader. |
| 41 */ | 41 */ |
| 42 class GrCoordTransform : SkNoncopyable { | 42 class GrCoordTransform : SkNoncopyable { |
| 43 public: | 43 public: |
| 44 GrCoordTransform() { SkDEBUGCODE(fInEffect = false); } | 44 GrCoordTransform() { SkDEBUGCODE(fInEffect = false); } |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Create a transformation that maps [0, 1] to a texture's boundaries. | 47 * Create a transformation that maps [0, 1] to a texture's boundaries. |
| 48 */ | 48 */ |
| 49 GrCoordTransform(GrCoordSet sourceCoords, const GrTexture* texture) { | 49 GrCoordTransform(GrCoordSet sourceCoords, const GrTexture* texture) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 #ifdef SK_DEBUG | 120 #ifdef SK_DEBUG |
| 121 public: | 121 public: |
| 122 void setInEffect() const { fInEffect = true; } | 122 void setInEffect() const { fInEffect = true; } |
| 123 private: | 123 private: |
| 124 mutable bool fInEffect; | 124 mutable bool fInEffect; |
| 125 #endif | 125 #endif |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 #endif | 128 #endif |
| OLD | NEW |