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

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

Issue 1514563002: Revert of Allow LCD text to batch across colorchanges. This will always use (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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') | 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 "GrDistanceFieldGeoProc.h" 8 #include "GrDistanceFieldGeoProc.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 const GrDistanceFieldPathGeoProc& dfpgp = proc.cast<GrDistanceFieldPathG eoProc>(); 410 const GrDistanceFieldPathGeoProc& dfpgp = proc.cast<GrDistanceFieldPathG eoProc>();
411 411
412 if (!dfpgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfpgp. viewMatrix())) { 412 if (!dfpgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfpgp. viewMatrix())) {
413 fViewMatrix = dfpgp.viewMatrix(); 413 fViewMatrix = dfpgp.viewMatrix();
414 float viewMatrix[3 * 3]; 414 float viewMatrix[3 * 3];
415 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix); 415 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
416 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); 416 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
417 } 417 }
418 418
419 if (dfpgp.color() != fColor && !dfpgp.hasVertexColor()) { 419 if (dfpgp.color() != fColor) {
420 float c[4]; 420 float c[4];
421 GrColorToRGBAFloat(dfpgp.color(), c); 421 GrColorToRGBAFloat(dfpgp.color(), c);
422 pdman.set4fv(fColorUniform, 1, c); 422 pdman.set4fv(fColorUniform, 1, c);
423 fColor = dfpgp.color(); 423 fColor = dfpgp.color();
424 } 424 }
425 } 425 }
426 426
427 static inline void GenKey(const GrGeometryProcessor& gp, 427 static inline void GenKey(const GrGeometryProcessor& gp,
428 const GrGLSLCaps&, 428 const GrGLSLCaps&,
429 GrProcessorKeyBuilder* b) { 429 GrProcessorKeyBuilder* b) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 528 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
529 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 529 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
530 530
531 // emit attributes 531 // emit attributes
532 varyingHandler->emitAttributes(dfTexEffect); 532 varyingHandler->emitAttributes(dfTexEffect);
533 533
534 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 534 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
535 535
536 // setup pass through color 536 // setup pass through color
537 if (!dfTexEffect.colorIgnored()) { 537 if (!dfTexEffect.colorIgnored()) {
538 if (dfTexEffect.hasVertexColor()) { 538 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputCol or, &fColorUniform);
539 varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), a rgs.fOutputColor);
540 } else {
541 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutpu tColor,
542 &fColorUniform);
543 }
544 } 539 }
545 540
546 // Setup position 541 // Setup position
547 this->setupPosition(vertBuilder, 542 this->setupPosition(vertBuilder,
548 uniformHandler, 543 uniformHandler,
549 gpArgs, 544 gpArgs,
550 dfTexEffect.inPosition()->fName, 545 dfTexEffect.inPosition()->fName,
551 dfTexEffect.viewMatrix(), 546 dfTexEffect.viewMatrix(),
552 &fViewMatrixUniform); 547 &fViewMatrixUniform);
553 548
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 fDistanceAdjust = wa; 689 fDistanceAdjust = wa;
695 } 690 }
696 691
697 if (!dflcd.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dflcd. viewMatrix())) { 692 if (!dflcd.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dflcd. viewMatrix())) {
698 fViewMatrix = dflcd.viewMatrix(); 693 fViewMatrix = dflcd.viewMatrix();
699 float viewMatrix[3 * 3]; 694 float viewMatrix[3 * 3];
700 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix); 695 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
701 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); 696 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
702 } 697 }
703 698
704 if (dflcd.color() != fColor && !dflcd.hasVertexColor()) { 699 if (dflcd.color() != fColor) {
705 float c[4]; 700 float c[4];
706 GrColorToRGBAFloat(dflcd.color(), c); 701 GrColorToRGBAFloat(dflcd.color(), c);
707 pdman.set4fv(fColorUniform, 1, c); 702 pdman.set4fv(fColorUniform, 1, c);
708 fColor = dflcd.color(); 703 fColor = dflcd.color();
709 } 704 }
710 } 705 }
711 706
712 static inline void GenKey(const GrGeometryProcessor& gp, 707 static inline void GenKey(const GrGeometryProcessor& gp,
713 const GrGLSLCaps&, 708 const GrGLSLCaps&,
714 GrProcessorKeyBuilder* b) { 709 GrProcessorKeyBuilder* b) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 : fColor(color) 743 : fColor(color)
749 , fViewMatrix(viewMatrix) 744 , fViewMatrix(viewMatrix)
750 , fTextureAccess(texture, params) 745 , fTextureAccess(texture, params)
751 , fDistanceAdjust(distanceAdjust) 746 , fDistanceAdjust(distanceAdjust)
752 , fFlags(flags & kLCD_DistanceFieldEffectMask) 747 , fFlags(flags & kLCD_DistanceFieldEffectMask)
753 , fUsesLocalCoords(usesLocalCoords) { 748 , fUsesLocalCoords(usesLocalCoords) {
754 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag)); 749 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan ceFieldEffectFlag));
755 this->initClassID<GrDistanceFieldLCDTextGeoProc>(); 750 this->initClassID<GrDistanceFieldLCDTextGeoProc>();
756 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 751 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType,
757 kHigh_GrSLPrecision)); 752 kHigh_GrSLPrecision));
758 if (flags & kColorAttr_DistanceFieldEffectFlag) {
759 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
760 }
761 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", 753 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
762 kVec2s_GrVertexAttribTyp e)); 754 kVec2s_GrVertexAttribTyp e));
763 this->addTextureAccess(&fTextureAccess); 755 this->addTextureAccess(&fTextureAccess);
764 } 756 }
765 757
766 void GrDistanceFieldLCDTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, 758 void GrDistanceFieldLCDTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps,
767 GrProcessorKeyBuilder* b ) const { 759 GrProcessorKeyBuilder* b ) const {
768 GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, caps, b); 760 GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, caps, b);
769 } 761 }
770 762
(...skipping 23 matching lines...) Expand all
794 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; 786 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
795 flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; 787 flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
796 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 788 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
797 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom), 789 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom),
798 GrTest::TestMatrix(d->fRandom), 790 GrTest::TestMatrix(d->fRandom),
799 d->fTextures[texIdx], params, 791 d->fTextures[texIdx], params,
800 wa, 792 wa,
801 flags, 793 flags,
802 d->fRandom->nextBool()); 794 d->fRandom->nextBool());
803 } 795 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698