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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 sk_sp<SkShader> shaders[gradCount + bmpCount]; | 126 sk_sp<SkShader> shaders[gradCount + bmpCount]; |
127 | 127 |
128 int shdIdx = 0; | 128 int shdIdx = 0; |
129 for (size_t d = 0; d < SK_ARRAY_COUNT(gGradData); ++d) { | 129 for (size_t d = 0; d < SK_ARRAY_COUNT(gGradData); ++d) { |
130 for (size_t m = 0; m < SK_ARRAY_COUNT(gGradMakers); ++m) { | 130 for (size_t m = 0; m < SK_ARRAY_COUNT(gGradMakers); ++m) { |
131 shaders[shdIdx++] = gGradMakers[m](pts, | 131 shaders[shdIdx++] = gGradMakers[m](pts, |
132 gGradData[d], | 132 gGradData[d], |
133 SkShader::kClamp_TileMode); | 133 SkShader::kClamp_TileMode); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 SkBitmap bm; | 137 SkBitmap bm; |
138 makebm(&bm, w/16, h/4); | 138 makebm(&bm, w/16, h/4); |
139 for (size_t tx = 0; tx < SK_ARRAY_COUNT(tileModes); ++tx) { | 139 for (size_t tx = 0; tx < SK_ARRAY_COUNT(tileModes); ++tx) { |
140 for (size_t ty = 0; ty < SK_ARRAY_COUNT(tileModes); ++ty) { | 140 for (size_t ty = 0; ty < SK_ARRAY_COUNT(tileModes); ++ty) { |
141 shaders[shdIdx++] = SkShader::MakeBitmapShader(bm, tileModes[tx]
, tileModes[ty]); | 141 shaders[shdIdx++] = SkShader::MakeBitmapShader(bm, tileModes[tx]
, tileModes[ty]); |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 SkPaint paint; | 145 SkPaint paint; |
146 paint.setDither(true); | 146 paint.setDither(true); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 private: | 184 private: |
185 typedef GM INHERITED; | 185 typedef GM INHERITED; |
186 }; | 186 }; |
187 | 187 |
188 /////////////////////////////////////////////////////////////////////////////// | 188 /////////////////////////////////////////////////////////////////////////////// |
189 | 189 |
190 static GM* MyFactory(void*) { return new ShaderTextGM; } | 190 static GM* MyFactory(void*) { return new ShaderTextGM; } |
191 static GMRegistry reg(MyFactory); | 191 static GMRegistry reg(MyFactory); |
192 } | 192 } |
OLD | NEW |