Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: samplecode/SampleLayers.cpp

Issue 1906573003: Revert of Hide SkCanvas::LayerIter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkCanvas.h ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « include/core/SkCanvas.h ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698