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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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/GrDistanceFieldGeoProc.h ('k') | src/gpu/effects/GrMatrixConvolutionEffect.h » ('j') | 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 "GrDistanceFieldGeoProc.h" 8 #include "GrDistanceFieldGeoProc.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 /////////////////////////////////////////////////////////////////////////////// 206 ///////////////////////////////////////////////////////////////////////////////
207 207
208 GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, 208 GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
209 const SkMatrix& viewM atrix, 209 const SkMatrix& viewM atrix,
210 GrTexture* texture, 210 GrTexture* texture,
211 const GrTextureParams & params, 211 const GrTextureParams & params,
212 #ifdef SK_GAMMA_APPLY_TO_A8 212 #ifdef SK_GAMMA_APPLY_TO_A8
213 float distanceAdjust, 213 float distanceAdjust,
214 #endif 214 #endif
215 uint32_t flags, 215 uint32_t flags,
216 bool usesLocalCoords) 216 bool usesLocalCoords, GrRenderTarget* dst)
217 : fColor(color) 217 : fColor(color)
218 , fViewMatrix(viewMatrix) 218 , fViewMatrix(viewMatrix)
219 , fTextureAccess(texture, params) 219 , fTextureAccess(texture, params, dst)
220 #ifdef SK_GAMMA_APPLY_TO_A8 220 #ifdef SK_GAMMA_APPLY_TO_A8
221 , fDistanceAdjust(distanceAdjust) 221 , fDistanceAdjust(distanceAdjust)
222 #endif 222 #endif
223 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) 223 , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
224 , fInColor(nullptr) 224 , fInColor(nullptr)
225 , fUsesLocalCoords(usesLocalCoords) { 225 , fUsesLocalCoords(usesLocalCoords) {
226 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); 226 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
227 this->initClassID<GrDistanceFieldA8TextGeoProc>(); 227 this->initClassID<GrDistanceFieldA8TextGeoProc>();
228 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 228 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
229 kHigh_GrSLPrecision)); 229 kHigh_GrSLPrecision));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 GrTextureParams::kNon e_FilterMode); 264 GrTextureParams::kNon e_FilterMode);
265 265
266 return GrDistanceFieldA8TextGeoProc::Create(GrRandomColor(d->fRandom), 266 return GrDistanceFieldA8TextGeoProc::Create(GrRandomColor(d->fRandom),
267 GrTest::TestMatrix(d->fRandom), 267 GrTest::TestMatrix(d->fRandom),
268 d->fTextures[texIdx], params, 268 d->fTextures[texIdx], params,
269 #ifdef SK_GAMMA_APPLY_TO_A8 269 #ifdef SK_GAMMA_APPLY_TO_A8
270 d->fRandom->nextF(), 270 d->fRandom->nextF(),
271 #endif 271 #endif
272 d->fRandom->nextBool() ? 272 d->fRandom->nextBool() ?
273 kSimilarity_DistanceFieldEff ectFlag : 0, 273 kSimilarity_DistanceFieldEff ectFlag : 0,
274 d->fRandom->nextBool()); 274 d->fRandom->nextBool(), NULL );
275 } 275 }
276 276
277 /////////////////////////////////////////////////////////////////////////////// 277 ///////////////////////////////////////////////////////////////////////////////
278 278
279 class GrGLDistanceFieldPathGeoProc : public GrGLGeometryProcessor { 279 class GrGLDistanceFieldPathGeoProc : public GrGLGeometryProcessor {
280 public: 280 public:
281 GrGLDistanceFieldPathGeoProc() 281 GrGLDistanceFieldPathGeoProc()
282 : fViewMatrix(SkMatrix::InvalidMatrix()) 282 : fViewMatrix(SkMatrix::InvalidMatrix())
283 , fColor(GrColor_ILLEGAL) 283 , fColor(GrColor_ILLEGAL)
284 , fTextureSize(SkISize::Make(-1, -1)) {} 284 , fTextureSize(SkISize::Make(-1, -1)) {}
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 }; 426 };
427 427
428 /////////////////////////////////////////////////////////////////////////////// 428 ///////////////////////////////////////////////////////////////////////////////
429 429
430 GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( 430 GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
431 GrColor color, 431 GrColor color,
432 const SkMatrix& viewMatrix, 432 const SkMatrix& viewMatrix,
433 GrTexture* texture, 433 GrTexture* texture,
434 const GrTextureParams& params, 434 const GrTextureParams& params,
435 uint32_t flags, 435 uint32_t flags,
436 bool usesLocalCoords) 436 bool usesLocalCoords, GrRenderTarget* dst)
437 : fColor(color) 437 : fColor(color)
438 , fViewMatrix(viewMatrix) 438 , fViewMatrix(viewMatrix)
439 , fTextureAccess(texture, params) 439 , fTextureAccess(texture, params, dst)
440 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) 440 , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
441 , fInColor(nullptr) 441 , fInColor(nullptr)
442 , fUsesLocalCoords(usesLocalCoords) { 442 , fUsesLocalCoords(usesLocalCoords) {
443 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); 443 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
444 this->initClassID<GrDistanceFieldPathGeoProc>(); 444 this->initClassID<GrDistanceFieldPathGeoProc>();
445 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 445 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
446 kHigh_GrSLPrecision)); 446 kHigh_GrSLPrecision));
447 if (flags & kColorAttr_DistanceFieldEffectFlag) { 447 if (flags & kColorAttr_DistanceFieldEffectFlag) {
448 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType)); 448 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
449 } 449 }
(...skipping 29 matching lines...) Expand all
479 }; 479 };
480 GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams:: kBilerp_FilterMode 480 GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams:: kBilerp_FilterMode
481 : GrTextureParams:: kNone_FilterMode); 481 : GrTextureParams:: kNone_FilterMode);
482 482
483 return GrDistanceFieldPathGeoProc::Create(GrRandomColor(d->fRandom), 483 return GrDistanceFieldPathGeoProc::Create(GrRandomColor(d->fRandom),
484 GrTest::TestMatrix(d->fRandom), 484 GrTest::TestMatrix(d->fRandom),
485 d->fTextures[texIdx], 485 d->fTextures[texIdx],
486 params, 486 params,
487 d->fRandom->nextBool() ? 487 d->fRandom->nextBool() ?
488 kSimilarity_DistanceFieldE ffectFlag : 0, 488 kSimilarity_DistanceFieldE ffectFlag : 0,
489 d->fRandom->nextBool()); 489 d->fRandom->nextBool(), NU LL);
490 } 490 }
491 491
492 /////////////////////////////////////////////////////////////////////////////// 492 ///////////////////////////////////////////////////////////////////////////////
493 493
494 class GrGLDistanceFieldLCDTextGeoProc : public GrGLGeometryProcessor { 494 class GrGLDistanceFieldLCDTextGeoProc : public GrGLGeometryProcessor {
495 public: 495 public:
496 GrGLDistanceFieldLCDTextGeoProc() 496 GrGLDistanceFieldLCDTextGeoProc()
497 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) { 497 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {
498 fDistanceAdjust = GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(1. 0f, 1.0f, 1.0f); 498 fDistanceAdjust = GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(1. 0f, 1.0f, 1.0f);
499 } 499 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 typedef GrGLGeometryProcessor INHERITED; 700 typedef GrGLGeometryProcessor INHERITED;
701 }; 701 };
702 702
703 /////////////////////////////////////////////////////////////////////////////// 703 ///////////////////////////////////////////////////////////////////////////////
704 704
705 GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( 705 GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
706 GrColor color, const SkMatrix& viewMatrix, 706 GrColor color, const SkMatrix& viewMatrix,
707 GrTexture* texture, const GrTe xtureParams& params, 707 GrTexture* texture, const GrTe xtureParams& params,
708 DistanceAdjust distanceAdjust, 708 DistanceAdjust distanceAdjust,
709 uint32_t flags, bool usesLocal Coords) 709 uint32_t flags, bool usesLocal Coords, GrRenderTarget* dst)
710 : fColor(color) 710 : fColor(color)
711 , fViewMatrix(viewMatrix) 711 , fViewMatrix(viewMatrix)
712 , fTextureAccess(texture, params) 712 , fTextureAccess(texture, params, dst)
713 , fDistanceAdjust(distanceAdjust) 713 , fDistanceAdjust(distanceAdjust)
714 , fFlags(flags & kLCD_DistanceFieldEffectMask) 714 , fFlags(flags & kLCD_DistanceFieldEffectMask)
715 , fUsesLocalCoords(usesLocalCoords) { 715 , fUsesLocalCoords(usesLocalCoords) {
716 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag)); 716 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag));
717 this->initClassID<GrDistanceFieldLCDTextGeoProc>(); 717 this->initClassID<GrDistanceFieldLCDTextGeoProc>();
718 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 718 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
719 kHigh_GrSLPrecision)); 719 kHigh_GrSLPrecision));
720 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", 720 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
721 kVec2s_GrVertexAttribTyp e)); 721 kVec2s_GrVertexAttribTyp e));
722 this->addTextureAccess(&fTextureAccess); 722 this->addTextureAccess(&fTextureAccess);
(...skipping 28 matching lines...) Expand all
751 GrTextureParams::kNone_FilterMode); 751 GrTextureParams::kNone_FilterMode);
752 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; 752 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f };
753 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; 753 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
754 flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; 754 flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
755 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 755 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
756 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom), 756 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom),
757 GrTest::TestMatrix(d->fRandom), 757 GrTest::TestMatrix(d->fRandom),
758 d->fTextures[texIdx], params, 758 d->fTextures[texIdx], params,
759 wa, 759 wa,
760 flags, 760 flags,
761 d->fRandom->nextBool()); 761 d->fRandom->nextBool(), NULL);
762 } 762 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.h ('k') | src/gpu/effects/GrMatrixConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698