OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); | 171 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); |
172 SkAutoUnref aur(mode); | 172 SkAutoUnref aur(mode); |
173 SkRect r; | 173 SkRect r; |
174 r.set(x, y, x+w, y+h); | 174 r.set(x, y, x+w, y+h); |
175 | 175 |
176 SkPaint p; | 176 SkPaint p; |
177 p.setStyle(SkPaint::kFill_Style); | 177 p.setStyle(SkPaint::kFill_Style); |
178 p.setShader(s); | 178 p.setShader(s); |
179 canvas->drawRect(r, p); | 179 canvas->drawRect(r, p); |
180 | 180 |
181 canvas->saveLayer(&r, NULL); | 181 canvas->saveLayer(&r, nullptr); |
182 draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop); | 182 draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop); |
183 canvas->restore(); | 183 canvas->restore(); |
184 | 184 |
185 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); | 185 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); |
186 p.setStyle(SkPaint::kStroke_Style); | 186 p.setStyle(SkPaint::kStroke_Style); |
187 p.setShader(NULL); | 187 p.setShader(nullptr); |
188 canvas->drawRect(r, p); | 188 canvas->drawRect(r, p); |
189 | 189 |
190 canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel), | 190 canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel), |
191 x + w/2, y - labelP.getTextSize()/2, labelP); | 191 x + w/2, y - labelP.getTextSize()/2, labelP); |
192 x += w + SkIntToScalar(10); | 192 x += w + SkIntToScalar(10); |
193 if ((i % W) == W - 1) { | 193 if ((i % W) == W - 1) { |
194 x = x0; | 194 x = x0; |
195 y += h + SkIntToScalar(30); | 195 y += h + SkIntToScalar(30); |
196 } | 196 } |
197 } | 197 } |
198 x0 += SkIntToScalar(400); | 198 x0 += SkIntToScalar(400); |
199 } | 199 } |
200 s->unref(); | 200 s->unref(); |
201 } | 201 } |
202 | 202 |
203 private: | 203 private: |
204 typedef SampleView INHERITED; | 204 typedef SampleView INHERITED; |
205 }; | 205 }; |
206 | 206 |
207 ////////////////////////////////////////////////////////////////////////////// | 207 ////////////////////////////////////////////////////////////////////////////// |
208 | 208 |
209 static SkView* MyFactory() { return new XfermodesBlurView; } | 209 static SkView* MyFactory() { return new XfermodesBlurView; } |
210 static SkViewRegister reg(MyFactory); | 210 static SkViewRegister reg(MyFactory); |
OLD | NEW |