| 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual ~FontCacheGM() { | 43 virtual ~FontCacheGM() { |
| 44 for (size_t i = 0; i < TYPEFACE_COUNT; ++i) { | 44 for (size_t i = 0; i < TYPEFACE_COUNT; ++i) { |
| 45 SkSafeUnref(fTypefaces[i]); | 45 SkSafeUnref(fTypefaces[i]); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual SkString onShortName() SK_OVERRIDE { | 50 virtual SkString onShortName() SK_OVERRIDE { |
| 51 return fName; | 51 return SkString("fontcache"); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual SkISize onISize() SK_OVERRIDE { | 54 virtual SkISize onISize() SK_OVERRIDE { |
| 55 return SkISize::Make(640, 320); | 55 return SkISize::Make(640, 320); |
| 56 } | 56 } |
| 57 | 57 |
| 58 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 58 virtual void onOnceBeforeDraw() SK_OVERRIDE { |
| 59 int typefaceCount = 0; | 59 int typefaceCount = 0; |
| 60 for (size_t i = 0; i < SK_ARRAY_COUNT(gFamilyNames); ++i) { | 60 for (size_t i = 0; i < SK_ARRAY_COUNT(gFamilyNames); ++i) { |
| 61 for (size_t j = 0; j < SK_ARRAY_COUNT(gStyles); ++j) { | 61 for (size_t j = 0; j < SK_ARRAY_COUNT(gStyles); ++j) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 } | 104 } |
| 105 | 105 |
| 106 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 106 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 107 // this GM is meant only for the GPU | 107 // this GM is meant only for the GPU |
| 108 return kGPUOnly_Flag; | 108 return kGPUOnly_Flag; |
| 109 } | 109 } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 SkTypeface* fTypefaces[TYPEFACE_COUNT]; | 112 SkTypeface* fTypefaces[TYPEFACE_COUNT]; |
| 113 SkString fName; | |
| 114 typedef GM INHERITED; | 113 typedef GM INHERITED; |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 | 116 |
| 118 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
| 119 | 118 |
| 120 DEF_GM( return SkNEW(FontCacheGM); ) | 119 DEF_GM( return SkNEW(FontCacheGM); ) |
| 121 | 120 |
| OLD | NEW |