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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 canvas->save(); | 48 canvas->save(); |
49 | 49 |
50 canvas->translate(x, y); | 50 canvas->translate(x, y); |
51 SkPaint p; | 51 SkPaint p; |
52 p.setAntiAlias(false); | 52 p.setAntiAlias(false); |
53 p.setStyle(SkPaint::kFill_Style); | 53 p.setStyle(SkPaint::kFill_Style); |
54 p.setShader(fBG); | 54 p.setShader(fBG); |
55 SkRect r = SkRect::MakeWH(w, h); | 55 SkRect r = SkRect::MakeWH(w, h); |
56 canvas->drawRect(r, p); | 56 canvas->drawRect(r, p); |
57 | 57 |
58 canvas->saveLayer(&r, NULL); | 58 canvas->saveLayer(&r, nullptr); |
59 | 59 |
60 p.setShader(fDst); | 60 p.setShader(fDst); |
61 canvas->drawRect(r, p); | 61 canvas->drawRect(r, p); |
62 p.setShader(fSrc); | 62 p.setShader(fSrc); |
63 p.setXfermode(xm); | 63 p.setXfermode(xm); |
64 canvas->drawRect(r, p); | 64 canvas->drawRect(r, p); |
65 | 65 |
66 canvas->restore(); | 66 canvas->restore(); |
67 | 67 |
68 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); | 68 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); |
69 p.setStyle(SkPaint::kStroke_Style); | 69 p.setStyle(SkPaint::kStroke_Style); |
70 p.setShader(NULL); | 70 p.setShader(nullptr); |
71 p.setXfermode(NULL); | 71 p.setXfermode(nullptr); |
72 canvas->drawRect(r, p); | 72 canvas->drawRect(r, p); |
73 | 73 |
74 canvas->restore(); | 74 canvas->restore(); |
75 | 75 |
76 #if 1 | 76 #if 1 |
77 canvas->drawText(SkXfermode::ModeName(mode), strlen(SkXfermode::Mode
Name(mode)), | 77 canvas->drawText(SkXfermode::ModeName(mode), strlen(SkXfermode::Mode
Name(mode)), |
78 x + w/2, y - labelP.getTextSize()/2, labelP); | 78 x + w/2, y - labelP.getTextSize()/2, labelP); |
79 #endif | 79 #endif |
80 x += w + SkIntToScalar(10); | 80 x += w + SkIntToScalar(10); |
81 if ((m % W) == W - 1) { | 81 if ((m % W) == W - 1) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 typedef GM INHERITED; | 146 typedef GM INHERITED; |
147 }; | 147 }; |
148 | 148 |
149 ////////////////////////////////////////////////////////////////////////////// | 149 ////////////////////////////////////////////////////////////////////////////// |
150 | 150 |
151 static GM* MyFactory(void*) { return new Xfermodes2GM; } | 151 static GM* MyFactory(void*) { return new Xfermodes2GM; } |
152 static GMRegistry reg(MyFactory); | 152 static GMRegistry reg(MyFactory); |
153 | 153 |
154 } | 154 } |
OLD | NEW |