From c76230868d45838b61c3ee25140839a5ec3689ac Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Thu, 12 Jul 2012 14:39:07 +0000 Subject: [PATCH] Fix the lighting filters unit test and re-enable it. Review URL: http://codereview.appspot.com/6355098/ git-svn-id: http://skia.googlecode.com/svn/trunk@4568 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/gl/GrGpuGL_unittest.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gpu/gl/GrGpuGL_unittest.cpp b/src/gpu/gl/GrGpuGL_unittest.cpp index 8ef2094f14..044d4777d9 100644 --- a/src/gpu/gl/GrGpuGL_unittest.cpp +++ b/src/gpu/gl/GrGpuGL_unittest.cpp @@ -40,14 +40,12 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, kDilate_EffectType, kRadialGradient_EffectType, kRadial2Gradient_EffectType, -#if 0 kDiffuseDistant_EffectType, kDiffusePoint_EffectType, kDiffuseSpot_EffectType, kSpecularDistant_EffectType, kSpecularPoint_EffectType, kSpecularSpot_EffectType, -#endif kSweepGradient_EffectType, kEffectCount @@ -120,7 +118,6 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, case kSweepGradient_EffectType: { return SkNEW(GrSweepGradient); } -#if 0 case kDiffuseDistant_EffectType: { SkPoint3 direction = random_point3(random); direction.normalize(); @@ -130,7 +127,8 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, SkAutoTUnref filter(SkLightingImageFilter::CreateDistantLitDiffuse(direction, lightColor, surfaceScale, kd)); // does not work with perspective or mul-by-alpha-mask GrCustomStage* stage; - SkASSERT(filter->asNewCustomStage(&stage)); + bool ok = filter->asNewCustomStage(&stage); + SkASSERT(ok); return stage; } case kDiffusePoint_EffectType: { @@ -141,7 +139,8 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, SkAutoTUnref filter(SkLightingImageFilter::CreatePointLitDiffuse(location, lightColor, surfaceScale, kd)); // does not work with perspective or mul-by-alpha-mask GrCustomStage* stage; - SkASSERT(filter->asNewCustomStage(&stage)); + bool ok = filter->asNewCustomStage(&stage); + SkASSERT(ok); return stage; } case kDiffuseSpot_EffectType: { @@ -157,7 +156,8 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, location, target, specularExponent, cutoffAngle, lightColor, surfaceScale, ks, shininess)); // does not work with perspective or mul-by-alpha-mask GrCustomStage* stage; - SkASSERT(filter->asNewCustomStage(&stage)); + bool ok = filter->asNewCustomStage(&stage); + SkASSERT(ok); return stage; } case kSpecularDistant_EffectType: { @@ -170,7 +170,8 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, SkAutoTUnref filter(SkLightingImageFilter::CreateDistantLitSpecular(direction, lightColor, surfaceScale, ks, shininess)); // does not work with perspective or mul-by-alpha-mask GrCustomStage* stage; - SkASSERT(filter->asNewCustomStage(&stage)); + bool ok = filter->asNewCustomStage(&stage); + SkASSERT(ok); return stage; } case kSpecularPoint_EffectType: { @@ -182,7 +183,8 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, SkAutoTUnref filter(SkLightingImageFilter::CreatePointLitSpecular(location, lightColor, surfaceScale, ks, shininess)); // does not work with perspective or mul-by-alpha-mask GrCustomStage* stage; - SkASSERT(filter->asNewCustomStage(&stage)); + bool ok = filter->asNewCustomStage(&stage); + SkASSERT(ok); return stage; } case kSpecularSpot_EffectType: { @@ -198,10 +200,10 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc, location, target, specularExponent, cutoffAngle, lightColor, surfaceScale, ks, shininess)); // does not work with perspective or mul-by-alpha-mask GrCustomStage* stage; - SkASSERT(filter->asNewCustomStage(&stage)); + bool ok = filter->asNewCustomStage(&stage); + SkASSERT(ok); return stage; } -#endif default: GrCrash("Unexpected custom effect type"); }