| 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, const SkMatrix& loca
lMatrix, | 25 GrMaskFormat format, const SkMatrix& loca
lMatrix, |
| 26 bool usesLocalCoords) { | 26 bool usesLocalCoords, GrRenderTarget* dst
) { |
| 27 return new GrBitmapTextGeoProc(color, tex, p, format, localMatrix, usesL
ocalCoords); | 27 return new GrBitmapTextGeoProc(color, tex, p, format, localMatrix, usesL
ocalCoords, dst); |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual ~GrBitmapTextGeoProc() {} | 30 virtual ~GrBitmapTextGeoProc() {} |
| 31 | 31 |
| 32 const char* name() const override { return "Texture"; } | 32 const char* name() const override { return "Texture"; } |
| 33 | 33 |
| 34 const Attribute* inPosition() const { return fInPosition; } | 34 const Attribute* inPosition() const { return fInPosition; } |
| 35 const Attribute* inColor() const { return fInColor; } | 35 const Attribute* inColor() const { return fInColor; } |
| 36 const Attribute* inTextureCoords() const { return fInTextureCoords; } | 36 const Attribute* inTextureCoords() const { return fInTextureCoords; } |
| 37 GrMaskFormat maskFormat() const { return fMaskFormat; } | 37 GrMaskFormat maskFormat() const { return fMaskFormat; } |
| 38 GrColor color() const { return fColor; } | 38 GrColor color() const { return fColor; } |
| 39 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 39 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
| 40 bool hasVertexColor() const { return SkToBool(fInColor); } | 40 bool hasVertexColor() const { return SkToBool(fInColor); } |
| 41 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 41 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 42 bool usesLocalCoords() const { return fUsesLocalCoords; } | 42 bool usesLocalCoords() const { return fUsesLocalCoords; } |
| 43 | 43 |
| 44 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st override; | 44 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st override; |
| 45 | 45 |
| 46 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const overr
ide; | 46 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const overr
ide; |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& para
ms, | 49 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& para
ms, |
| 50 GrMaskFormat format, const SkMatrix& localMatrix, bool u
sesLocalCoords); | 50 GrMaskFormat format, const SkMatrix& localMatrix, bool u
sesLocalCoords, |
| 51 GrRenderTarget* dst); |
| 51 | 52 |
| 52 GrColor fColor; | 53 GrColor fColor; |
| 53 SkMatrix fLocalMatrix; | 54 SkMatrix fLocalMatrix; |
| 54 bool fUsesLocalCoords; | 55 bool fUsesLocalCoords; |
| 55 GrTextureAccess fTextureAccess; | 56 GrTextureAccess fTextureAccess; |
| 56 const Attribute* fInPosition; | 57 const Attribute* fInPosition; |
| 57 const Attribute* fInColor; | 58 const Attribute* fInColor; |
| 58 const Attribute* fInTextureCoords; | 59 const Attribute* fInTextureCoords; |
| 59 GrMaskFormat fMaskFormat; | 60 GrMaskFormat fMaskFormat; |
| 60 | 61 |
| 61 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 62 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 62 | 63 |
| 63 typedef GrGeometryProcessor INHERITED; | 64 typedef GrGeometryProcessor INHERITED; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 #endif | 67 #endif |
| OLD | NEW |