diff options
Diffstat (limited to 'gm/lighting.cpp')
-rw-r--r-- | gm/lighting.cpp | 61 |
1 files changed, 9 insertions, 52 deletions
diff --git a/gm/lighting.cpp b/gm/lighting.cpp index 0bfbb47a95..36c8ba0e45 100644 --- a/gm/lighting.cpp +++ b/gm/lighting.cpp @@ -7,10 +7,9 @@ #include "gm.h" #include "SkLightingImageFilter.h" -#include "SkOffsetImageFilter.h" #define WIDTH 330 -#define HEIGHT 660 +#define HEIGHT 440 namespace skiagm { @@ -87,70 +86,28 @@ protected: SkPaint paint; SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65)); - SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100)); - SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0, NULL, &cropRect)); int y = 0; - for (int i = 0; i < 3; i++) { - const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : NULL; - SkImageFilter* input = (i == 2) ? noopCropped.get() : NULL; - paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, - white, - surfaceScale, - kd, - input, - cr))->unref(); + for (int i = 0; i < 2; i++) { + const SkImageFilter::CropRect* cr = (i == 0) ? NULL : &cropRect; + paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, white, surfaceScale, kd, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 0, y); - paint.setImageFilter(SkLightingImageFilter::CreateDistantLitDiffuse(distantDirection, - white, - surfaceScale, - kd, - input, - cr))->unref(); + paint.setImageFilter(SkLightingImageFilter::CreateDistantLitDiffuse(distantDirection, white, surfaceScale, kd, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 110, y); - paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, - spotTarget, - spotExponent, - cutoffAngle, - white, - surfaceScale, - kd, - input, - cr))->unref(); + paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, spotTarget, spotExponent, cutoffAngle, white, surfaceScale, kd, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 220, y); y += 110; - paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(pointLocation, - white, - surfaceScale, - ks, - shininess, - input, - cr))->unref(); + paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(pointLocation, white, surfaceScale, ks, shininess, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 0, y); - paint.setImageFilter(SkLightingImageFilter::CreateDistantLitSpecular(distantDirection, - white, - surfaceScale, - ks, - shininess, - input, - cr))->unref(); + paint.setImageFilter(SkLightingImageFilter::CreateDistantLitSpecular(distantDirection, white, surfaceScale, ks, shininess, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 110, y); - paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, - spotTarget, - spotExponent, - cutoffAngle, - white, - surfaceScale, - ks, - shininess, - input, - cr))->unref(); + paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, spotTarget, spotExponent, cutoffAngle, white, surfaceScale, ks, shininess, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 220, y); y += 110; |