| 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 GrBitmapTextGeoProc_DEFINED | 8 #ifndef GrBitmapTextGeoProc_DEFINED |
| 9 #define GrBitmapTextGeoProc_DEFINED | 9 #define GrBitmapTextGeoProc_DEFINED |
| 10 | 10 |
| 11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
| 12 #include "GrGeometryProcessor.h" | 12 #include "GrGeometryProcessor.h" |
| 13 | 13 |
| 14 class GrGLBitmapTextGeoProc; | 14 class GrGLBitmapTextGeoProc; |
| 15 class GrInvariantOutput; | 15 class GrInvariantOutput; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * The output color of this effect is a modulation of the input color and a samp
le from a texture. | 18 * The output color of this effect is a modulation of the input color and a samp
le from a texture. |
| 19 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). The input | 19 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). The input |
| 20 * coords are a custom attribute. | 20 * coords are a custom attribute. |
| 21 */ | 21 */ |
| 22 class GrBitmapTextGeoProc : public GrGeometryProcessor { | 22 class GrBitmapTextGeoProc : public GrGeometryProcessor { |
| 23 public: | 23 public: |
| 24 static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTe
xtureParams& p, | 24 static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTe
xtureParams& p, |
| 25 bool useColorAttrib, bool opaqueVertexCol
ors) { | 25 bool useColorAttrib, bool opaqueVertexCol
ors, |
| 26 return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, useColorAttrib, o
paqueVertexColors)); | 26 const SkMatrix& localMatrix) { |
| 27 return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, useColorAttrib, o
paqueVertexColors, |
| 28 localMatrix)); |
| 27 } | 29 } |
| 28 | 30 |
| 29 virtual ~GrBitmapTextGeoProc() {} | 31 virtual ~GrBitmapTextGeoProc() {} |
| 30 | 32 |
| 31 virtual const char* name() const SK_OVERRIDE { return "Texture"; } | 33 virtual const char* name() const SK_OVERRIDE { return "Texture"; } |
| 32 | 34 |
| 33 const GrAttribute* inPosition() const { return fInPosition; } | 35 const GrAttribute* inPosition() const { return fInPosition; } |
| 34 const GrAttribute* inColor() const { return fInColor; } | 36 const GrAttribute* inColor() const { return fInColor; } |
| 35 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } | 37 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } |
| 36 | 38 |
| 37 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 39 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
| 38 const GrGLCaps& caps, | 40 const GrGLCaps& caps, |
| 39 GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 41 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| 40 | 42 |
| 41 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; | 43 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; |
| 42 | 44 |
| 43 void initBatchTracker(GrBatchTracker*, const InitBT&) const SK_OVERRIDE; | 45 void initBatchTracker(GrBatchTracker*, const InitBT&) const SK_OVERRIDE; |
| 44 bool onCanMakeEqual(const GrBatchTracker&, | 46 bool onCanMakeEqual(const GrBatchTracker&, |
| 45 const GrGeometryProcessor&, | 47 const GrGeometryProcessor&, |
| 46 const GrBatchTracker&) const SK_OVERRIDE; | 48 const GrBatchTracker&) const SK_OVERRIDE; |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& para
ms, | 51 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& para
ms, |
| 50 bool useColorAttrib, bool opaqueVertexColors); | 52 bool useColorAttrib, bool opaqueVertexColors, const SkMa
trix& localMatrix); |
| 51 | 53 |
| 52 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 54 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
| 53 | 55 |
| 54 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; | 56 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; |
| 55 | 57 |
| 56 GrTextureAccess fTextureAccess; | 58 GrTextureAccess fTextureAccess; |
| 57 const GrAttribute* fInPosition; | 59 const GrAttribute* fInPosition; |
| 58 const GrAttribute* fInColor; | 60 const GrAttribute* fInColor; |
| 59 const GrAttribute* fInTextureCoords; | 61 const GrAttribute* fInTextureCoords; |
| 60 | 62 |
| 61 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 63 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 62 | 64 |
| 63 typedef GrGeometryProcessor INHERITED; | 65 typedef GrGeometryProcessor INHERITED; |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 #endif | 68 #endif |
| OLD | NEW |