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

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

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 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/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMagnifierImageFilter.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 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 GrProcessorKeyBuilder* b) const { 1590 GrProcessorKeyBuilder* b) const {
1591 GrGLDiffuseLightingEffect::GenKey(*this, caps, b); 1591 GrGLDiffuseLightingEffect::GenKey(*this, caps, b);
1592 } 1592 }
1593 1593
1594 GrGLFragmentProcessor* GrDiffuseLightingEffect::createGLInstance() const { 1594 GrGLFragmentProcessor* GrDiffuseLightingEffect::createGLInstance() const {
1595 return SkNEW_ARGS(GrGLDiffuseLightingEffect, (*this)); 1595 return SkNEW_ARGS(GrGLDiffuseLightingEffect, (*this));
1596 } 1596 }
1597 1597
1598 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect); 1598 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect);
1599 1599
1600 GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(SkRandom* random, 1600 GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestData* d) {
1601 GrContext* context, 1601 SkScalar surfaceScale = d->fRandom->nextSScalar1();
1602 const GrCaps&, 1602 SkScalar kd = d->fRandom->nextUScalar1();
1603 GrTexture* textures[]) { 1603 SkAutoTUnref<SkLight> light(create_random_light(d->fRandom));
1604 SkScalar surfaceScale = random->nextSScalar1();
1605 SkScalar kd = random->nextUScalar1();
1606 SkAutoTUnref<SkLight> light(create_random_light(random));
1607 SkMatrix matrix; 1604 SkMatrix matrix;
1608 for (int i = 0; i < 9; i++) { 1605 for (int i = 0; i < 9; i++) {
1609 matrix[i] = random->nextUScalar1(); 1606 matrix[i] = d->fRandom->nextUScalar1();
1610 } 1607 }
1611 BoundaryMode mode = static_cast<BoundaryMode>(random->nextU() % kBoundaryMod eCount); 1608 BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundar yModeCount);
1612 return GrDiffuseLightingEffect::Create(textures[GrProcessorUnitTest::kAlphaT extureIdx], 1609 return GrDiffuseLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kAl phaTextureIdx],
1613 light, surfaceScale, matrix, kd, mode ); 1610 light, surfaceScale, matrix, kd, mode );
1614 } 1611 }
1615 1612
1616 1613
1617 /////////////////////////////////////////////////////////////////////////////// 1614 ///////////////////////////////////////////////////////////////////////////////
1618 1615
1619 GrGLLightingEffect::GrGLLightingEffect(const GrProcessor& fp) { 1616 GrGLLightingEffect::GrGLLightingEffect(const GrProcessor& fp) {
1620 const GrLightingEffect& m = fp.cast<GrLightingEffect>(); 1617 const GrLightingEffect& m = fp.cast<GrLightingEffect>();
1621 fLight = m.light()->createGLLight(); 1618 fLight = m.light()->createGLLight();
1622 fBoundaryMode = m.boundaryMode(); 1619 fBoundaryMode = m.boundaryMode();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 GrProcessorKeyBuilder* b) const { 1795 GrProcessorKeyBuilder* b) const {
1799 GrGLSpecularLightingEffect::GenKey(*this, caps, b); 1796 GrGLSpecularLightingEffect::GenKey(*this, caps, b);
1800 } 1797 }
1801 1798
1802 GrGLFragmentProcessor* GrSpecularLightingEffect::createGLInstance() const { 1799 GrGLFragmentProcessor* GrSpecularLightingEffect::createGLInstance() const {
1803 return SkNEW_ARGS(GrGLSpecularLightingEffect, (*this)); 1800 return SkNEW_ARGS(GrGLSpecularLightingEffect, (*this));
1804 } 1801 }
1805 1802
1806 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect); 1803 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect);
1807 1804
1808 GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(SkRandom* random, 1805 GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestData* d ) {
1809 GrContext* context, 1806 SkScalar surfaceScale = d->fRandom->nextSScalar1();
1810 const GrCaps&, 1807 SkScalar ks = d->fRandom->nextUScalar1();
1811 GrTexture* textures[]) { 1808 SkScalar shininess = d->fRandom->nextUScalar1();
1812 SkScalar surfaceScale = random->nextSScalar1(); 1809 SkAutoTUnref<SkLight> light(create_random_light(d->fRandom));
1813 SkScalar ks = random->nextUScalar1();
1814 SkScalar shininess = random->nextUScalar1();
1815 SkAutoTUnref<SkLight> light(create_random_light(random));
1816 SkMatrix matrix; 1810 SkMatrix matrix;
1817 for (int i = 0; i < 9; i++) { 1811 for (int i = 0; i < 9; i++) {
1818 matrix[i] = random->nextUScalar1(); 1812 matrix[i] = d->fRandom->nextUScalar1();
1819 } 1813 }
1820 BoundaryMode mode = static_cast<BoundaryMode>(random->nextU() % kBoundaryMod eCount); 1814 BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundar yModeCount);
1821 return GrSpecularLightingEffect::Create(textures[GrProcessorUnitTest::kAlpha TextureIdx], 1815 return GrSpecularLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kA lphaTextureIdx],
1822 light, surfaceScale, matrix, ks, shi niness, mode); 1816 light, surfaceScale, matrix, ks, shi niness, mode);
1823 } 1817 }
1824 1818
1825 /////////////////////////////////////////////////////////////////////////////// 1819 ///////////////////////////////////////////////////////////////////////////////
1826 1820
1827 GrGLSpecularLightingEffect::GrGLSpecularLightingEffect(const GrProcessor& proc) 1821 GrGLSpecularLightingEffect::GrGLSpecularLightingEffect(const GrProcessor& proc)
1828 : INHERITED(proc) { 1822 : INHERITED(proc) {
1829 } 1823 }
1830 1824
1831 void GrGLSpecularLightingEffect::emitLightFunc(GrGLFPBuilder* builder, SkString* funcName) { 1825 void GrGLSpecularLightingEffect::emitLightFunc(GrGLFPBuilder* builder, SkString* funcName) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 1990
1997 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); 1991 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
1998 } 1992 }
1999 1993
2000 #endif 1994 #endif
2001 1995
2002 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) 1996 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter)
2003 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) 1997 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter)
2004 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) 1998 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter)
2005 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1999 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698