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

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

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

Powered by Google App Engine
This is Rietveld 408576698