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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 p.addRoundRect(r, SkIntToScalar(50), SkIntToScalar(50)); | 49 p.addRoundRect(r, SkIntToScalar(50), SkIntToScalar(50)); |
50 rec->clipPath(p, SkRegion::kIntersect_Op, true); | 50 rec->clipPath(p, SkRegion::kIntersect_Op, true); |
51 rec->translate(SkIntToScalar(250), SkIntToScalar(250)); | 51 rec->translate(SkIntToScalar(250), SkIntToScalar(250)); |
52 rec->clipPath(p, SkRegion::kIntersect_Op, true); | 52 rec->clipPath(p, SkRegion::kIntersect_Op, true); |
53 rec->drawColor(0xffff0000); | 53 rec->drawColor(0xffff0000); |
54 SkAutoTUnref<SkPicture> pict(recorder.endRecording()); | 54 SkAutoTUnref<SkPicture> pict(recorder.endRecording()); |
55 | 55 |
56 canvas->setAllowSimplifyClip(true); | 56 canvas->setAllowSimplifyClip(true); |
57 canvas->save(); | 57 canvas->save(); |
58 canvas->drawPicture(*pict); | 58 canvas->drawPicture(pict); |
59 canvas->restore(); | 59 canvas->restore(); |
60 | 60 |
61 canvas->setAllowSimplifyClip(false); | 61 canvas->setAllowSimplifyClip(false); |
62 canvas->save(); | 62 canvas->save(); |
63 canvas->translate(SkIntToScalar(1200 / 2), 0); | 63 canvas->translate(SkIntToScalar(1200 / 2), 0); |
64 canvas->drawPicture(*pict); | 64 canvas->drawPicture(pict); |
65 canvas->restore(); | 65 canvas->restore(); |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 typedef GM INHERITED; | 69 typedef GM INHERITED; |
70 }; | 70 }; |
71 | 71 |
72 ////////////////////////////////////////////////////////////////////////////// | 72 ////////////////////////////////////////////////////////////////////////////// |
73 | 73 |
74 static GM* MyFactory(void*) { return new PathOpsSkpClipGM; } | 74 static GM* MyFactory(void*) { return new PathOpsSkpClipGM; } |
75 static GMRegistry reg(MyFactory); | 75 static GMRegistry reg(MyFactory); |
76 | 76 |
77 } | 77 } |
OLD | NEW |