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 "GrCustomCoordsTextureEffect.h" | 8 #include "GrCustomCoordsTextureEffect.h" |
| 9 #include "GrInvariantOutput.h" |
9 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
10 #include "gl/GrGLProcessor.h" | 11 #include "gl/GrGLProcessor.h" |
11 #include "gl/GrGLSL.h" | 12 #include "gl/GrGLSL.h" |
12 #include "gl/GrGLTexture.h" | 13 #include "gl/GrGLTexture.h" |
13 #include "gl/GrGLGeometryProcessor.h" | 14 #include "gl/GrGLGeometryProcessor.h" |
14 #include "GrTBackendProcessorFactory.h" | 15 #include "GrTBackendProcessorFactory.h" |
15 #include "GrTexture.h" | 16 #include "GrTexture.h" |
16 | 17 |
17 class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor { | 18 class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor { |
18 public: | 19 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 , fInTextureCoords(this->addVertexAttrib(GrShaderVar("inTextureCoords", | 60 , fInTextureCoords(this->addVertexAttrib(GrShaderVar("inTextureCoords", |
60 kVec2f_GrSLType, | 61 kVec2f_GrSLType, |
61 GrShaderVar::kAttribute
_TypeModifier))) { | 62 GrShaderVar::kAttribute
_TypeModifier))) { |
62 this->addTextureAccess(&fTextureAccess); | 63 this->addTextureAccess(&fTextureAccess); |
63 } | 64 } |
64 | 65 |
65 bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) co
nst { | 66 bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) co
nst { |
66 return true; | 67 return true; |
67 } | 68 } |
68 | 69 |
69 void GrCustomCoordsTextureEffect::onComputeInvariantOutput(InvariantOutput* inou
t) const { | 70 void GrCustomCoordsTextureEffect::onComputeInvariantOutput(GrInvariantOutput* in
out) const { |
70 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 71 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
71 inout->mulByUnknownOpaqueColor(); | 72 inout->mulByUnknownOpaqueColor(); |
72 } else { | 73 } else { |
73 inout->mulByUnknownColor(); | 74 inout->mulByUnknownColor(); |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 const GrBackendGeometryProcessorFactory& GrCustomCoordsTextureEffect::getFactory
() const { | 78 const GrBackendGeometryProcessorFactory& GrCustomCoordsTextureEffect::getFactory
() const { |
78 return GrTBackendGeometryProcessorFactory<GrCustomCoordsTextureEffect>::getI
nstance(); | 79 return GrTBackendGeometryProcessorFactory<GrCustomCoordsTextureEffect>::getI
nstance(); |
79 } | 80 } |
(...skipping 15 matching lines...) Expand all Loading... |
95 }; | 96 }; |
96 SkShader::TileMode tileModes[] = { | 97 SkShader::TileMode tileModes[] = { |
97 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 98 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
98 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 99 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
99 }; | 100 }; |
100 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 101 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
101 GrTextureParams::kNon
e_FilterMode); | 102 GrTextureParams::kNon
e_FilterMode); |
102 | 103 |
103 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); | 104 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); |
104 } | 105 } |
OLD | NEW |