| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 59 SkRect r; | 59 SkRect r; |
| 60 | 60 |
| 61 SkPaint p; | 61 SkPaint p; |
| 62 p.setAlpha(0x88); | 62 p.setAlpha(0x88); |
| 63 | 63 |
| 64 SkAutoCanvasRestore(canvas, false); | 64 SkAutoCanvasRestore ar2(canvas, false); |
| 65 | 65 |
| 66 // create the layers | 66 // create the layers |
| 67 | 67 |
| 68 r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100)); | 68 r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100)); |
| 69 canvas->clipRect(r); | 69 canvas->clipRect(r); |
| 70 | 70 |
| 71 r.fBottom = SkIntToScalar(20); | 71 r.fBottom = SkIntToScalar(20); |
| 72 canvas->saveLayer(&r, NULL, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_S
aveFlag | SkCanvas::kFullColorLayer_SaveFlag)); | 72 canvas->saveLayer(&r, NULL, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_S
aveFlag | SkCanvas::kFullColorLayer_SaveFlag)); |
| 73 | 73 |
| 74 r.fTop = SkIntToScalar(80); | 74 r.fTop = SkIntToScalar(80); |
| (...skipping 191 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 |