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 "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 bm.lockPixels(); | 21 bm.lockPixels(); |
22 *bm.getAddr32(0, 0) = SkPreMultiplyARGB(0xFF, SkColorGetR(c), | 22 *bm.getAddr32(0, 0) = SkPreMultiplyARGB(0xFF, SkColorGetR(c), |
23 SkColorGetG(c), SkColorGetB(c)); | 23 SkColorGetG(c), SkColorGetB(c)); |
24 *bm.getAddr32(1, 0) = 0; | 24 *bm.getAddr32(1, 0) = 0; |
25 bm.unlockPixels(); | 25 bm.unlockPixels(); |
26 | 26 |
27 SkMatrix matrix; | 27 SkMatrix matrix; |
28 matrix.setScale(SkIntToScalar(width), SK_Scalar1); | 28 matrix.setScale(SkIntToScalar(width), SK_Scalar1); |
29 | 29 |
30 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, | 30 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, |
31 SkShader::kClamp_TileMode); | 31 SkShader::kClamp_TileMode, &matri
x); |
32 s->setLocalMatrix(matrix); | |
33 | 32 |
34 paint->setShader(s)->unref(); | 33 paint->setShader(s)->unref(); |
35 } | 34 } |
36 | 35 |
37 class DashView : public SampleView { | 36 class DashView : public SampleView { |
38 public: | 37 public: |
39 DashView() { | 38 DashView() { |
40 this->setBGColor(0xFFDDDDDD); | 39 this->setBGColor(0xFFDDDDDD); |
41 } | 40 } |
42 | 41 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 83 } |
85 | 84 |
86 private: | 85 private: |
87 typedef SampleView INHERITED; | 86 typedef SampleView INHERITED; |
88 }; | 87 }; |
89 | 88 |
90 ////////////////////////////////////////////////////////////////////////////// | 89 ////////////////////////////////////////////////////////////////////////////// |
91 | 90 |
92 static SkView* MyFactory() { return new DashView; } | 91 static SkView* MyFactory() { return new DashView; } |
93 static SkViewRegister reg(MyFactory); | 92 static SkViewRegister reg(MyFactory); |
OLD | NEW |