| 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" |
| 11 #include "gl/GrGLProcessor.h" | 11 #include "gl/GrGLProcessor.h" |
| 12 #include "gl/GrGLSL.h" | 12 #include "gl/GrGLSL.h" |
| 13 #include "gl/GrGLTexture.h" | 13 #include "gl/GrGLTexture.h" |
| 14 #include "gl/GrGLGeometryProcessor.h" | 14 #include "gl/GrGLGeometryProcessor.h" |
| 15 #include "gl/builders/GrGLProgramBuilder.h" | 15 #include "gl/builders/GrGLProgramBuilder.h" |
| 16 | 16 |
| 17 struct BitmapTextBatchTracker { | 17 struct BitmapTextBatchTracker { |
| 18 GrGPInput fInputColorType; | 18 GrGPInput fInputColorType; |
| 19 GrColor fColor; | 19 GrColor fColor; |
| 20 bool fUsesLocalCoords; | 20 bool fUsesLocalCoords; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 class GrGLBitmapTextGeoProc : public GrGLGeometryProcessor { | 23 class GrGLBitmapTextGeoProc : public GrGLGeometryProcessor { |
| 24 public: | 24 public: |
| 25 GrGLBitmapTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&) | 25 GrGLBitmapTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&) |
| 26 : fColor(GrColor_ILLEGAL) {} | 26 : fColor(GrColor_ILLEGAL) {} |
| 27 | 27 |
| 28 virtual void emitCode(const EmitArgs& args) SK_OVERRIDE { | 28 void emitCode(const EmitArgs& args) SK_OVERRIDE { |
| 29 const GrBitmapTextGeoProc& cte = args.fGP.cast<GrBitmapTextGeoProc>(); | 29 const GrBitmapTextGeoProc& cte = args.fGP.cast<GrBitmapTextGeoProc>(); |
| 30 const BitmapTextBatchTracker& local = args.fBT.cast<BitmapTextBatchTrack
er>(); | 30 const BitmapTextBatchTracker& local = args.fBT.cast<BitmapTextBatchTrack
er>(); |
| 31 | 31 |
| 32 GrGLGPBuilder* pb = args.fPB; | 32 GrGLGPBuilder* pb = args.fPB; |
| 33 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); | 33 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); |
| 34 | 34 |
| 35 GrGLVertToFrag v(kVec2f_GrSLType); | 35 GrGLVertToFrag v(kVec2f_GrSLType); |
| 36 pb->addVarying("TextureCoords", &v); | 36 pb->addVarying("TextureCoords", &v); |
| 37 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), cte.inTextureCoords()->fNa
me); | 37 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), cte.inTextureCoords()->fNa
me); |
| 38 | 38 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 177 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| 178 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 178 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| 179 }; | 179 }; |
| 180 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 180 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
| 181 GrTextureParams::kNon
e_FilterMode); | 181 GrTextureParams::kNon
e_FilterMode); |
| 182 | 182 |
| 183 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, | 183 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, |
| 184 random->nextBool(), random->nextBool(), | 184 random->nextBool(), random->nextBool(), |
| 185 GrProcessorUnitTest::TestMatrix(random)); | 185 GrProcessorUnitTest::TestMatrix(random)); |
| 186 } | 186 } |
| OLD | NEW |