OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 paint->setShader(s)->unref(); | 35 paint->setShader(s)->unref(); |
36 paint->setXfermodeMode(SkXfermode::kDstIn_Mode); | 36 paint->setXfermodeMode(SkXfermode::kDstIn_Mode); |
37 } | 37 } |
38 | 38 |
39 static void dump_layers(const char label[], SkCanvas* canvas) { | 39 static void dump_layers(const char label[], SkCanvas* canvas) { |
40 SkDebugf("Dump Layers(%s)\n", label); | 40 SkDebugf("Dump Layers(%s)\n", label); |
41 | 41 |
42 SkCanvas::LayerIter iter(canvas, true); | 42 SkCanvas::LayerIter iter(canvas, true); |
43 int index = 0; | 43 int index = 0; |
44 while (!iter.done()) { | 44 while (!iter.done()) { |
45 SkImageInfo info = iter.device()->imageInfo(); | 45 const SkBitmap& bm = iter.device()->accessBitmap(false); |
46 const SkIRect& clip = iter.clip().getBounds(); | 46 const SkIRect& clip = iter.clip().getBounds(); |
47 SkDebugf("Layer[%d] bitmap [%d %d] X=%d Y=%d clip=[%d %d %d %d] alpha=%d
\n", index++, | 47 SkDebugf("Layer[%d] bitmap [%d %d] X=%d Y=%d clip=[%d %d %d %d] alpha=%d
\n", index++, |
48 info.width(), info.height(), iter.x(), iter.y(), | 48 bm.width(), bm.height(), iter.x(), iter.y(), |
49 clip.fLeft, clip.fTop, clip.fRight, clip.fBottom, | 49 clip.fLeft, clip.fTop, clip.fRight, clip.fBottom, |
50 iter.paint().getAlpha()); | 50 iter.paint().getAlpha()); |
51 iter.next(); | 51 iter.next(); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 // test drawing with strips of fading gradient above and below | 55 // test drawing with strips of fading gradient above and below |
56 static void test_fade(SkCanvas* canvas) { | 56 static void test_fade(SkCanvas* canvas) { |
57 SkAutoCanvasRestore ar(canvas, true); | 57 SkAutoCanvasRestore ar(canvas, true); |
58 | 58 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 | 267 |
268 private: | 268 private: |
269 typedef SkView INHERITED; | 269 typedef SkView INHERITED; |
270 }; | 270 }; |
271 | 271 |
272 ////////////////////////////////////////////////////////////////////////////// | 272 ////////////////////////////////////////////////////////////////////////////// |
273 | 273 |
274 static SkView* MyFactory() { return new LayersView; } | 274 static SkView* MyFactory() { return new LayersView; } |
275 static SkViewRegister reg(MyFactory); | 275 static SkViewRegister reg(MyFactory); |
OLD | NEW |