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, sprite | 443 // bitmap |
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); | |
451 | 447 |
452 canvas->translate(-SkIntToScalar(30), SkIntToScalar(30)); | 448 canvas->translate(-SkIntToScalar(30), SkIntToScalar(30)); |
453 paint.setShader(shaderTest())->unref(); // test compose shader | 449 paint.setShader(shaderTest())->unref(); // test compose shader |
454 canvas->drawRect(rect2, paint); | 450 canvas->drawRect(rect2, paint); |
455 paint.setShader(nullptr); | 451 paint.setShader(nullptr); |
456 | 452 |
457 canvas->restore(); | 453 canvas->restore(); |
458 // text | 454 // text |
459 canvas->translate(0, SkIntToScalar(60)); | 455 canvas->translate(0, SkIntToScalar(60)); |
460 canvas->save(); | 456 canvas->save(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 private: | 571 private: |
576 SkPoint fClickPt; | 572 SkPoint fClickPt; |
577 SkBitmap fBug, fTb, fTx; | 573 SkBitmap fBug, fTb, fTx; |
578 typedef SampleView INHERITED; | 574 typedef SampleView INHERITED; |
579 }; | 575 }; |
580 | 576 |
581 ////////////////////////////////////////////////////////////////////////////// | 577 ////////////////////////////////////////////////////////////////////////////// |
582 | 578 |
583 static SkView* MyFactory() { return new DemoView; } | 579 static SkView* MyFactory() { return new DemoView; } |
584 static SkViewRegister reg(MyFactory); | 580 static SkViewRegister reg(MyFactory); |
OLD | NEW |