OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 SkTDArray<SkScalar> pos; | 163 SkTDArray<SkScalar> pos; |
164 for (unsigned i = 0; i < count; ++i) { | 164 for (unsigned i = 0; i < count; ++i) { |
165 *pos.append() = offset.x() + i * advanceX; | 165 *pos.append() = offset.x() + i * advanceX; |
166 *pos.append() = offset.y() + i * (advanceY / count); | 166 *pos.append() = offset.y() + i * (advanceY / count); |
167 } | 167 } |
168 | 168 |
169 memcpy(buf.glyphs, fGlyphs.begin() + currentGlyph, count * s
izeof(uint16_t)); | 169 memcpy(buf.glyphs, fGlyphs.begin() + currentGlyph, count * s
izeof(uint16_t)); |
170 memcpy(buf.pos, pos.begin(), count * sizeof(SkScalar) * 2); | 170 memcpy(buf.pos, pos.begin(), count * sizeof(SkScalar) * 2); |
171 } break; | 171 } break; |
172 default: | 172 default: |
173 SK_ABORT("unhandled pos value"); | 173 SkFAIL("unhandled pos value"); |
174 } | 174 } |
175 | 175 |
176 currentGlyph += count; | 176 currentGlyph += count; |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 return builder.build(); | 180 return builder.build(); |
181 } | 181 } |
182 | 182 |
183 SkTDArray<uint16_t> fGlyphs; | 183 SkTDArray<uint16_t> fGlyphs; |
184 SkAutoTUnref<SkTypeface> fTypeface; | 184 SkAutoTUnref<SkTypeface> fTypeface; |
185 const char* fText; | 185 const char* fText; |
186 typedef skiagm::GM INHERITED; | 186 typedef skiagm::GM INHERITED; |
187 }; | 187 }; |
188 | 188 |
189 DEF_GM(return new TextBlobGM("hamburgefons");) | 189 DEF_GM(return new TextBlobGM("hamburgefons");) |
OLD | NEW |