| 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 GrMaskFormat format, | 25 GrMaskFormat format, bool opaqueVertexCol
ors, |
| 26 const SkMatrix& localMatrix) { | 26 const SkMatrix& localMatrix) { |
| 27 return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, format, localMatr
ix)); | 27 return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, format, opaqueVer
texColors, |
| 28 localMatrix)); |
| 28 } | 29 } |
| 29 | 30 |
| 30 virtual ~GrBitmapTextGeoProc() {} | 31 virtual ~GrBitmapTextGeoProc() {} |
| 31 | 32 |
| 32 const char* name() const override { return "Texture"; } | 33 const char* name() const override { return "Texture"; } |
| 33 | 34 |
| 34 const Attribute* inPosition() const { return fInPosition; } | 35 const Attribute* inPosition() const { return fInPosition; } |
| 35 const Attribute* inColor() const { return fInColor; } | 36 const Attribute* inColor() const { return fInColor; } |
| 36 const Attribute* inTextureCoords() const { return fInTextureCoords; } | 37 const Attribute* inTextureCoords() const { return fInTextureCoords; } |
| 37 GrMaskFormat maskFormat() const { return fMaskFormat; } | 38 GrMaskFormat maskFormat() const { return fMaskFormat; } |
| 38 | 39 |
| 39 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 40 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
| 40 const GrGLCaps& caps, | 41 const GrGLCaps& caps, |
| 41 GrProcessorKeyBuilder* b) const override; | 42 GrProcessorKeyBuilder* b) const override; |
| 42 | 43 |
| 43 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 44 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
| 44 const GrGLCaps& caps) const
override; | 45 const GrGLCaps& caps) const
override; |
| 45 | 46 |
| 46 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override
; | 47 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override
; |
| 48 bool onCanMakeEqual(const GrBatchTracker&, |
| 49 const GrGeometryProcessor&, |
| 50 const GrBatchTracker&) const override; |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& para
ms, | 53 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& para
ms, |
| 50 GrMaskFormat format, const SkMatrix& localMatrix); | 54 GrMaskFormat format, bool opaqueVertexColors, const SkMa
trix& localMatrix); |
| 55 |
| 56 bool onIsEqual(const GrGeometryProcessor& other) const override; |
| 57 |
| 58 void onGetInvariantOutputColor(GrInitInvariantOutput*) const override; |
| 59 |
| 60 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override; |
| 51 | 61 |
| 52 GrTextureAccess fTextureAccess; | 62 GrTextureAccess fTextureAccess; |
| 53 const Attribute* fInPosition; | 63 const Attribute* fInPosition; |
| 54 const Attribute* fInColor; | 64 const Attribute* fInColor; |
| 55 const Attribute* fInTextureCoords; | 65 const Attribute* fInTextureCoords; |
| 56 GrMaskFormat fMaskFormat; | 66 GrMaskFormat fMaskFormat; |
| 57 | 67 |
| 58 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 68 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 59 | 69 |
| 60 typedef GrGeometryProcessor INHERITED; | 70 typedef GrGeometryProcessor INHERITED; |
| 61 }; | 71 }; |
| 62 | 72 |
| 63 #endif | 73 #endif |
| OLD | NEW |