Index: gm/lighting.cpp |
diff --git a/gm/lighting.cpp b/gm/lighting.cpp |
index f16e781db0d6eeaf7685542e129a1e1cd5b915ac..330e0ee5fe46d3e3b6af759577421521de777801 100644 |
--- a/gm/lighting.cpp |
+++ b/gm/lighting.cpp |
@@ -44,9 +44,10 @@ protected: |
void drawClippedBitmap(SkCanvas* canvas, const SkPaint& paint, int x, int y) { |
canvas->save(); |
- canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), |
- SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height()))); |
- canvas->drawBitmap(fBitmap, SkIntToScalar(x), SkIntToScalar(y), &paint); |
+ canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
+ canvas->clipRect(SkRect::MakeWH( |
+ SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height()))); |
+ canvas->drawBitmap(fBitmap, 0, 0, &paint); |
canvas->restore(); |
} |
@@ -91,18 +92,24 @@ protected: |
const SkIRect* 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, NULL, cr))->unref(); |
drawClippedBitmap(canvas, paint, 110, y); |
+ |
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, NULL, cr))->unref(); |
drawClippedBitmap(canvas, paint, 0, y); |
+ |
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, NULL, cr))->unref(); |
drawClippedBitmap(canvas, paint, 220, y); |
+ |
y += 110; |
} |
} |