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

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

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 "GrInvariantOutput.h"
9 #include "gl/builders/GrGLProgramBuilder.h" 10 #include "gl/builders/GrGLProgramBuilder.h"
10 #include "gl/GrGLProcessor.h" 11 #include "gl/GrGLProcessor.h"
11 #include "gl/GrGLSL.h" 12 #include "gl/GrGLSL.h"
12 #include "gl/GrGLTexture.h" 13 #include "gl/GrGLTexture.h"
13 #include "gl/GrGLGeometryProcessor.h" 14 #include "gl/GrGLGeometryProcessor.h"
14 #include "GrTBackendProcessorFactory.h" 15 #include "GrTBackendProcessorFactory.h"
15 #include "GrTexture.h" 16 #include "GrTexture.h"
16 17
17 #include "SkDistanceFieldGen.h" 18 #include "SkDistanceFieldGen.h"
18 19
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 bool GrDistanceFieldTextureEffect::onIsEqual(const GrGeometryProcessor& other) c onst { 191 bool GrDistanceFieldTextureEffect::onIsEqual(const GrGeometryProcessor& other) c onst {
191 const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureE ffect>(); 192 const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureE ffect>();
192 return 193 return
193 #ifdef SK_GAMMA_APPLY_TO_A8 194 #ifdef SK_GAMMA_APPLY_TO_A8
194 fLuminance == cte.fLuminance && 195 fLuminance == cte.fLuminance &&
195 #endif 196 #endif
196 fFlags == cte.fFlags; 197 fFlags == cte.fFlags;
197 } 198 }
198 199
199 void GrDistanceFieldTextureEffect::onComputeInvariantOutput(InvariantOutput* ino ut) const { 200 void GrDistanceFieldTextureEffect::onComputeInvariantOutput(GrInvariantOutput* i nout) const {
200 inout->mulByUnknownAlpha(); 201 inout->mulByUnknownAlpha();
201 } 202 }
202 203
203 const GrBackendGeometryProcessorFactory& GrDistanceFieldTextureEffect::getFactor y() const { 204 const GrBackendGeometryProcessorFactory& GrDistanceFieldTextureEffect::getFactor y() const {
204 return GrTBackendGeometryProcessorFactory<GrDistanceFieldTextureEffect>::get Instance(); 205 return GrTBackendGeometryProcessorFactory<GrDistanceFieldTextureEffect>::get Instance();
205 } 206 }
206 207
207 /////////////////////////////////////////////////////////////////////////////// 208 ///////////////////////////////////////////////////////////////////////////////
208 209
209 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldTextureEffect); 210 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldTextureEffect);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); 360 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
360 this->addTextureAccess(&fTextureAccess); 361 this->addTextureAccess(&fTextureAccess);
361 } 362 }
362 363
363 bool GrDistanceFieldNoGammaTextureEffect::onIsEqual(const GrGeometryProcessor& o ther) const { 364 bool GrDistanceFieldNoGammaTextureEffect::onIsEqual(const GrGeometryProcessor& o ther) const {
364 const GrDistanceFieldNoGammaTextureEffect& cte = 365 const GrDistanceFieldNoGammaTextureEffect& cte =
365 other.cast<GrDistanceFieldNoGam maTextureEffect>(); 366 other.cast<GrDistanceFieldNoGam maTextureEffect>();
366 return fFlags == cte.fFlags; 367 return fFlags == cte.fFlags;
367 } 368 }
368 369
369 void GrDistanceFieldNoGammaTextureEffect::onComputeInvariantOutput(InvariantOutp ut* inout) const { 370 void GrDistanceFieldNoGammaTextureEffect::onComputeInvariantOutput(GrInvariantOu tput* inout) const {
370 inout->mulByUnknownAlpha(); 371 inout->mulByUnknownAlpha();
371 } 372 }
372 373
373 const GrBackendGeometryProcessorFactory& GrDistanceFieldNoGammaTextureEffect::ge tFactory() const { 374 const GrBackendGeometryProcessorFactory& GrDistanceFieldNoGammaTextureEffect::ge tFactory() const {
374 return GrTBackendGeometryProcessorFactory<GrDistanceFieldNoGammaTextureEffec t>::getInstance(); 375 return GrTBackendGeometryProcessorFactory<GrDistanceFieldNoGammaTextureEffec t>::getInstance();
375 } 376 }
376 377
377 /////////////////////////////////////////////////////////////////////////////// 378 ///////////////////////////////////////////////////////////////////////////////
378 379
379 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldNoGammaTextureEffect); 380 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldNoGammaTextureEffect);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 this->addTextureAccess(&fTextureAccess); 600 this->addTextureAccess(&fTextureAccess);
600 this->addTextureAccess(&fGammaTextureAccess); 601 this->addTextureAccess(&fGammaTextureAccess);
601 } 602 }
602 603
603 bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrGeometryProcessor& other ) const { 604 bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrGeometryProcessor& other ) const {
604 const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTe xtureEffect>(); 605 const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTe xtureEffect>();
605 return (fTextColor == cte.fTextColor && 606 return (fTextColor == cte.fTextColor &&
606 fFlags == cte.fFlags); 607 fFlags == cte.fFlags);
607 } 608 }
608 609
609 void GrDistanceFieldLCDTextureEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 610 void GrDistanceFieldLCDTextureEffect::onComputeInvariantOutput(GrInvariantOutput * inout) const {
610 inout->mulByUnknownColor(); 611 inout->mulByUnknownColor();
611 } 612 }
612 613
613 const GrBackendGeometryProcessorFactory& GrDistanceFieldLCDTextureEffect::getFac tory() const { 614 const GrBackendGeometryProcessorFactory& GrDistanceFieldLCDTextureEffect::getFac tory() const {
614 return GrTBackendGeometryProcessorFactory<GrDistanceFieldLCDTextureEffect>:: getInstance(); 615 return GrTBackendGeometryProcessorFactory<GrDistanceFieldLCDTextureEffect>:: getInstance();
615 } 616 }
616 617
617 /////////////////////////////////////////////////////////////////////////////// 618 ///////////////////////////////////////////////////////////////////////////////
618 619
619 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextureEffect); 620 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextureEffect);
(...skipping 24 matching lines...) Expand all
644 random->nextULessThan(256), 645 random->nextULessThan(256),
645 random->nextULessThan(256)); 646 random->nextULessThan(256));
646 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; 647 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
647 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; 648 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
648 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 649 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
649 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params, 650 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params,
650 textures[texIdx2], params2, 651 textures[texIdx2], params2,
651 textColor, 652 textColor,
652 flags); 653 flags);
653 } 654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698