Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/gpu/effects/GrDistanceFieldTextureEffect.cpp

Issue 424173002: Revert of Add effect caching to distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrDistanceFieldTextureEffect.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrDistanceFieldTextureEffect.h" 8 #include "GrDistanceFieldTextureEffect.h"
9 #include "gl/GrGLEffect.h" 9 #include "gl/GrGLEffect.h"
10 #include "gl/GrGLShaderBuilder.h" 10 #include "gl/GrGLShaderBuilder.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 builder->fsCodeAppend("\tfloat distance = " 72 builder->fsCodeAppend("\tfloat distance = "
73 SK_DistanceFieldMultiplier "*(texColor.r - " SK_Distan ceFieldThreshold ")" 73 SK_DistanceFieldMultiplier "*(texColor.r - " SK_Distan ceFieldThreshold ")"
74 "+ " SK_DistanceFieldNonLCDFactor ";\n"); 74 "+ " SK_DistanceFieldNonLCDFactor ";\n");
75 75
76 // we adjust for the effect of the transformation on the distance by usi ng 76 // we adjust for the effect of the transformation on the distance by usi ng
77 // the length of the gradient of the texture coordinates. We use st coor dinates 77 // the length of the gradient of the texture coordinates. We use st coor dinates
78 // to ensure we're mapping 1:1 from texel space to pixel space. 78 // to ensure we're mapping 1:1 from texel space to pixel space.
79 builder->fsCodeAppendf("\tvec2 uv = %s;\n", fsCoordName.c_str()); 79 builder->fsCodeAppendf("\tvec2 uv = %s;\n", fsCoordName.c_str());
80 builder->fsCodeAppendf("\tvec2 st = uv*%s;\n", textureSizeUniName); 80 builder->fsCodeAppendf("\tvec2 st = uv*%s;\n", textureSizeUniName);
81 builder->fsCodeAppend("\tfloat afwidth;\n"); 81 builder->fsCodeAppend("\tfloat afwidth;\n");
82 if (dfTexEffect.getFlags() & kSimilarity_DistanceFieldEffectFlag) { 82 if (dfTexEffect.isSimilarity()) {
83 // this gives us a smooth step across approximately one fragment 83 // this gives us a smooth step across approximately one fragment
84 builder->fsCodeAppend("\tafwidth = " SK_DistanceFieldAAFactor "*dFdx (st.x);\n"); 84 builder->fsCodeAppend("\tafwidth = " SK_DistanceFieldAAFactor "*dFdx (st.x);\n");
85 } else { 85 } else {
86 builder->fsCodeAppend("\tvec2 Jdx = dFdx(st);\n"); 86 builder->fsCodeAppend("\tvec2 Jdx = dFdx(st);\n");
87 builder->fsCodeAppend("\tvec2 Jdy = dFdy(st);\n"); 87 builder->fsCodeAppend("\tvec2 Jdy = dFdy(st);\n");
88 88
89 builder->fsCodeAppend("\tvec2 uv_grad;\n"); 89 builder->fsCodeAppend("\tvec2 uv_grad;\n");
90 if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) { 90 if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) {
91 // this is to compensate for the Adreno, which likes to drop til es on division by 0 91 // this is to compensate for the Adreno, which likes to drop til es on division by 0
92 builder->fsCodeAppend("\tfloat uv_len2 = dot(uv, uv);\n"); 92 builder->fsCodeAppend("\tfloat uv_len2 = dot(uv, uv);\n");
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 fLuminance = luminance; 146 fLuminance = luminance;
147 } 147 }
148 #endif 148 #endif
149 } 149 }
150 150
151 static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, 151 static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
152 GrEffectKeyBuilder* b) { 152 GrEffectKeyBuilder* b) {
153 const GrDistanceFieldTextureEffect& dfTexEffect = 153 const GrDistanceFieldTextureEffect& dfTexEffect =
154 drawEffect.castEffect<GrDistanceFi eldTextureEffect>(); 154 drawEffect.castEffect<GrDistanceFi eldTextureEffect>();
155 155
156 b->add32(dfTexEffect.getFlags()); 156 b->add32(dfTexEffect.isSimilarity());
157 } 157 }
158 158
159 private: 159 private:
160 GrGLUniformManager::UniformHandle fTextureSizeUni; 160 GrGLUniformManager::UniformHandle fTextureSizeUni;
161 SkISize fTextureSize; 161 SkISize fTextureSize;
162 GrGLUniformManager::UniformHandle fLuminanceUni; 162 GrGLUniformManager::UniformHandle fLuminanceUni;
163 float fLuminance; 163 float fLuminance;
164 164
165 typedef GrGLVertexEffect INHERITED; 165 typedef GrGLVertexEffect INHERITED;
166 }; 166 };
167 167
168 /////////////////////////////////////////////////////////////////////////////// 168 ///////////////////////////////////////////////////////////////////////////////
169 169
170 GrDistanceFieldTextureEffect::GrDistanceFieldTextureEffect(GrTexture* texture, 170 GrDistanceFieldTextureEffect::GrDistanceFieldTextureEffect(GrTexture* texture,
171 const GrTextureParams & params, 171 const GrTextureParams & params,
172 #ifdef SK_GAMMA_APPLY_TO_A8 172 #ifdef SK_GAMMA_APPLY_TO_A8
173 GrTexture* gamma, 173 GrTexture* gamma,
174 const GrTextureParams & gammaParams, 174 const GrTextureParams & gammaParams,
175 float luminance, 175 float luminance,
176 #endif 176 #endif
177 uint32_t flags) 177 bool similarity)
178 : fTextureAccess(texture, params) 178 : fTextureAccess(texture, params)
179 #ifdef SK_GAMMA_APPLY_TO_A8 179 #ifdef SK_GAMMA_APPLY_TO_A8
180 , fGammaTextureAccess(gamma, gammaParams) 180 , fGammaTextureAccess(gamma, gammaParams)
181 , fLuminance(luminance) 181 , fLuminance(luminance)
182 #endif 182 #endif
183 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) { 183 , fIsSimilarity(similarity) {
184 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
185 this->addTextureAccess(&fTextureAccess); 184 this->addTextureAccess(&fTextureAccess);
186 #ifdef SK_GAMMA_APPLY_TO_A8 185 #ifdef SK_GAMMA_APPLY_TO_A8
187 this->addTextureAccess(&fGammaTextureAccess); 186 this->addTextureAccess(&fGammaTextureAccess);
188 #endif 187 #endif
189 this->addVertexAttrib(kVec2f_GrSLType); 188 this->addVertexAttrib(kVec2f_GrSLType);
190 } 189 }
191 190
192 bool GrDistanceFieldTextureEffect::onIsEqual(const GrEffect& other) const { 191 bool GrDistanceFieldTextureEffect::onIsEqual(const GrEffect& other) const {
193 const GrDistanceFieldTextureEffect& cte = CastEffect<GrDistanceFieldTextureE ffect>(other); 192 const GrDistanceFieldTextureEffect& cte = CastEffect<GrDistanceFieldTextureE ffect>(other);
194 return fTextureAccess == cte.fTextureAccess && 193 return fTextureAccess == cte.fTextureAccess;
195 fGammaTextureAccess == cte.fGammaTextureAccess &&
196 fLuminance == cte.fLuminance &&
197 fFlags == cte.fFlags;
198 } 194 }
199 195
200 void GrDistanceFieldTextureEffect::getConstantColorComponents(GrColor* color, 196 void GrDistanceFieldTextureEffect::getConstantColorComponents(GrColor* color,
201 uint32_t* validFlag s) const { 197 uint32_t* validFlag s) const {
202 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color ) && 198 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color ) &&
203 GrPixelConfigIsOpaque(this->texture(0)->config())) { 199 GrPixelConfigIsOpaque(this->texture(0)->config())) {
204 *validFlags = kA_GrColorComponentFlag; 200 *validFlags = kA_GrColorComponentFlag;
205 } else { 201 } else {
206 *validFlags = 0; 202 *validFlags = 0;
207 } 203 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 #ifdef SK_GAMMA_APPLY_TO_A8 235 #ifdef SK_GAMMA_APPLY_TO_A8
240 GrTextureParams params2(tileModes, random->nextBool() ? GrTextureParams::kBi lerp_FilterMode : 236 GrTextureParams params2(tileModes, random->nextBool() ? GrTextureParams::kBi lerp_FilterMode :
241 GrTextureParams::kNo ne_FilterMode); 237 GrTextureParams::kNo ne_FilterMode);
242 #endif 238 #endif
243 239
244 return GrDistanceFieldTextureEffect::Create(textures[texIdx], params, 240 return GrDistanceFieldTextureEffect::Create(textures[texIdx], params,
245 #ifdef SK_GAMMA_APPLY_TO_A8 241 #ifdef SK_GAMMA_APPLY_TO_A8
246 textures[texIdx2], params2, 242 textures[texIdx2], params2,
247 random->nextF(), 243 random->nextF(),
248 #endif 244 #endif
249 random->nextBool() ? 245 random->nextBool());
250 kSimilarity_DistanceFieldEff ectFlag : 0);
251 } 246 }
252 247
253 /////////////////////////////////////////////////////////////////////////////// 248 ///////////////////////////////////////////////////////////////////////////////
254 249
255 class GrGLDistanceFieldLCDTextureEffect : public GrGLVertexEffect { 250 class GrGLDistanceFieldLCDTextureEffect : public GrGLVertexEffect {
256 public: 251 public:
257 GrGLDistanceFieldLCDTextureEffect(const GrBackendEffectFactory& factory, 252 GrGLDistanceFieldLCDTextureEffect(const GrBackendEffectFactory& factory,
258 const GrDrawEffect& drawEffect) 253 const GrDrawEffect& drawEffect)
259 : INHERITED (factory) 254 : INHERITED (factory)
260 , fTextureSize(SkISize::Make(-1,-1)) {} 255 , fTextureSize(SkISize::Make(-1,-1)) {}
(...skipping 23 matching lines...) Expand all
284 279
285 const char* textureSizeUniName = NULL; 280 const char* textureSizeUniName = NULL;
286 // width, height, 1/(3*width) 281 // width, height, 1/(3*width)
287 fTextureSizeUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visib ility, 282 fTextureSizeUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visib ility,
288 kVec3f_GrSLType, "TextureSize", 283 kVec3f_GrSLType, "TextureSize",
289 &textureSizeUniName); 284 &textureSizeUniName);
290 285
291 // create LCD offset adjusted by inverse of transform 286 // create LCD offset adjusted by inverse of transform
292 builder->fsCodeAppendf("\tvec2 uv = %s;\n", fsCoordName.c_str()); 287 builder->fsCodeAppendf("\tvec2 uv = %s;\n", fsCoordName.c_str());
293 builder->fsCodeAppendf("\tvec2 st = uv*%s.xy;\n", textureSizeUniName); 288 builder->fsCodeAppendf("\tvec2 st = uv*%s.xy;\n", textureSizeUniName);
294 bool isUniformScale = !!(dfTexEffect.getFlags() & kUniformScale_Distance FieldEffectMask); 289 if (dfTexEffect.isUniformScale()) {
295 if (isUniformScale) {
296 builder->fsCodeAppend("\tfloat dx = dFdx(st.x);\n"); 290 builder->fsCodeAppend("\tfloat dx = dFdx(st.x);\n");
297 builder->fsCodeAppendf("\tvec2 offset = vec2(dx*%s.z, 0.0);\n", text ureSizeUniName); 291 builder->fsCodeAppendf("\tvec2 offset = vec2(dx*%s.z, 0.0);\n", text ureSizeUniName);
298 } else { 292 } else {
299 builder->fsCodeAppend("\tvec2 Jdx = dFdx(st);\n"); 293 builder->fsCodeAppend("\tvec2 Jdx = dFdx(st);\n");
300 builder->fsCodeAppend("\tvec2 Jdy = dFdy(st);\n"); 294 builder->fsCodeAppend("\tvec2 Jdy = dFdy(st);\n");
301 builder->fsCodeAppendf("\tvec2 offset = %s.z*Jdx;\n", textureSizeUni Name); 295 builder->fsCodeAppendf("\tvec2 offset = %s.z*Jdx;\n", textureSizeUni Name);
302 } 296 }
303 297
304 // green is distance to uv center 298 // green is distance to uv center
305 builder->fsCodeAppend("\tvec4 texColor = "); 299 builder->fsCodeAppend("\tvec4 texColor = ");
(...skipping 20 matching lines...) Expand all
326 320
327 // we adjust for the effect of the transformation on the distance by usi ng 321 // we adjust for the effect of the transformation on the distance by usi ng
328 // the length of the gradient of the texture coordinates. We use st coor dinates 322 // the length of the gradient of the texture coordinates. We use st coor dinates
329 // to ensure we're mapping 1:1 from texel space to pixel space. 323 // to ensure we're mapping 1:1 from texel space to pixel space.
330 324
331 // To be strictly correct, we should compute the anti-aliasing factor se parately 325 // To be strictly correct, we should compute the anti-aliasing factor se parately
332 // for each color component. However, this is only important when using perspective 326 // for each color component. However, this is only important when using perspective
333 // transformations, and even then using a single factor seems like a rea sonable 327 // transformations, and even then using a single factor seems like a rea sonable
334 // trade-off between quality and speed. 328 // trade-off between quality and speed.
335 builder->fsCodeAppend("\tfloat afwidth;\n"); 329 builder->fsCodeAppend("\tfloat afwidth;\n");
336 if (isUniformScale) { 330 if (dfTexEffect.isUniformScale()) {
337 // this gives us a smooth step across approximately one fragment 331 // this gives us a smooth step across approximately one fragment
338 builder->fsCodeAppend("\tafwidth = " SK_DistanceFieldAAFactor "*dx;\ n"); 332 builder->fsCodeAppend("\tafwidth = " SK_DistanceFieldAAFactor "*dx;\ n");
339 } else { 333 } else {
340 builder->fsCodeAppend("\tvec2 uv_grad;\n"); 334 builder->fsCodeAppend("\tvec2 uv_grad;\n");
341 if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) { 335 if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) {
342 // this is to compensate for the Adreno, which likes to drop til es on division by 0 336 // this is to compensate for the Adreno, which likes to drop til es on division by 0
343 builder->fsCodeAppend("\tfloat uv_len2 = dot(uv, uv);\n"); 337 builder->fsCodeAppend("\tfloat uv_len2 = dot(uv, uv);\n");
344 builder->fsCodeAppend("\tif (uv_len2 < 0.0001) {\n"); 338 builder->fsCodeAppend("\tif (uv_len2 < 0.0001) {\n");
345 builder->fsCodeAppend("\t\tuv_grad = vec2(0.7071, 0.7071);\n"); 339 builder->fsCodeAppend("\t\tuv_grad = vec2(0.7071, 0.7071);\n");
346 builder->fsCodeAppend("\t} else {\n"); 340 builder->fsCodeAppend("\t} else {\n");
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 SkASSERT(fTextureSizeUni.isValid()); 386 SkASSERT(fTextureSizeUni.isValid());
393 SkASSERT(fTextColorUni.isValid()); 387 SkASSERT(fTextColorUni.isValid());
394 388
395 const GrDistanceFieldLCDTextureEffect& dfTexEffect = 389 const GrDistanceFieldLCDTextureEffect& dfTexEffect =
396 drawEffect.castEffect<GrDistanceFieldLCDText ureEffect>(); 390 drawEffect.castEffect<GrDistanceFieldLCDText ureEffect>();
397 GrTexture* texture = drawEffect.effect()->texture(0); 391 GrTexture* texture = drawEffect.effect()->texture(0);
398 if (texture->width() != fTextureSize.width() || 392 if (texture->width() != fTextureSize.width() ||
399 texture->height() != fTextureSize.height()) { 393 texture->height() != fTextureSize.height()) {
400 fTextureSize = SkISize::Make(texture->width(), texture->height()); 394 fTextureSize = SkISize::Make(texture->width(), texture->height());
401 float delta = 1.0f/(3.0f*texture->width()); 395 float delta = 1.0f/(3.0f*texture->width());
402 if (dfTexEffect.getFlags() & kBGR_DistanceFieldEffectFlag) { 396 if (dfTexEffect.useBGR()) {
403 delta = -delta; 397 delta = -delta;
404 } 398 }
405 uman.set3f(fTextureSizeUni, 399 uman.set3f(fTextureSizeUni,
406 SkIntToScalar(fTextureSize.width()), 400 SkIntToScalar(fTextureSize.width()),
407 SkIntToScalar(fTextureSize.height()), 401 SkIntToScalar(fTextureSize.height()),
408 delta); 402 delta);
409 } 403 }
410 404
411 GrColor textColor = dfTexEffect.getTextColor(); 405 GrColor textColor = dfTexEffect.getTextColor();
412 if (textColor != fTextColor) { 406 if (textColor != fTextColor) {
413 static const float ONE_OVER_255 = 1.f / 255.f; 407 static const float ONE_OVER_255 = 1.f / 255.f;
414 uman.set3f(fTextColorUni, 408 uman.set3f(fTextColorUni,
415 GrColorUnpackR(textColor) * ONE_OVER_255, 409 GrColorUnpackR(textColor) * ONE_OVER_255,
416 GrColorUnpackG(textColor) * ONE_OVER_255, 410 GrColorUnpackG(textColor) * ONE_OVER_255,
417 GrColorUnpackB(textColor) * ONE_OVER_255); 411 GrColorUnpackB(textColor) * ONE_OVER_255);
418 fTextColor = textColor; 412 fTextColor = textColor;
419 } 413 }
420 } 414 }
421 415
422 static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, 416 static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
423 GrEffectKeyBuilder* b) { 417 GrEffectKeyBuilder* b) {
424 const GrDistanceFieldLCDTextureEffect& dfTexEffect = 418 const GrDistanceFieldLCDTextureEffect& dfTexEffect =
425 drawEffect.castEffect<GrDistanceField LCDTextureEffect>(); 419 drawEffect.castEffect<GrDistanceField LCDTextureEffect>();
426 420
427 b->add32(dfTexEffect.getFlags()); 421 b->add32(dfTexEffect.isUniformScale());
428 } 422 }
429 423
430 private: 424 private:
431 GrGLUniformManager::UniformHandle fTextureSizeUni; 425 GrGLUniformManager::UniformHandle fTextureSizeUni;
432 SkISize fTextureSize; 426 SkISize fTextureSize;
433 GrGLUniformManager::UniformHandle fTextColorUni; 427 GrGLUniformManager::UniformHandle fTextColorUni;
434 SkColor fTextColor; 428 SkColor fTextColor;
435 429
436 typedef GrGLVertexEffect INHERITED; 430 typedef GrGLVertexEffect INHERITED;
437 }; 431 };
438 432
439 /////////////////////////////////////////////////////////////////////////////// 433 ///////////////////////////////////////////////////////////////////////////////
440 434
441 GrDistanceFieldLCDTextureEffect::GrDistanceFieldLCDTextureEffect( 435 GrDistanceFieldLCDTextureEffect::GrDistanceFieldLCDTextureEffect(
442 GrTexture* texture, const GrTe xtureParams& params, 436 GrTexture* texture, const GrTe xtureParams& params,
443 GrTexture* gamma, const GrText ureParams& gParams, 437 GrTexture* gamma, const GrText ureParams& gParams,
444 SkColor textColor, 438 SkColor textColor,
445 uint32_t flags) 439 bool uniformScale, bool useBGR )
446 : fTextureAccess(texture, params) 440 : fTextureAccess(texture, params)
447 , fGammaTextureAccess(gamma, gParams) 441 , fGammaTextureAccess(gamma, gParams)
448 , fTextColor(textColor) 442 , fTextColor(textColor)
449 , fFlags(flags & kLCD_DistanceFieldEffectMask) { 443 , fUniformScale(uniformScale)
450 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag)); 444 , fUseBGR(useBGR) {
451
452 this->addTextureAccess(&fTextureAccess); 445 this->addTextureAccess(&fTextureAccess);
453 this->addTextureAccess(&fGammaTextureAccess); 446 this->addTextureAccess(&fGammaTextureAccess);
454 this->addVertexAttrib(kVec2f_GrSLType); 447 this->addVertexAttrib(kVec2f_GrSLType);
455 } 448 }
456 449
457 bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrEffect& other) const { 450 bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrEffect& other) const {
458 const GrDistanceFieldLCDTextureEffect& cte = 451 const GrDistanceFieldLCDTextureEffect& cte =
459 CastEffect<GrDistanceFieldLCDTexture Effect>(other); 452 CastEffect<GrDistanceFieldLCDTexture Effect>(other);
460 return (fTextureAccess == cte.fTextureAccess && 453 return (fTextureAccess == cte.fTextureAccess && fGammaTextureAccess == cte.f GammaTextureAccess);
461 fGammaTextureAccess == cte.fGammaTextureAccess &&
462 fTextColor == cte.fTextColor &&
463 fFlags == cte.fFlags);
464 } 454 }
465 455
466 void GrDistanceFieldLCDTextureEffect::getConstantColorComponents(GrColor* color, 456 void GrDistanceFieldLCDTextureEffect::getConstantColorComponents(GrColor* color,
467 uint32_t* valid Flags) const { 457 uint32_t* valid Flags) const {
468 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color ) && 458 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color ) &&
469 GrPixelConfigIsOpaque(this->texture(0)->config())) { 459 GrPixelConfigIsOpaque(this->texture(0)->config())) {
470 *validFlags = kA_GrColorComponentFlag; 460 *validFlags = kA_GrColorComponentFlag;
471 } else { 461 } else {
472 *validFlags = 0; 462 *validFlags = 0;
473 } 463 }
(...skipping 25 matching lines...) Expand all
499 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 489 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
500 }; 490 };
501 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode : 491 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode :
502 GrTextureParams::kNone_FilterMode); 492 GrTextureParams::kNone_FilterMode);
503 GrTextureParams params2(tileModes, random->nextBool() ? GrTextureParams::kBi lerp_FilterMode : 493 GrTextureParams params2(tileModes, random->nextBool() ? GrTextureParams::kBi lerp_FilterMode :
504 GrTextureParams::kNone_FilterMode); 494 GrTextureParams::kNone_FilterMode);
505 GrColor textColor = GrColorPackRGBA(random->nextULessThan(256), 495 GrColor textColor = GrColorPackRGBA(random->nextULessThan(256),
506 random->nextULessThan(256), 496 random->nextULessThan(256),
507 random->nextULessThan(256), 497 random->nextULessThan(256),
508 random->nextULessThan(256)); 498 random->nextULessThan(256));
509 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
510 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
511 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
512 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params, 499 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params,
513 textures[texIdx2], params2, 500 textures[texIdx2], params2,
514 textColor, 501 textColor,
515 flags); 502 random->nextBool(), random->n extBool());
516 } 503 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldTextureEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698