| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); | 248 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); |
| 249 SkAutoUnref aur(mode); | 249 SkAutoUnref aur(mode); |
| 250 SkRect r; | 250 SkRect r; |
| 251 r.set(x, y, x+w, y+h); | 251 r.set(x, y, x+w, y+h); |
| 252 | 252 |
| 253 SkPaint p; | 253 SkPaint p; |
| 254 p.setStyle(SkPaint::kFill_Style); | 254 p.setStyle(SkPaint::kFill_Style); |
| 255 p.setShader(s); | 255 p.setShader(s); |
| 256 canvas->drawRect(r, p); | 256 canvas->drawRect(r, p); |
| 257 | 257 |
| 258 canvas->saveLayer(&r, NULL); | 258 canvas->saveLayer(&r, nullptr); |
| 259 draw_mode(canvas, mode, static_cast<SrcType>(sourceType), | 259 draw_mode(canvas, mode, static_cast<SrcType>(sourceType), |
| 260 r.fLeft, r.fTop); | 260 r.fLeft, r.fTop); |
| 261 canvas->restore(); | 261 canvas->restore(); |
| 262 | 262 |
| 263 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); | 263 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); |
| 264 p.setStyle(SkPaint::kStroke_Style); | 264 p.setStyle(SkPaint::kStroke_Style); |
| 265 p.setShader(NULL); | 265 p.setShader(nullptr); |
| 266 canvas->drawRect(r, p); | 266 canvas->drawRect(r, p); |
| 267 | 267 |
| 268 #if 1 | 268 #if 1 |
| 269 canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel), | 269 canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel), |
| 270 x + w/2, y - labelP.getTextSize()/2, labelP); | 270 x + w/2, y - labelP.getTextSize()/2, labelP); |
| 271 #endif | 271 #endif |
| 272 x += w + SkIntToScalar(10); | 272 x += w + SkIntToScalar(10); |
| 273 if ((i % W) == W - 1) { | 273 if ((i % W) == W - 1) { |
| 274 x = x0; | 274 x = x0; |
| 275 y += h + SkIntToScalar(30); | 275 y += h + SkIntToScalar(30); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 291 private: | 291 private: |
| 292 typedef GM INHERITED; | 292 typedef GM INHERITED; |
| 293 }; | 293 }; |
| 294 | 294 |
| 295 ////////////////////////////////////////////////////////////////////////////// | 295 ////////////////////////////////////////////////////////////////////////////// |
| 296 | 296 |
| 297 static GM* MyFactory(void*) { return new XfermodesGM; } | 297 static GM* MyFactory(void*) { return new XfermodesGM; } |
| 298 static GMRegistry reg(MyFactory); | 298 static GMRegistry reg(MyFactory); |
| 299 | 299 |
| 300 } | 300 } |
| OLD | NEW |