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 "GrBitmapTextGeoProc.h" | 8 #include "GrBitmapTextGeoProc.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", | 77 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", |
78 kVec2f_GrVertexAttribT
ype)); | 78 kVec2f_GrVertexAttribT
ype)); |
79 this->addTextureAccess(&fTextureAccess); | 79 this->addTextureAccess(&fTextureAccess); |
80 } | 80 } |
81 | 81 |
82 bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const { | 82 bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const { |
83 const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>(); | 83 const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>(); |
84 return SkToBool(this->inColor()) == SkToBool(gp.inColor()); | 84 return SkToBool(this->inColor()) == SkToBool(gp.inColor()); |
85 } | 85 } |
86 | 86 |
87 void GrBitmapTextGeoProc::onComputeInvariantOutput(GrInvariantOutput* inout) con
st { | 87 void GrBitmapTextGeoProc::onComputeOutputCoverage(GrInitInvariantOutput* out) co
nst { |
88 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { | 88 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { |
89 inout->mulByUnknownAlpha(); | 89 out->setIsUnknownSingleComponent(); |
90 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 90 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
91 inout->mulByUnknownOpaqueColor(); | 91 out->setIsUnknownAndOpaqueFourComponents(); |
92 inout->setUsingLCDCoverage(); | 92 out->setUsingLCDCoverage(); |
93 } else { | 93 } else { |
94 inout->mulByUnknownColor(); | 94 out->setIsUnknownFourComponents(); |
95 inout->setUsingLCDCoverage(); | 95 out->setUsingLCDCoverage(); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt, | 99 void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt, |
100 const GrGLCaps& caps, | 100 const GrGLCaps& caps, |
101 GrProcessorKeyBuilder* b) const { | 101 GrProcessorKeyBuilder* b) const { |
102 GrGLBitmapTextGeoProc::GenKey(*this, bt, caps, b); | 102 GrGLBitmapTextGeoProc::GenKey(*this, bt, caps, b); |
103 } | 103 } |
104 | 104 |
105 GrGLGeometryProcessor* | 105 GrGLGeometryProcessor* |
(...skipping 18 matching lines...) Expand all Loading... |
124 SkShader::TileMode tileModes[] = { | 124 SkShader::TileMode tileModes[] = { |
125 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 125 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
127 }; | 127 }; |
128 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 128 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
129 GrTextureParams::kNon
e_FilterMode); | 129 GrTextureParams::kNon
e_FilterMode); |
130 | 130 |
131 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, | 131 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, |
132 random->nextBool()); | 132 random->nextBool()); |
133 } | 133 } |
OLD | NEW |