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

Side by Side Diff: src/effects/SkLightingImageFilter.cpp

Issue 1443743002: Rename some processor functions from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@primProcs
Patch Set: nits Created 5 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
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLumaColorFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkLightingImageFilter.h" 8 #include "SkLightingImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 SkScalar kd, 524 SkScalar kd,
525 BoundaryMode boundaryMode) { 525 BoundaryMode boundaryMode) {
526 return new GrDiffuseLightingEffect(texture, light, surfaceScale, matrix, kd, boundaryMode); 526 return new GrDiffuseLightingEffect(texture, light, surfaceScale, matrix, kd, boundaryMode);
527 } 527 }
528 528
529 const char* name() const override { return "DiffuseLighting"; } 529 const char* name() const override { return "DiffuseLighting"; }
530 530
531 SkScalar kd() const { return fKD; } 531 SkScalar kd() const { return fKD; }
532 532
533 private: 533 private:
534 GrGLSLFragmentProcessor* onCreateGLInstance() const override; 534 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
535 535
536 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride; 536 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
537 537
538 bool onIsEqual(const GrFragmentProcessor&) const override; 538 bool onIsEqual(const GrFragmentProcessor&) const override;
539 539
540 GrDiffuseLightingEffect(GrTexture* texture, 540 GrDiffuseLightingEffect(GrTexture* texture,
541 const SkImageFilterLight* light, 541 const SkImageFilterLight* light,
542 SkScalar surfaceScale, 542 SkScalar surfaceScale,
543 const SkMatrix& matrix, 543 const SkMatrix& matrix,
544 SkScalar kd, 544 SkScalar kd,
545 BoundaryMode boundaryMode); 545 BoundaryMode boundaryMode);
546 546
(...skipping 10 matching lines...) Expand all
557 const SkMatrix& matrix, 557 const SkMatrix& matrix,
558 SkScalar ks, 558 SkScalar ks,
559 SkScalar shininess, 559 SkScalar shininess,
560 BoundaryMode boundaryMode) { 560 BoundaryMode boundaryMode) {
561 return new GrSpecularLightingEffect(texture, light, surfaceScale, matrix , ks, shininess, 561 return new GrSpecularLightingEffect(texture, light, surfaceScale, matrix , ks, shininess,
562 boundaryMode); 562 boundaryMode);
563 } 563 }
564 564
565 const char* name() const override { return "SpecularLighting"; } 565 const char* name() const override { return "SpecularLighting"; }
566 566
567 GrGLSLFragmentProcessor* onCreateGLInstance() const override; 567 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
568 568
569 SkScalar ks() const { return fKS; } 569 SkScalar ks() const { return fKS; }
570 SkScalar shininess() const { return fShininess; } 570 SkScalar shininess() const { return fShininess; }
571 571
572 private: 572 private:
573 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride; 573 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
574 574
575 bool onIsEqual(const GrFragmentProcessor&) const override; 575 bool onIsEqual(const GrFragmentProcessor&) const override;
576 576
577 GrSpecularLightingEffect(GrTexture* texture, 577 GrSpecularLightingEffect(GrTexture* texture,
578 const SkImageFilterLight* light, 578 const SkImageFilterLight* light,
579 SkScalar surfaceScale, 579 SkScalar surfaceScale,
580 const SkMatrix& matrix, 580 const SkMatrix& matrix,
581 SkScalar ks, 581 SkScalar ks,
582 SkScalar shininess, 582 SkScalar shininess,
583 BoundaryMode boundaryMode); 583 BoundaryMode boundaryMode);
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 : INHERITED(texture, light, surfaceScale, matrix, boundaryMode), fKD(kd) { 1607 : INHERITED(texture, light, surfaceScale, matrix, boundaryMode), fKD(kd) {
1608 this->initClassID<GrDiffuseLightingEffect>(); 1608 this->initClassID<GrDiffuseLightingEffect>();
1609 } 1609 }
1610 1610
1611 bool GrDiffuseLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 1611 bool GrDiffuseLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
1612 const GrDiffuseLightingEffect& s = sBase.cast<GrDiffuseLightingEffect>(); 1612 const GrDiffuseLightingEffect& s = sBase.cast<GrDiffuseLightingEffect>();
1613 return INHERITED::onIsEqual(sBase) && 1613 return INHERITED::onIsEqual(sBase) &&
1614 this->kd() == s.kd(); 1614 this->kd() == s.kd();
1615 } 1615 }
1616 1616
1617 void GrDiffuseLightingEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 1617 void GrDiffuseLightingEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
1618 GrProcessorKeyBuilder* b) cons t { 1618 GrProcessorKeyBuilder* b) co nst {
1619 GrGLDiffuseLightingEffect::GenKey(*this, caps, b); 1619 GrGLDiffuseLightingEffect::GenKey(*this, caps, b);
1620 } 1620 }
1621 1621
1622 GrGLSLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLInstance() const { 1622 GrGLSLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLSLInstance() const {
1623 return new GrGLDiffuseLightingEffect(*this); 1623 return new GrGLDiffuseLightingEffect(*this);
1624 } 1624 }
1625 1625
1626 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect); 1626 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect);
1627 1627
1628 const GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa ta* d) { 1628 const GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa ta* d) {
1629 SkScalar surfaceScale = d->fRandom->nextSScalar1(); 1629 SkScalar surfaceScale = d->fRandom->nextSScalar1();
1630 SkScalar kd = d->fRandom->nextUScalar1(); 1630 SkScalar kd = d->fRandom->nextUScalar1();
1631 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom)); 1631 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom));
1632 SkMatrix matrix; 1632 SkMatrix matrix;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 this->initClassID<GrSpecularLightingEffect>(); 1808 this->initClassID<GrSpecularLightingEffect>();
1809 } 1809 }
1810 1810
1811 bool GrSpecularLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 1811 bool GrSpecularLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
1812 const GrSpecularLightingEffect& s = sBase.cast<GrSpecularLightingEffect>(); 1812 const GrSpecularLightingEffect& s = sBase.cast<GrSpecularLightingEffect>();
1813 return INHERITED::onIsEqual(sBase) && 1813 return INHERITED::onIsEqual(sBase) &&
1814 this->ks() == s.ks() && 1814 this->ks() == s.ks() &&
1815 this->shininess() == s.shininess(); 1815 this->shininess() == s.shininess();
1816 } 1816 }
1817 1817
1818 void GrSpecularLightingEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 1818 void GrSpecularLightingEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
1819 GrProcessorKeyBuilder* b) con st { 1819 GrProcessorKeyBuilder* b) c onst {
1820 GrGLSpecularLightingEffect::GenKey(*this, caps, b); 1820 GrGLSpecularLightingEffect::GenKey(*this, caps, b);
1821 } 1821 }
1822 1822
1823 GrGLSLFragmentProcessor* GrSpecularLightingEffect::onCreateGLInstance() const { 1823 GrGLSLFragmentProcessor* GrSpecularLightingEffect::onCreateGLSLInstance() const {
1824 return new GrGLSpecularLightingEffect(*this); 1824 return new GrGLSpecularLightingEffect(*this);
1825 } 1825 }
1826 1826
1827 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect); 1827 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect);
1828 1828
1829 const GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestD ata* d) { 1829 const GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestD ata* d) {
1830 SkScalar surfaceScale = d->fRandom->nextSScalar1(); 1830 SkScalar surfaceScale = d->fRandom->nextSScalar1();
1831 SkScalar ks = d->fRandom->nextUScalar1(); 1831 SkScalar ks = d->fRandom->nextUScalar1();
1832 SkScalar shininess = d->fRandom->nextUScalar1(); 1832 SkScalar shininess = d->fRandom->nextUScalar1();
1833 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom)); 1833 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom));
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 2014
2015 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); 2015 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
2016 } 2016 }
2017 2017
2018 #endif 2018 #endif
2019 2019
2020 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) 2020 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter)
2021 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) 2021 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter)
2022 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) 2022 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter)
2023 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 2023 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698