OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrFragmentProcessor_DEFINED | 8 #ifndef GrFragmentProcessor_DEFINED |
9 #define GrFragmentProcessor_DEFINED | 9 #define GrFragmentProcessor_DEFINED |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 /** Will this prceossor read the source color value? */ | 38 /** Will this prceossor read the source color value? */ |
39 bool willUseInputColor() const { return fWillUseInputColor; } | 39 bool willUseInputColor() const { return fWillUseInputColor; } |
40 | 40 |
41 /** Returns true if this and other prceossor conservatively draw identically
. It can only return | 41 /** Returns true if this and other prceossor conservatively draw identically
. It can only return |
42 true when the two prceossor are of the same subclass (i.e. they return t
he same object from | 42 true when the two prceossor are of the same subclass (i.e. they return t
he same object from |
43 from getFactory()). | 43 from getFactory()). |
44 | 44 |
45 A return value of true from isEqual() should not be used to test whether
the prceossor would | 45 A return value of true from isEqual() should not be used to test whether
the prceossor would |
46 generate the same shader code. To test for identical code generation use
the prceossor' keys | 46 generate the same shader code. To test for identical code generation use
the prceossor' keys |
47 computed by the GrBackendProcessorFactory. */ | 47 computed by the GrBackendProcessorFactory. */ |
48 bool isEqual(const GrFragmentProcessor& other) const { | 48 bool isEqual(const GrFragmentProcessor& that) const { |
49 if (&this->getFactory() != &other.getFactory() || !this->hasSameTransfor
ms(other)) { | 49 if (&this->getFactory() != &that.getFactory() || |
| 50 !this->hasSameTransforms(that) || |
| 51 !this->hasSameTextureAccesses(that)) { |
50 return false; | 52 return false; |
51 } | 53 } |
52 bool result = this->onIsEqual(other); | 54 return this->onIsEqual(that); |
53 #ifdef SK_DEBUG | |
54 if (result) { | |
55 this->assertTexturesEqual(other); | |
56 } | |
57 #endif | |
58 return result; | |
59 } | 55 } |
60 | 56 |
61 protected: | 57 protected: |
62 /** | 58 /** |
63 * Fragment Processor subclasses call this from their constructor to registe
r coordinate | 59 * Fragment Processor subclasses call this from their constructor to registe
r coordinate |
64 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates | 60 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates |
65 * in their FS code. The matrix expresses a transformation from local space.
For a given | 61 * in their FS code. The matrix expresses a transformation from local space.
For a given |
66 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. | 62 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. |
67 * | 63 * |
68 * When the transformation has perspective, the transformed coordinates will
have | 64 * When the transformation has perspective, the transformed coordinates will
have |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bool hasSameTransforms(const GrFragmentProcessor&) const; | 100 bool hasSameTransforms(const GrFragmentProcessor&) const; |
105 | 101 |
106 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; | 102 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
107 bool fWillReadDstColor; | 103 bool fWillReadDstColor; |
108 bool fWillUseInputColor; | 104 bool fWillUseInputColor; |
109 | 105 |
110 typedef GrProcessor INHERITED; | 106 typedef GrProcessor INHERITED; |
111 }; | 107 }; |
112 | 108 |
113 #endif | 109 #endif |
OLD | NEW |