OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 sk_tool_utils::set_portable_typeface(paint); | 209 sk_tool_utils::set_portable_typeface(paint); |
210 } | 210 } |
211 | 211 |
212 virtual const char* text() const { return "Hello, Skia!"; } | 212 virtual const char* text() const { return "Hello, Skia!"; } |
213 }; | 213 }; |
214 | 214 |
215 struct BmpText : public Text { | 215 struct BmpText : public Text { |
216 void setFont(SkPaint* paint) SK_OVERRIDE { | 216 void setFont(SkPaint* paint) SK_OVERRIDE { |
217 if (!fTypeface) { | 217 if (!fTypeface) { |
218 SkString filename = GetResourcePath("/Funkster.ttf"); | 218 SkString filename = GetResourcePath("/Funkster.ttf"); |
219 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename.
c_str())); | 219 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename
.c_str())); |
220 if (!stream->isValid()) { | 220 if (!stream->isValid()) { |
221 SkDebugf("Could not find Funkster.ttf, please set --reso
urcePath " | 221 SkDebugf("Could not find Funkster.ttf, please set --reso
urcePath " |
222 "correctly.\n"); | 222 "correctly.\n"); |
223 return; | 223 return; |
224 } | 224 } |
225 fTypeface.reset(SkTypeface::CreateFromStream(stream)); | 225 fTypeface.reset(SkTypeface::CreateFromStream(stream.detach()
)); |
226 } | 226 } |
227 paint->setTypeface(fTypeface); | 227 paint->setTypeface(fTypeface); |
228 } | 228 } |
229 | 229 |
230 const char* text() const SK_OVERRIDE { return "Hi, Skia!"; } | 230 const char* text() const SK_OVERRIDE { return "Hi, Skia!"; } |
231 | 231 |
232 SkAutoTUnref<SkTypeface> fTypeface; | 232 SkAutoTUnref<SkTypeface> fTypeface; |
233 }; | 233 }; |
234 fPrims.push_back(SkNEW(Rect)); | 234 fPrims.push_back(SkNEW(Rect)); |
235 fPrims.push_back(SkNEW(Circle)); | 235 fPrims.push_back(SkNEW(Circle)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 }; | 301 }; |
302 | 302 |
303 SkTArray<Prim*> fPrims; | 303 SkTArray<Prim*> fPrims; |
304 | 304 |
305 typedef GM INHERITED; | 305 typedef GM INHERITED; |
306 }; | 306 }; |
307 | 307 |
308 DEF_GM( return SkNEW(DCShaderGM); ) | 308 DEF_GM( return SkNEW(DCShaderGM); ) |
309 } | 309 } |
310 #endif | 310 #endif |
OLD | NEW |