| 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 #include "GrConvexPolyEffect.h" | 8 #include "GrConvexPolyEffect.h" |
| 9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
| 10 #include "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void emitCode(EmitArgs&) override; | 88 void emitCode(EmitArgs&) override; |
| 89 | 89 |
| 90 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder*); | 90 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder*); |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 93 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 GrGLSLProgramDataManager::UniformHandle fRectUniform; | 96 GrGLSLProgramDataManager::UniformHandle fRectUniform; |
| 97 SkRect fPrevRect; | 97 SkRect fPrevRect; |
| 98 |
| 98 typedef GrGLSLFragmentProcessor INHERITED; | 99 typedef GrGLSLFragmentProcessor INHERITED; |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 void GLAARectEffect::emitCode(EmitArgs& args) { | 102 void GLAARectEffect::emitCode(EmitArgs& args) { |
| 102 const AARectEffect& aare = args.fFp.cast<AARectEffect>(); | 103 const AARectEffect& aare = args.fFp.cast<AARectEffect>(); |
| 103 const char *rectName; | 104 const char *rectName; |
| 104 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), | 105 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), |
| 105 // respectively. | 106 // respectively. |
| 106 fRectUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragm
ent_Visibility, | 107 fRectUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragm
ent_Visibility, |
| 107 kVec4f_GrSLType, | 108 kVec4f_GrSLType, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 173 |
| 173 void emitCode(EmitArgs&) override; | 174 void emitCode(EmitArgs&) override; |
| 174 | 175 |
| 175 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder*); | 176 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder*); |
| 176 | 177 |
| 177 protected: | 178 protected: |
| 178 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 179 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
| 179 | 180 |
| 180 private: | 181 private: |
| 181 GrGLSLProgramDataManager::UniformHandle fEdgeUniform; | 182 GrGLSLProgramDataManager::UniformHandle fEdgeUniform; |
| 182 SkScalar fPrevEdges[3 * GrConvexPolyEffect::kMa
xEdges]; | 183 SkScalar fPrevEdges[3 * GrConvexPolyEffect::k
MaxEdges]; |
| 183 typedef GrGLSLFragmentProcessor INHERITED; | 184 typedef GrGLSLFragmentProcessor INHERITED; |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 void GrGLConvexPolyEffect::emitCode(EmitArgs& args) { | 187 void GrGLConvexPolyEffect::emitCode(EmitArgs& args) { |
| 187 const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>(); | 188 const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>(); |
| 188 | 189 |
| 189 const char *edgeArrayName; | 190 const char *edgeArrayName; |
| 190 fEdgeUniform = args.fUniformHandler->addUniformArray(GrGLSLUniformHandler::k
Fragment_Visibility, | 191 fEdgeUniform = args.fUniformHandler->addUniformArray(GrGLSLUniformHandler::k
Fragment_Visibility, |
| 191 kVec3f_GrSLType, | 192 kVec3f_GrSLType, |
| 192 kDefault_GrSLPrecision, | 193 kDefault_GrSLPrecision, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 343 } |
| 343 | 344 |
| 344 GrFragmentProcessor* fp; | 345 GrFragmentProcessor* fp; |
| 345 do { | 346 do { |
| 346 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 347 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 347 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 348 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 348 fp = GrConvexPolyEffect::Create(edgeType, count, edges); | 349 fp = GrConvexPolyEffect::Create(edgeType, count, edges); |
| 349 } while (nullptr == fp); | 350 } while (nullptr == fp); |
| 350 return fp; | 351 return fp; |
| 351 } | 352 } |
| OLD | NEW |