OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 SkPictureRecorder recorder; | 35 SkPictureRecorder recorder; |
36 SkCanvas* rec = recorder.beginRecording(1200, 900, nullptr, 0); | 36 SkCanvas* rec = recorder.beginRecording(1200, 900, nullptr, 0); |
37 SkPath p; | 37 SkPath p; |
38 SkRect r = { | 38 SkRect r = { |
39 SkIntToScalar(100), | 39 SkIntToScalar(100), |
40 SkIntToScalar(200), | 40 SkIntToScalar(200), |
41 SkIntToScalar(400), | 41 SkIntToScalar(400), |
42 SkIntToScalar(700) | 42 SkIntToScalar(700) |
43 }; | 43 }; |
44 p.addRoundRect(r, SkIntToScalar(50), SkIntToScalar(50)); | 44 p.addRoundRect(r, SkIntToScalar(50), SkIntToScalar(50)); |
45 rec->clipPath(p, SkRegion::kIntersect_Op, true); | 45 rec->clipPath(p, SkCanvas::kIntersect_Op, true); |
46 rec->translate(SkIntToScalar(250), SkIntToScalar(250)); | 46 rec->translate(SkIntToScalar(250), SkIntToScalar(250)); |
47 rec->clipPath(p, SkRegion::kIntersect_Op, true); | 47 rec->clipPath(p, SkCanvas::kIntersect_Op, true); |
48 rec->drawColor(0xffff0000); | 48 rec->drawColor(0xffff0000); |
49 sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture()); | 49 sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture()); |
50 | 50 |
51 canvas->setAllowSimplifyClip(true); | 51 canvas->setAllowSimplifyClip(true); |
52 canvas->save(); | 52 canvas->save(); |
53 canvas->drawPicture(pict); | 53 canvas->drawPicture(pict); |
54 canvas->restore(); | 54 canvas->restore(); |
55 | 55 |
56 canvas->setAllowSimplifyClip(false); | 56 canvas->setAllowSimplifyClip(false); |
57 canvas->save(); | 57 canvas->save(); |
58 canvas->translate(SkIntToScalar(1200 / 2), 0); | 58 canvas->translate(SkIntToScalar(1200 / 2), 0); |
59 canvas->drawPicture(pict); | 59 canvas->drawPicture(pict); |
60 canvas->restore(); | 60 canvas->restore(); |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 typedef GM INHERITED; | 64 typedef GM INHERITED; |
65 }; | 65 }; |
66 | 66 |
67 ////////////////////////////////////////////////////////////////////////////// | 67 ////////////////////////////////////////////////////////////////////////////// |
68 | 68 |
69 static GM* MyFactory(void*) { return new PathOpsSkpClipGM; } | 69 static GM* MyFactory(void*) { return new PathOpsSkpClipGM; } |
70 static GMRegistry reg(MyFactory); | 70 static GMRegistry reg(MyFactory); |
71 | 71 |
72 } | 72 } |
OLD | NEW |