OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 canvas->save(); | 47 canvas->save(); |
48 | 48 |
49 canvas->translate(x, y); | 49 canvas->translate(x, y); |
50 SkPaint p; | 50 SkPaint p; |
51 p.setAntiAlias(false); | 51 p.setAntiAlias(false); |
52 p.setStyle(SkPaint::kFill_Style); | 52 p.setStyle(SkPaint::kFill_Style); |
53 p.setShader(fBG); | 53 p.setShader(fBG); |
54 SkRect r = SkRect::MakeWH(w, h); | 54 SkRect r = SkRect::MakeWH(w, h); |
55 canvas->drawRect(r, p); | 55 canvas->drawRect(r, p); |
56 | 56 |
57 canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); | 57 canvas->saveLayer(&r, NULL); |
58 | 58 |
59 p.setShader(fDst); | 59 p.setShader(fDst); |
60 canvas->drawRect(r, p); | 60 canvas->drawRect(r, p); |
61 p.setShader(fSrc); | 61 p.setShader(fSrc); |
62 p.setXfermode(xm); | 62 p.setXfermode(xm); |
63 canvas->drawRect(r, p); | 63 canvas->drawRect(r, p); |
64 | 64 |
65 canvas->restore(); | 65 canvas->restore(); |
66 | 66 |
67 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); | 67 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 typedef GM INHERITED; | 145 typedef GM INHERITED; |
146 }; | 146 }; |
147 | 147 |
148 ////////////////////////////////////////////////////////////////////////////// | 148 ////////////////////////////////////////////////////////////////////////////// |
149 | 149 |
150 static GM* MyFactory(void*) { return new Xfermodes2GM; } | 150 static GM* MyFactory(void*) { return new Xfermodes2GM; } |
151 static GMRegistry reg(MyFactory); | 151 static GMRegistry reg(MyFactory); |
152 | 152 |
153 } | 153 } |
OLD | NEW |