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

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

Issue 1145273002: Use high precision vertex attributes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 100-col fixes Created 5 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/GrBezierEffect.cpp ('k') | src/gpu/gl/GrGLPrimitiveProcessor.cpp » ('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 "GrFontAtlasSizes.h" 9 #include "GrFontAtlasSizes.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 , fViewMatrix(viewMatrix) 198 , fViewMatrix(viewMatrix)
199 , fTextureAccess(texture, params) 199 , fTextureAccess(texture, params)
200 #ifdef SK_GAMMA_APPLY_TO_A8 200 #ifdef SK_GAMMA_APPLY_TO_A8
201 , fDistanceAdjust(distanceAdjust) 201 , fDistanceAdjust(distanceAdjust)
202 #endif 202 #endif
203 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) 203 , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
204 , fInColor(NULL) 204 , fInColor(NULL)
205 , fUsesLocalCoords(usesLocalCoords) { 205 , fUsesLocalCoords(usesLocalCoords) {
206 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); 206 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
207 this->initClassID<GrDistanceFieldA8TextGeoProc>(); 207 this->initClassID<GrDistanceFieldA8TextGeoProc>();
208 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 208 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
209 kHigh_GrSLPrecision));
209 if (flags & kColorAttr_DistanceFieldEffectFlag) { 210 if (flags & kColorAttr_DistanceFieldEffectFlag) {
210 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType)); 211 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
211 } 212 }
212 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", 213 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
213 kVec2s_GrVertexAttribT ype)); 214 kVec2s_GrVertexAttribT ype));
214 this->addTextureAccess(&fTextureAccess); 215 this->addTextureAccess(&fTextureAccess);
215 } 216 }
216 217
217 void GrDistanceFieldA8TextGeoProc::getGLProcessorKey(const GrBatchTracker& bt, 218 void GrDistanceFieldA8TextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
218 const GrGLSLCaps& caps, 219 const GrGLSLCaps& caps,
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 uint32_t flags, 414 uint32_t flags,
414 bool usesLocalCoords) 415 bool usesLocalCoords)
415 : fColor(color) 416 : fColor(color)
416 , fViewMatrix(viewMatrix) 417 , fViewMatrix(viewMatrix)
417 , fTextureAccess(texture, params) 418 , fTextureAccess(texture, params)
418 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) 419 , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
419 , fInColor(NULL) 420 , fInColor(NULL)
420 , fUsesLocalCoords(usesLocalCoords) { 421 , fUsesLocalCoords(usesLocalCoords) {
421 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); 422 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
422 this->initClassID<GrDistanceFieldPathGeoProc>(); 423 this->initClassID<GrDistanceFieldPathGeoProc>();
423 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 424 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
425 kHigh_GrSLPrecision));
424 if (flags & kColorAttr_DistanceFieldEffectFlag) { 426 if (flags & kColorAttr_DistanceFieldEffectFlag) {
425 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType)); 427 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
426 } 428 }
427 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", 429 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
428 kVec2f_GrVertexAttribTyp e)); 430 kVec2f_GrVertexAttribTyp e));
429 this->addTextureAccess(&fTextureAccess); 431 this->addTextureAccess(&fTextureAccess);
430 } 432 }
431 433
432 void GrDistanceFieldPathGeoProc::getGLProcessorKey(const GrBatchTracker& bt, 434 void GrDistanceFieldPathGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
433 const GrGLSLCaps& caps, 435 const GrGLSLCaps& caps,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 DistanceAdjust distanceAdjust, 669 DistanceAdjust distanceAdjust,
668 uint32_t flags, bool usesLocal Coords) 670 uint32_t flags, bool usesLocal Coords)
669 : fColor(color) 671 : fColor(color)
670 , fViewMatrix(viewMatrix) 672 , fViewMatrix(viewMatrix)
671 , fTextureAccess(texture, params) 673 , fTextureAccess(texture, params)
672 , fDistanceAdjust(distanceAdjust) 674 , fDistanceAdjust(distanceAdjust)
673 , fFlags(flags & kLCD_DistanceFieldEffectMask) 675 , fFlags(flags & kLCD_DistanceFieldEffectMask)
674 , fUsesLocalCoords(usesLocalCoords) { 676 , fUsesLocalCoords(usesLocalCoords) {
675 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag)); 677 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag));
676 this->initClassID<GrDistanceFieldLCDTextGeoProc>(); 678 this->initClassID<GrDistanceFieldLCDTextGeoProc>();
677 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 679 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
680 kHigh_GrSLPrecision));
678 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", 681 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
679 kVec2s_GrVertexAttribTyp e)); 682 kVec2s_GrVertexAttribTyp e));
680 this->addTextureAccess(&fTextureAccess); 683 this->addTextureAccess(&fTextureAccess);
681 } 684 }
682 685
683 void GrDistanceFieldLCDTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt, 686 void GrDistanceFieldLCDTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
684 const GrGLSLCaps& caps, 687 const GrGLSLCaps& caps,
685 GrProcessorKeyBuilder* b) const { 688 GrProcessorKeyBuilder* b) const {
686 GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, bt, caps, b); 689 GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, bt, caps, b);
687 } 690 }
(...skipping 29 matching lines...) Expand all
717 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; 720 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
718 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; 721 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
719 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 722 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
720 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), 723 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random),
721 GrTest::TestMatrix(random), 724 GrTest::TestMatrix(random),
722 textures[texIdx], params, 725 textures[texIdx], params,
723 wa, 726 wa,
724 flags, 727 flags,
725 random->nextBool()); 728 random->nextBool());
726 } 729 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBezierEffect.cpp ('k') | src/gpu/gl/GrGLPrimitiveProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698