| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "Resources.h" | 10 #include "Resources.h" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkStream.h" | 12 #include "SkStream.h" |
| 13 #include "SkTypeface.h" | 13 #include "SkTypeface.h" |
| 14 | 14 |
| 15 namespace skiagm { | 15 namespace skiagm { |
| 16 | 16 |
| 17 class ColorEmojiGM : public GM { | 17 class ColorEmojiGM : public GM { |
| 18 public: | 18 public: |
| 19 ColorEmojiGM() { | 19 ColorEmojiGM() { |
| 20 fTypeface = NULL; | 20 fTypeface = NULL; |
| 21 } | 21 } |
| 22 | 22 |
| 23 ~ColorEmojiGM() { | 23 ~ColorEmojiGM() { |
| 24 SkSafeUnref(fTypeface); | 24 SkSafeUnref(fTypeface); |
| 25 } | 25 } |
| 26 protected: | 26 protected: |
| 27 virtual uint32_t onGetFlags() const SK_OVERRIDE { | |
| 28 return kSkipTiled_Flag; | |
| 29 } | |
| 30 | |
| 31 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 27 virtual void onOnceBeforeDraw() SK_OVERRIDE { |
| 32 SkString filename = GetResourcePath("/Funkster.ttf"); | 28 SkString filename = GetResourcePath("/Funkster.ttf"); |
| 33 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename.c_str())); | 29 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename.c_str())); |
| 34 if (!stream->isValid()) { | 30 if (!stream->isValid()) { |
| 35 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor
rectly.\n"); | 31 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor
rectly.\n"); |
| 36 return; | 32 return; |
| 37 } | 33 } |
| 38 | 34 |
| 39 fTypeface = SkTypeface::CreateFromStream(stream); | 35 fTypeface = SkTypeface::CreateFromStream(stream); |
| 40 } | 36 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 105 |
| 110 typedef GM INHERITED; | 106 typedef GM INHERITED; |
| 111 }; | 107 }; |
| 112 | 108 |
| 113 ////////////////////////////////////////////////////////////////////////////// | 109 ////////////////////////////////////////////////////////////////////////////// |
| 114 | 110 |
| 115 static GM* MyFactory(void*) { return new ColorEmojiGM; } | 111 static GM* MyFactory(void*) { return new ColorEmojiGM; } |
| 116 static GMRegistry reg(MyFactory); | 112 static GMRegistry reg(MyFactory); |
| 117 | 113 |
| 118 } | 114 } |
| OLD | NEW |