| 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 #include "GrBitmapTextGeoProc.h" | 8 #include "GrBitmapTextGeoProc.h" | 
| 9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" | 
| 10 #include "GrTexture.h" | 10 #include "GrTexture.h" | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 37         vsBuilder->codeAppendf("%s = %s;", v.vsOut(), cte.inTextureCoords()->fNa
     me); | 37         vsBuilder->codeAppendf("%s = %s;", v.vsOut(), cte.inTextureCoords()->fNa
     me); | 
| 38 | 38 | 
| 39         // Setup pass through color | 39         // Setup pass through color | 
| 40         this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
     , cte.inColor(), | 40         this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
     , cte.inColor(), | 
| 41                                     &fColorUniform); | 41                                     &fColorUniform); | 
| 42 | 42 | 
| 43         // setup output coords | 43         // setup output coords | 
| 44         vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), cte.inPo
     sition()->fName); | 44         vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), cte.inPo
     sition()->fName); | 
| 45         vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), cte.inPosit
     ion()->fName); | 45         vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), cte.inPosit
     ion()->fName); | 
| 46 | 46 | 
|  | 47         // setup uniform viewMatrix | 
|  | 48         this->addUniformViewMatrix(pb); | 
|  | 49 | 
| 47         // setup position varying | 50         // setup position varying | 
| 48         vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition()
     , | 51         vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition()
     , this->uViewM(), | 
| 49                                vsBuilder->uViewM(), cte.inPosition()->fName); | 52                                cte.inPosition()->fName); | 
| 50 | 53 | 
| 51         GrGLGPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); | 54         GrGLGPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); | 
| 52         fsBuilder->codeAppendf("%s = ", args.fOutputCoverage); | 55         fsBuilder->codeAppendf("%s = ", args.fOutputCoverage); | 
| 53         fsBuilder->appendTextureLookup(args.fSamplers[0], v.fsIn(), kVec2f_GrSLT
     ype); | 56         fsBuilder->appendTextureLookup(args.fSamplers[0], v.fsIn(), kVec2f_GrSLT
     ype); | 
| 54         fsBuilder->codeAppend(";"); | 57         fsBuilder->codeAppend(";"); | 
| 55     } | 58     } | 
| 56 | 59 | 
| 57     virtual void setData(const GrGLProgramDataManager& pdman, | 60     virtual void setData(const GrGLProgramDataManager& pdman, | 
| 58                          const GrPrimitiveProcessor& gp, | 61                          const GrPrimitiveProcessor& gp, | 
| 59                          const GrBatchTracker& bt) SK_OVERRIDE { | 62                          const GrBatchTracker& bt) SK_OVERRIDE { | 
|  | 63         this->setUniformViewMatrix(pdman, gp.viewMatrix()); | 
|  | 64 | 
| 60         const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>(); | 65         const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>(); | 
| 61         if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
     r) { | 66         if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
     r) { | 
| 62             GrGLfloat c[4]; | 67             GrGLfloat c[4]; | 
| 63             GrColorToRGBAFloat(local.fColor, c); | 68             GrColorToRGBAFloat(local.fColor, c); | 
| 64             pdman.set4fv(fColorUniform, 1, c); | 69             pdman.set4fv(fColorUniform, 1, c); | 
| 65             fColor = local.fColor; | 70             fColor = local.fColor; | 
| 66         } | 71         } | 
| 67     } | 72     } | 
| 68 | 73 | 
| 69     static inline void GenKey(const GrGeometryProcessor& proc, | 74     static inline void GenKey(const GrGeometryProcessor& proc, | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 172         kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 177         kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 
| 173         kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 178         kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 
| 174     }; | 179     }; | 
| 175     GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
     erp_FilterMode : | 180     GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
     erp_FilterMode : | 
| 176                                                            GrTextureParams::kNon
     e_FilterMode); | 181                                                            GrTextureParams::kNon
     e_FilterMode); | 
| 177 | 182 | 
| 178     return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], 
     params, | 183     return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], 
     params, | 
| 179                                        random->nextBool(), random->nextBool(), | 184                                        random->nextBool(), random->nextBool(), | 
| 180                                        GrProcessorUnitTest::TestMatrix(random)); | 185                                        GrProcessorUnitTest::TestMatrix(random)); | 
| 181 } | 186 } | 
| OLD | NEW | 
|---|