Index: samplecode/SampleLayers.cpp |
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp |
index 3ae543915c253dda4a406688784ba8fa49cc8ee4..51f02a1adef5d8a0043585ace6138d1c3a2f7c91 100644 |
--- a/samplecode/SampleLayers.cpp |
+++ b/samplecode/SampleLayers.cpp |
@@ -27,10 +27,11 @@ |
#include "SkXfermode.h" |
#include "SkDrawFilter.h" |
-static void make_paint(SkPaint* paint) { |
+static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) { |
SkColor colors[] = { 0, SK_ColorWHITE }; |
SkPoint pts[] = { { 0, 0 }, { 0, SK_Scalar1*20 } }; |
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode); |
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode, |
+ NULL, 0, &localMatrix); |
paint->setShader(s)->unref(); |
paint->setXfermodeMode(SkXfermode::kDstIn_Mode); |
@@ -104,19 +105,16 @@ static void test_fade(SkCanvas* canvas) { |
dump_layers("outside layer alpha", canvas); |
// now apply an effect |
+ SkMatrix m; |
+ m.setScale(SK_Scalar1, -SK_Scalar1); |
+ m.postTranslate(0, SkIntToScalar(100)); |
SkPaint paint; |
- make_paint(&paint); |
+ make_paint(&paint, m); |
r.set(0, 0, SkIntToScalar(100), SkIntToScalar(20)); |
// SkDebugf("--------- draw top grad\n"); |
canvas->drawRect(r, paint); |
- SkMatrix m; |
- SkShader* s = paint.getShader(); |
- m.setScale(SK_Scalar1, -SK_Scalar1); |
- m.postTranslate(0, SkIntToScalar(100)); |
- s->setLocalMatrix(m); |
- |
r.fTop = SkIntToScalar(80); |
r.fBottom = SkIntToScalar(100); |
// SkDebugf("--------- draw bot grad\n"); |