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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // path | 433 // path |
434 canvas->translate(SkIntToScalar(50), 0); | 434 canvas->translate(SkIntToScalar(50), 0); |
435 paint.setColor(SK_ColorRED); | 435 paint.setColor(SK_ColorRED); |
436 paint.setStyle(SkPaint::kStroke_Style); | 436 paint.setStyle(SkPaint::kStroke_Style); |
437 paint.setStrokeWidth(SkIntToScalar(5)); | 437 paint.setStrokeWidth(SkIntToScalar(5)); |
438 paint.setShader(radial)->unref(); | 438 paint.setShader(radial)->unref(); |
439 paint.setMaskFilter(nullptr); | 439 paint.setMaskFilter(nullptr); |
440 canvas->drawPath(path, paint); | 440 canvas->drawPath(path, paint); |
441 | 441 |
442 paint.setShader(nullptr); | 442 paint.setShader(nullptr); |
443 // bitmap | 443 // bitmap, sprite |
444 canvas->translate(SkIntToScalar(50), 0); | 444 canvas->translate(SkIntToScalar(50), 0); |
445 paint.setStyle(SkPaint::kFill_Style); | 445 paint.setStyle(SkPaint::kFill_Style); |
446 canvas->drawBitmap(fBug, left, top, &paint); | 446 canvas->drawBitmap(fBug, left, top, &paint); |
| 447 canvas->translate(SkIntToScalar(30), 0); |
| 448 canvas->drawSprite(fTb, |
| 449 SkScalarRoundToInt(canvas->getTotalMatrix().getTranslateX()), |
| 450 spriteOffset + 10, &paint); |
447 | 451 |
448 canvas->translate(-SkIntToScalar(30), SkIntToScalar(30)); | 452 canvas->translate(-SkIntToScalar(30), SkIntToScalar(30)); |
449 paint.setShader(shaderTest())->unref(); // test compose shader | 453 paint.setShader(shaderTest())->unref(); // test compose shader |
450 canvas->drawRect(rect2, paint); | 454 canvas->drawRect(rect2, paint); |
451 paint.setShader(nullptr); | 455 paint.setShader(nullptr); |
452 | 456 |
453 canvas->restore(); | 457 canvas->restore(); |
454 // text | 458 // text |
455 canvas->translate(0, SkIntToScalar(60)); | 459 canvas->translate(0, SkIntToScalar(60)); |
456 canvas->save(); | 460 canvas->save(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 private: | 575 private: |
572 SkPoint fClickPt; | 576 SkPoint fClickPt; |
573 SkBitmap fBug, fTb, fTx; | 577 SkBitmap fBug, fTb, fTx; |
574 typedef SampleView INHERITED; | 578 typedef SampleView INHERITED; |
575 }; | 579 }; |
576 | 580 |
577 ////////////////////////////////////////////////////////////////////////////// | 581 ////////////////////////////////////////////////////////////////////////////// |
578 | 582 |
579 static SkView* MyFactory() { return new DemoView; } | 583 static SkView* MyFactory() { return new DemoView; } |
580 static SkViewRegister reg(MyFactory); | 584 static SkViewRegister reg(MyFactory); |
OLD | NEW |