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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 SkScalar y = SkScalarSin(SkIntToScalar(angle) * (SK_ScalarPI * 2) / 24)
* gHeight; | 53 SkScalar y = SkScalarSin(SkIntToScalar(angle) * (SK_ScalarPI * 2) / 24)
* gHeight; |
54 paint.setStrokeWidth(SK_Scalar1 * angle * 2 / 24); | 54 paint.setStrokeWidth(SK_Scalar1 * angle * 2 / 24); |
55 canvas->drawLine(W/2, H/2, W/2 + x, H/2 + y, paint); | 55 canvas->drawLine(W/2, H/2, W/2 + x, H/2 + y, paint); |
56 } | 56 } |
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.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); | 63 bm.allocN32Pixels(2, 2); |
64 bm.allocPixels(); | |
65 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; | 64 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; |
66 *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); |
67 | 66 |
68 SkShader* s = SkShader::CreateBitmapShader(bm, | 67 SkShader* s = SkShader::CreateBitmapShader(bm, |
69 SkShader::kRepeat_TileMode, | 68 SkShader::kRepeat_TileMode, |
70 SkShader::kRepeat_TileMode); | 69 SkShader::kRepeat_TileMode); |
71 | 70 |
72 SkMatrix m; | 71 SkMatrix m; |
73 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); | 72 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); |
74 s->setLocalMatrix(m); | 73 s->setLocalMatrix(m); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 private: | 130 private: |
132 typedef GM INHERITED; | 131 typedef GM INHERITED; |
133 }; | 132 }; |
134 | 133 |
135 ////////////////////////////////////////////////////////////////////////////
// | 134 ////////////////////////////////////////////////////////////////////////////
// |
136 | 135 |
137 static GM* MyFactory(void*) { return new HairModesGM; } | 136 static GM* MyFactory(void*) { return new HairModesGM; } |
138 static GMRegistry reg(MyFactory); | 137 static GMRegistry reg(MyFactory); |
139 | 138 |
140 } | 139 } |
OLD | NEW |