OLD | NEW |
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 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 GrProcessorKeyBuilder* b) const
{ | 1626 GrProcessorKeyBuilder* b) const
{ |
1627 GrGLDiffuseLightingEffect::GenKey(*this, caps, b); | 1627 GrGLDiffuseLightingEffect::GenKey(*this, caps, b); |
1628 } | 1628 } |
1629 | 1629 |
1630 GrGLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLInstance() const { | 1630 GrGLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLInstance() const { |
1631 return new GrGLDiffuseLightingEffect(*this); | 1631 return new GrGLDiffuseLightingEffect(*this); |
1632 } | 1632 } |
1633 | 1633 |
1634 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect); | 1634 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect); |
1635 | 1635 |
1636 GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestData* d)
{ | 1636 const GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa
ta* d) { |
1637 SkScalar surfaceScale = d->fRandom->nextSScalar1(); | 1637 SkScalar surfaceScale = d->fRandom->nextSScalar1(); |
1638 SkScalar kd = d->fRandom->nextUScalar1(); | 1638 SkScalar kd = d->fRandom->nextUScalar1(); |
1639 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom)); | 1639 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom)); |
1640 SkMatrix matrix; | 1640 SkMatrix matrix; |
1641 for (int i = 0; i < 9; i++) { | 1641 for (int i = 0; i < 9; i++) { |
1642 matrix[i] = d->fRandom->nextUScalar1(); | 1642 matrix[i] = d->fRandom->nextUScalar1(); |
1643 } | 1643 } |
1644 BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundar
yModeCount); | 1644 BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundar
yModeCount); |
1645 return GrDiffuseLightingEffect::Create(d->fProcDataManager, | 1645 return GrDiffuseLightingEffect::Create(d->fProcDataManager, |
1646 d->fTextures[GrProcessorUnitTest::kAl
phaTextureIdx], | 1646 d->fTextures[GrProcessorUnitTest::kAl
phaTextureIdx], |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 GrProcessorKeyBuilder* b) const
{ | 1829 GrProcessorKeyBuilder* b) const
{ |
1830 GrGLSpecularLightingEffect::GenKey(*this, caps, b); | 1830 GrGLSpecularLightingEffect::GenKey(*this, caps, b); |
1831 } | 1831 } |
1832 | 1832 |
1833 GrGLFragmentProcessor* GrSpecularLightingEffect::onCreateGLInstance() const { | 1833 GrGLFragmentProcessor* GrSpecularLightingEffect::onCreateGLInstance() const { |
1834 return new GrGLSpecularLightingEffect(*this); | 1834 return new GrGLSpecularLightingEffect(*this); |
1835 } | 1835 } |
1836 | 1836 |
1837 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect); | 1837 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect); |
1838 | 1838 |
1839 GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestData* d
) { | 1839 const GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestD
ata* d) { |
1840 SkScalar surfaceScale = d->fRandom->nextSScalar1(); | 1840 SkScalar surfaceScale = d->fRandom->nextSScalar1(); |
1841 SkScalar ks = d->fRandom->nextUScalar1(); | 1841 SkScalar ks = d->fRandom->nextUScalar1(); |
1842 SkScalar shininess = d->fRandom->nextUScalar1(); | 1842 SkScalar shininess = d->fRandom->nextUScalar1(); |
1843 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom)); | 1843 SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom)); |
1844 SkMatrix matrix; | 1844 SkMatrix matrix; |
1845 for (int i = 0; i < 9; i++) { | 1845 for (int i = 0; i < 9; i++) { |
1846 matrix[i] = d->fRandom->nextUScalar1(); | 1846 matrix[i] = d->fRandom->nextUScalar1(); |
1847 } | 1847 } |
1848 BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundar
yModeCount); | 1848 BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundar
yModeCount); |
1849 return GrSpecularLightingEffect::Create(d->fProcDataManager, | 1849 return GrSpecularLightingEffect::Create(d->fProcDataManager, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 | 2025 |
2026 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2026 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2027 } | 2027 } |
2028 | 2028 |
2029 #endif | 2029 #endif |
2030 | 2030 |
2031 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2031 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2032 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2032 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2033 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2033 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2034 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2034 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |