| 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 GrGLPathProcessor_DEFINED | 8 #ifndef GrGLPathProcessor_DEFINED |
| 9 #define GrGLPathProcessor_DEFINED | 9 #define GrGLPathProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrGLPrimitiveProcessor.h" | 11 #include "GrGLPrimitiveProcessor.h" |
| 12 | 12 |
| 13 class GrPathProcessor; | 13 class GrPathProcessor; |
| 14 class GrGLPathRendering; | 14 class GrGLPathRendering; |
| 15 class GrGLGpu; | 15 class GrGLGpu; |
| 16 | 16 |
| 17 class GrGLPathProcessor : public GrGLPrimitiveProcessor { | 17 class GrGLPathProcessor : public GrGLPrimitiveProcessor { |
| 18 public: | 18 public: |
| 19 GrGLPathProcessor(const GrPathProcessor&, const GrBatchTracker&); | 19 GrGLPathProcessor(const GrPathProcessor&, const GrBatchTracker&); |
| 20 | 20 |
| 21 static void GenKey(const GrPathProcessor&, | 21 static void GenKey(const GrPathProcessor&, |
| 22 const GrBatchTracker& bt, | 22 const GrBatchTracker& bt, |
| 23 const GrGLCaps&, | 23 const GrGLCaps&, |
| 24 GrProcessorKeyBuilder* b); | 24 GrProcessorKeyBuilder* b); |
| 25 | 25 |
| 26 void emitCode(EmitArgs&) override; | 26 void emitCode(EmitArgs&) override; |
| 27 | 27 |
| 28 virtual void emitTransforms(GrGLGPBuilder*, const TransformsIn&, TransformsO
ut*) = 0; | 28 void emitTransforms(GrGLGPBuilder*, const TransformsIn&, TransformsOut*); |
| 29 | 29 |
| 30 virtual void resolveSeparableVaryings(GrGLGpu* gpu, GrGLuint programId) {} | 30 void resolveSeparableVaryings(GrGLGpu* gpu, GrGLuint programId); |
| 31 | 31 |
| 32 void setData(const GrGLProgramDataManager&, | 32 void setData(const GrGLProgramDataManager&, |
| 33 const GrPrimitiveProcessor&, | 33 const GrPrimitiveProcessor&, |
| 34 const GrBatchTracker&) override; | 34 const GrBatchTracker&) override; |
| 35 | 35 |
| 36 virtual void setTransformData(const GrPrimitiveProcessor&, | 36 void setTransformData(const GrPrimitiveProcessor&, |
| 37 int index, | 37 int index, |
| 38 const SkTArray<const GrCoordTransform*, true>&
transforms, | 38 const SkTArray<const GrCoordTransform*, true>& transfo
rms, |
| 39 GrGLPathRendering*, | 39 GrGLPathRendering*, |
| 40 GrGLuint programID) = 0; | 40 GrGLuint programID); |
| 41 | 41 |
| 42 virtual void didSetData(GrGLPathRendering*) {} | 42 virtual void didSetData(GrGLPathRendering*) {} |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 UniformHandle fColorUniform; | 45 UniformHandle fColorUniform; |
| 46 GrColor fColor; | 46 GrColor fColor; |
| 47 | |
| 48 typedef GrGLPrimitiveProcessor INHERITED; | |
| 49 }; | |
| 50 | |
| 51 class GrGLLegacyPathProcessor : public GrGLPathProcessor { | |
| 52 public: | |
| 53 GrGLLegacyPathProcessor(const GrPathProcessor& pathProc, const GrBatchTracke
r& bt, | |
| 54 int maxTexCoords) | |
| 55 : INHERITED(pathProc, bt) | |
| 56 , fTexCoordSetCnt(0) { | |
| 57 SkDEBUGCODE(fMaxTexCoords = maxTexCoords;) | |
| 58 } | |
| 59 | |
| 60 int addTexCoordSets(int count) { | |
| 61 int firstFreeCoordSet = fTexCoordSetCnt; | |
| 62 fTexCoordSetCnt += count; | |
| 63 SkASSERT(fMaxTexCoords >= fTexCoordSetCnt); | |
| 64 return firstFreeCoordSet; | |
| 65 } | |
| 66 | |
| 67 void emitTransforms(GrGLGPBuilder*, const TransformsIn& tin, TransformsOut*
tout) override; | |
| 68 | |
| 69 void setTransformData(const GrPrimitiveProcessor& primProc, | |
| 70 int index, | |
| 71 const SkTArray<const GrCoordTransform*, true>& transfo
rms, | |
| 72 GrGLPathRendering* glpr, | |
| 73 GrGLuint) override; | |
| 74 | |
| 75 void didSetData(GrGLPathRendering* glpr) override; | |
| 76 | |
| 77 private: | |
| 78 SkDEBUGCODE(int fMaxTexCoords;) | |
| 79 int fTexCoordSetCnt; | |
| 80 | |
| 81 typedef GrGLPathProcessor INHERITED; | |
| 82 }; | |
| 83 | |
| 84 class GrGLNormalPathProcessor : public GrGLPathProcessor { | |
| 85 public: | |
| 86 GrGLNormalPathProcessor(const GrPathProcessor& pathProc, const GrBatchTracke
r& bt) | |
| 87 : INHERITED(pathProc, bt) {} | |
| 88 | |
| 89 void emitTransforms(GrGLGPBuilder* pb, const TransformsIn& tin,TransformsOut
* tout) override; | |
| 90 | |
| 91 void resolveSeparableVaryings(GrGLGpu* gpu, GrGLuint programId); | |
| 92 | |
| 93 void setTransformData(const GrPrimitiveProcessor& primProc, | |
| 94 int index, | |
| 95 const SkTArray<const GrCoordTransform*, true>& coordTr
ansforms, | |
| 96 GrGLPathRendering* glpr, | |
| 97 GrGLuint programID) override; | |
| 98 | |
| 99 private: | |
| 100 struct SeparableVaryingInfo { | 47 struct SeparableVaryingInfo { |
| 101 GrSLType fType; | 48 GrSLType fType; |
| 102 GrGLShaderVar fVariable; | 49 GrGLShaderVar fVariable; |
| 103 GrGLint fLocation; | 50 GrGLint fLocation; |
| 104 }; | 51 }; |
| 105 | 52 |
| 106 typedef SkSTArray<8, SeparableVaryingInfo, true> SeparableVaryingInfoArray; | 53 typedef SkSTArray<8, SeparableVaryingInfo, true> SeparableVaryingInfoArray; |
| 107 | 54 |
| 108 SeparableVaryingInfoArray fSeparableVaryingInfos; | 55 SeparableVaryingInfoArray fSeparableVaryingInfos; |
| 109 | 56 |
| 110 typedef GrGLPathProcessor INHERITED; | 57 typedef GrGLPrimitiveProcessor INHERITED; |
| 111 }; | 58 }; |
| 112 | 59 |
| 113 #endif | 60 #endif |
| OLD | NEW |