Index: gm/lighting.cpp |
diff --git a/gm/lighting.cpp b/gm/lighting.cpp |
index 36c8ba0e45e17ea1cf989c4824f7834ee0f145b9..0bfbb47a95e140a4f436a102d43629b171e3555b 100644 |
--- a/gm/lighting.cpp |
+++ b/gm/lighting.cpp |
@@ -7,9 +7,10 @@ |
#include "gm.h" |
#include "SkLightingImageFilter.h" |
+#include "SkOffsetImageFilter.h" |
#define WIDTH 330 |
-#define HEIGHT 440 |
+#define HEIGHT 660 |
namespace skiagm { |
@@ -86,28 +87,70 @@ 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 < 2; i++) { |
- const SkImageFilter::CropRect* cr = (i == 0) ? NULL : &cropRect; |
- paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, white, surfaceScale, kd, NULL, cr))->unref(); |
+ 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(); |
drawClippedBitmap(canvas, paint, 0, y); |
- paint.setImageFilter(SkLightingImageFilter::CreateDistantLitDiffuse(distantDirection, white, surfaceScale, kd, NULL, cr))->unref(); |
+ paint.setImageFilter(SkLightingImageFilter::CreateDistantLitDiffuse(distantDirection, |
+ white, |
+ surfaceScale, |
+ kd, |
+ input, |
+ cr))->unref(); |
drawClippedBitmap(canvas, paint, 110, y); |
- paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, spotTarget, spotExponent, cutoffAngle, white, surfaceScale, kd, NULL, cr))->unref(); |
+ paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, |
+ spotTarget, |
+ spotExponent, |
+ cutoffAngle, |
+ white, |
+ surfaceScale, |
+ kd, |
+ input, |
+ cr))->unref(); |
drawClippedBitmap(canvas, paint, 220, y); |
y += 110; |
- paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(pointLocation, white, surfaceScale, ks, shininess, NULL, cr))->unref(); |
+ paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(pointLocation, |
+ white, |
+ surfaceScale, |
+ ks, |
+ shininess, |
+ input, |
+ cr))->unref(); |
drawClippedBitmap(canvas, paint, 0, y); |
- paint.setImageFilter(SkLightingImageFilter::CreateDistantLitSpecular(distantDirection, white, surfaceScale, ks, shininess, NULL, cr))->unref(); |
+ paint.setImageFilter(SkLightingImageFilter::CreateDistantLitSpecular(distantDirection, |
+ white, |
+ surfaceScale, |
+ ks, |
+ shininess, |
+ input, |
+ cr))->unref(); |
drawClippedBitmap(canvas, paint, 110, y); |
- paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, spotTarget, spotExponent, cutoffAngle, white, surfaceScale, ks, shininess, NULL, cr))->unref(); |
+ paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, |
+ spotTarget, |
+ spotExponent, |
+ cutoffAngle, |
+ white, |
+ surfaceScale, |
+ ks, |
+ shininess, |
+ input, |
+ cr))->unref(); |
drawClippedBitmap(canvas, paint, 220, y); |
y += 110; |