| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 bool GrDiffuseLightingEffect::onIsEqual(const GrEffect& sBase) const { | 1073 bool GrDiffuseLightingEffect::onIsEqual(const GrEffect& sBase) const { |
| 1074 const GrDiffuseLightingEffect& s = CastEffect<GrDiffuseLightingEffect>(sBase
); | 1074 const GrDiffuseLightingEffect& s = CastEffect<GrDiffuseLightingEffect>(sBase
); |
| 1075 return INHERITED::onIsEqual(sBase) && | 1075 return INHERITED::onIsEqual(sBase) && |
| 1076 this->kd() == s.kd(); | 1076 this->kd() == s.kd(); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect); | 1079 GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect); |
| 1080 | 1080 |
| 1081 GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkMWCRandom* random, | 1081 GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkMWCRandom* random, |
| 1082 GrContext* context, | 1082 GrContext* context, |
| 1083 const GrDrawTargetCaps&, |
| 1083 GrTexture* textures[]) { | 1084 GrTexture* textures[]) { |
| 1084 SkScalar surfaceScale = random->nextSScalar1(); | 1085 SkScalar surfaceScale = random->nextSScalar1(); |
| 1085 SkScalar kd = random->nextUScalar1(); | 1086 SkScalar kd = random->nextUScalar1(); |
| 1086 SkAutoTUnref<SkLight> light(create_random_light(random)); | 1087 SkAutoTUnref<SkLight> light(create_random_light(random)); |
| 1087 return GrDiffuseLightingEffect::Create(textures[GrEffectUnitTest::kAlphaText
ureIdx], | 1088 return GrDiffuseLightingEffect::Create(textures[GrEffectUnitTest::kAlphaText
ureIdx], |
| 1088 light, surfaceScale, kd); | 1089 light, surfaceScale, kd); |
| 1089 } | 1090 } |
| 1090 | 1091 |
| 1091 | 1092 |
| 1092 /////////////////////////////////////////////////////////////////////////////// | 1093 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 const GrSpecularLightingEffect& s = CastEffect<GrSpecularLightingEffect>(sBa
se); | 1290 const GrSpecularLightingEffect& s = CastEffect<GrSpecularLightingEffect>(sBa
se); |
| 1290 return INHERITED::onIsEqual(sBase) && | 1291 return INHERITED::onIsEqual(sBase) && |
| 1291 this->ks() == s.ks() && | 1292 this->ks() == s.ks() && |
| 1292 this->shininess() == s.shininess(); | 1293 this->shininess() == s.shininess(); |
| 1293 } | 1294 } |
| 1294 | 1295 |
| 1295 GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect); | 1296 GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect); |
| 1296 | 1297 |
| 1297 GrEffectRef* GrSpecularLightingEffect::TestCreate(SkMWCRandom* random, | 1298 GrEffectRef* GrSpecularLightingEffect::TestCreate(SkMWCRandom* random, |
| 1298 GrContext* context, | 1299 GrContext* context, |
| 1300 const GrDrawTargetCaps&, |
| 1299 GrTexture* textures[]) { | 1301 GrTexture* textures[]) { |
| 1300 SkScalar surfaceScale = random->nextSScalar1(); | 1302 SkScalar surfaceScale = random->nextSScalar1(); |
| 1301 SkScalar ks = random->nextUScalar1(); | 1303 SkScalar ks = random->nextUScalar1(); |
| 1302 SkScalar shininess = random->nextUScalar1(); | 1304 SkScalar shininess = random->nextUScalar1(); |
| 1303 SkAutoTUnref<SkLight> light(create_random_light(random)); | 1305 SkAutoTUnref<SkLight> light(create_random_light(random)); |
| 1304 return GrSpecularLightingEffect::Create(textures[GrEffectUnitTest::kAlphaTex
tureIdx], | 1306 return GrSpecularLightingEffect::Create(textures[GrEffectUnitTest::kAlphaTex
tureIdx], |
| 1305 light, surfaceScale, ks, shininess); | 1307 light, surfaceScale, ks, shininess); |
| 1306 } | 1308 } |
| 1307 | 1309 |
| 1308 /////////////////////////////////////////////////////////////////////////////// | 1310 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 | 1469 |
| 1468 #endif | 1470 #endif |
| 1469 | 1471 |
| 1470 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1472 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 1471 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1473 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 1472 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1474 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 1473 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDistantLight) | 1475 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDistantLight) |
| 1474 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPointLight) | 1476 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPointLight) |
| 1475 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpotLight) | 1477 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpotLight) |
| 1476 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |