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