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 "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 void init() { | 680 void init() { |
681 if (fOnce) { | 681 if (fOnce) { |
682 return; | 682 return; |
683 } | 683 } |
684 fOnce = true; | 684 fOnce = true; |
685 | 685 |
686 fIndex = 0; | 686 fIndex = 0; |
687 | 687 |
688 SkBitmap bm; | 688 SkBitmap bm; |
689 bm.setConfig(SkBitmap::kARGB_8888_Config, 1024, 768); | 689 bm.allocN32Pixels(1024, 768); |
690 bm.allocPixels(); | |
691 SkCanvas canvas(bm); | 690 SkCanvas canvas(bm); |
692 SkScalar s = SkIntToScalar(1024) / 640; | 691 SkScalar s = SkIntToScalar(1024) / 640; |
693 canvas.scale(s, s); | 692 canvas.scale(s, s); |
694 for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); i++) { | 693 for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); i++) { |
695 canvas.save(); | 694 canvas.save(); |
696 canvas.drawColor(BG_COLOR); | 695 canvas.drawColor(BG_COLOR); |
697 gProc[i](&canvas); | 696 gProc[i](&canvas); |
698 canvas.restore(); | 697 canvas.restore(); |
699 SkString str; | 698 SkString str; |
700 str.printf("/skimages/slide_" SK_SIZE_T_SPECIFIER ".png", i); | 699 str.printf("/skimages/slide_" SK_SIZE_T_SPECIFIER ".png", i); |
(...skipping 25 matching lines...) Expand all Loading... |
726 } | 725 } |
727 | 726 |
728 private: | 727 private: |
729 typedef SampleView INHERITED; | 728 typedef SampleView INHERITED; |
730 }; | 729 }; |
731 | 730 |
732 ////////////////////////////////////////////////////////////////////////////// | 731 ////////////////////////////////////////////////////////////////////////////// |
733 | 732 |
734 static SkView* MyFactory() { return new SlideView; } | 733 static SkView* MyFactory() { return new SlideView; } |
735 static SkViewRegister reg(MyFactory); | 734 static SkViewRegister reg(MyFactory); |
OLD | NEW |