OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 static SkShader* createChecker() { | 38 static SkShader* createChecker() { |
39 // SkColor colors[] = { 0xFFFDFDFD, 0xFFF4F4F4 }; | 39 // SkColor colors[] = { 0xFFFDFDFD, 0xFFF4F4F4 }; |
40 SkColor colors[] = { 0xFFFFFFFF, 0xFFFFFFFF }; | 40 SkColor colors[] = { 0xFFFFFFFF, 0xFFFFFFFF }; |
41 SkBitmap bm; | 41 SkBitmap bm; |
42 bm.allocN32Pixels(2, 2); | 42 bm.allocN32Pixels(2, 2); |
43 bm.lockPixels(); | 43 bm.lockPixels(); |
44 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = SkPreMultiplyColor(colors[0]); | 44 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = SkPreMultiplyColor(colors[0]); |
45 *bm.getAddr32(0, 1) = *bm.getAddr32(1, 0) = SkPreMultiplyColor(colors[1]); | 45 *bm.getAddr32(0, 1) = *bm.getAddr32(1, 0) = SkPreMultiplyColor(colors[1]); |
46 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, | |
47 SkShader::kRepeat_TileMode); | |
48 | |
49 SkMatrix m; | 46 SkMatrix m; |
50 m.setScale(12, 12); | 47 m.setScale(12, 12); |
51 s->setLocalMatrix(m); | 48 return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, |
52 return s; | 49 SkShader::kRepeat_TileMode, &m); |
53 } | 50 } |
54 | 51 |
55 class FatBits { | 52 class FatBits { |
56 public: | 53 public: |
57 FatBits() : fShader(createChecker()) { | 54 FatBits() : fShader(createChecker()) { |
58 fAA = false; | 55 fAA = false; |
59 fStyle = kHair_Style; | 56 fStyle = kHair_Style; |
60 fGrid = true; | 57 fGrid = true; |
61 fShowSkeleton = true; | 58 fShowSkeleton = true; |
62 fUseGPU = false; | 59 fUseGPU = false; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 519 |
523 private: | 520 private: |
524 | 521 |
525 typedef SampleView INHERITED; | 522 typedef SampleView INHERITED; |
526 }; | 523 }; |
527 | 524 |
528 ////////////////////////////////////////////////////////////////////////////// | 525 ////////////////////////////////////////////////////////////////////////////// |
529 | 526 |
530 static SkView* MyFactory() { return new DrawLineView; } | 527 static SkView* MyFactory() { return new DrawLineView; } |
531 static SkViewRegister reg(MyFactory); | 528 static SkViewRegister reg(MyFactory); |
OLD | NEW |