Index: samplecode/SampleLayers.cpp |
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp |
index 43869762e723c21145a5c5c277281a42b8ab190b..194f0a70a92505882f01beab8633c8cf0a5c9cf7 100644 |
--- a/samplecode/SampleLayers.cpp |
+++ b/samplecode/SampleLayers.cpp |
@@ -12,6 +12,7 @@ |
#include "SkCamera.h" |
#include "SkColorFilter.h" |
#include "SkColorPriv.h" |
+#include "SkDevice.h" |
#include "SkGradientShader.h" |
#include "SkImage.h" |
#include "SkInterpolator.h" |
@@ -34,6 +35,22 @@ |
paint->setXfermodeMode(SkXfermode::kDstIn_Mode); |
} |
+static void dump_layers(const char label[], SkCanvas* canvas) { |
+ SkDebugf("Dump Layers(%s)\n", label); |
+ |
+ SkCanvas::LayerIter iter(canvas, true); |
+ int index = 0; |
+ while (!iter.done()) { |
+ SkImageInfo info = iter.device()->imageInfo(); |
+ const SkIRect& clip = iter.clip().getBounds(); |
+ SkDebugf("Layer[%d] bitmap [%d %d] X=%d Y=%d clip=[%d %d %d %d] alpha=%d\n", index++, |
+ info.width(), info.height(), iter.x(), iter.y(), |
+ clip.fLeft, clip.fTop, clip.fRight, clip.fBottom, |
+ iter.paint().getAlpha()); |
+ iter.next(); |
+ } |
+} |
+ |
// test drawing with strips of fading gradient above and below |
static void test_fade(SkCanvas* canvas) { |
SkAutoCanvasRestore ar(canvas, true); |
@@ -69,6 +86,8 @@ |
p.setAntiAlias(true); |
canvas->drawOval(r, p); |
+ dump_layers("inside layer alpha", canvas); |
+ |
canvas->restore(); |
} else { |
r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100)); |
@@ -80,6 +99,8 @@ |
} |
// return; |
+ |
+ dump_layers("outside layer alpha", canvas); |
// now apply an effect |
SkMatrix m; |