OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 return H; | 58 return H; |
59 } | 59 } |
60 | 60 |
61 static SkShader* make_bg_shader() { | 61 static SkShader* make_bg_shader() { |
62 SkBitmap bm; | 62 SkBitmap bm; |
63 bm.allocN32Pixels(2, 2); | 63 bm.allocN32Pixels(2, 2); |
64 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; | 64 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; |
65 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 0xCC, 0
xCC); | 65 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 0xCC, 0
xCC); |
66 | 66 |
67 SkShader* s = SkShader::CreateBitmapShader(bm, | |
68 SkShader::kRepeat_TileMode, | |
69 SkShader::kRepeat_TileMode); | |
70 | |
71 SkMatrix m; | 67 SkMatrix m; |
72 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); | 68 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); |
73 s->setLocalMatrix(m); | 69 return SkShader::CreateBitmapShader(bm, |
74 return s; | 70 SkShader::kRepeat_TileMode, |
| 71 SkShader::kRepeat_TileMode, |
| 72 &m); |
75 } | 73 } |
76 | 74 |
77 namespace skiagm { | 75 namespace skiagm { |
78 | 76 |
79 class HairModesGM : public GM { | 77 class HairModesGM : public GM { |
80 SkPaint fBGPaint; | 78 SkPaint fBGPaint; |
81 | 79 |
82 protected: | 80 protected: |
83 | 81 |
84 virtual SkString onShortName() SK_OVERRIDE { | 82 virtual SkString onShortName() SK_OVERRIDE { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 private: | 128 private: |
131 typedef GM INHERITED; | 129 typedef GM INHERITED; |
132 }; | 130 }; |
133 | 131 |
134 ////////////////////////////////////////////////////////////////////////////
// | 132 ////////////////////////////////////////////////////////////////////////////
// |
135 | 133 |
136 static GM* MyFactory(void*) { return new HairModesGM; } | 134 static GM* MyFactory(void*) { return new HairModesGM; } |
137 static GMRegistry reg(MyFactory); | 135 static GMRegistry reg(MyFactory); |
138 | 136 |
139 } | 137 } |
OLD | NEW |