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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 , fInTextureCoords(this->addVertexAttrib(GrShaderVar("inTextureCoords", | 56 , fInTextureCoords(this->addVertexAttrib(GrShaderVar("inTextureCoords", |
56 kVec2f_GrSLType, | 57 kVec2f_GrSLType, |
57 GrShaderVar::kAttribute
_TypeModifier))) { | 58 GrShaderVar::kAttribute
_TypeModifier))) { |
58 this->addTextureAccess(&fTextureAccess); | 59 this->addTextureAccess(&fTextureAccess); |
59 } | 60 } |
60 | 61 |
61 bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) co
nst { | 62 bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) co
nst { |
62 return true; | 63 return true; |
63 } | 64 } |
64 | 65 |
65 void GrCustomCoordsTextureEffect::onComputeInvariantOutput(InvariantOutput* inou
t) const { | 66 void GrCustomCoordsTextureEffect::onComputeInvariantOutput(GrInvariantOutput* in
out) const { |
66 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 67 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
67 inout->mulByUnknownOpaqueColor(); | 68 inout->mulByUnknownOpaqueColor(); |
68 } else { | 69 } else { |
69 inout->mulByUnknownColor(); | 70 inout->mulByUnknownColor(); |
70 } | 71 } |
71 } | 72 } |
72 | 73 |
73 const GrBackendGeometryProcessorFactory& GrCustomCoordsTextureEffect::getFactory
() const { | 74 const GrBackendGeometryProcessorFactory& GrCustomCoordsTextureEffect::getFactory
() const { |
74 return GrTBackendGeometryProcessorFactory<GrCustomCoordsTextureEffect>::getI
nstance(); | 75 return GrTBackendGeometryProcessorFactory<GrCustomCoordsTextureEffect>::getI
nstance(); |
75 } | 76 } |
(...skipping 15 matching lines...) Expand all Loading... |
91 }; | 92 }; |
92 SkShader::TileMode tileModes[] = { | 93 SkShader::TileMode tileModes[] = { |
93 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 94 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
94 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 95 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
95 }; | 96 }; |
96 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 97 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
97 GrTextureParams::kNon
e_FilterMode); | 98 GrTextureParams::kNon
e_FilterMode); |
98 | 99 |
99 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); | 100 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); |
100 } | 101 } |
OLD | NEW |