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 "SkAdvancedTypefaceMetrics.h" | 8 #include "SkAdvancedTypefaceMetrics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 { | 28 { |
29 init(fontData.fPoints, fontData.fVerbs); | 29 init(fontData.fPoints, fontData.fVerbs); |
30 #ifdef SK_DEBUG | 30 #ifdef SK_DEBUG |
31 sk_bzero(fDebugBits, sizeof(fDebugBits)); | 31 sk_bzero(fDebugBits, sizeof(fDebugBits)); |
32 sk_bzero(fDebugOverage, sizeof(fDebugOverage)); | 32 sk_bzero(fDebugOverage, sizeof(fDebugOverage)); |
33 #endif | 33 #endif |
34 } | 34 } |
35 | 35 |
36 SkTestFont::~SkTestFont() { | 36 SkTestFont::~SkTestFont() { |
37 for (unsigned index = 0; index < fCharCodesCount; ++index) { | 37 for (unsigned index = 0; index < fCharCodesCount; ++index) { |
38 SkDELETE(fPaths[index]); | 38 delete fPaths[index]; |
39 } | 39 } |
40 SkDELETE_ARRAY(fPaths); | 40 delete[] fPaths; |
41 } | 41 } |
42 | 42 |
43 #ifdef SK_DEBUG | 43 #ifdef SK_DEBUG |
44 | 44 |
45 #include "SkMutex.h" | 45 #include "SkMutex.h" |
46 SK_DECLARE_STATIC_MUTEX(gUsedCharsMutex); | 46 SK_DECLARE_STATIC_MUTEX(gUsedCharsMutex); |
47 | 47 |
48 #endif | 48 #endif |
49 | 49 |
50 int SkTestFont::codeToIndex(SkUnichar charCode) const { | 50 int SkTestFont::codeToIndex(SkUnichar charCode) const { |
(...skipping 20 matching lines...) Expand all Loading... |
71 if (fCharCodes[index] == (unsigned) charCode) { | 71 if (fCharCodes[index] == (unsigned) charCode) { |
72 return (int) index; | 72 return (int) index; |
73 } | 73 } |
74 } | 74 } |
75 SkDEBUGF(("missing '%c' (%d) from %s %d\n", (char) charCode, charCode, | 75 SkDEBUGF(("missing '%c' (%d) from %s %d\n", (char) charCode, charCode, |
76 fDebugName, fDebugStyle)); | 76 fDebugName, fDebugStyle)); |
77 return 0; | 77 return 0; |
78 } | 78 } |
79 | 79 |
80 void SkTestFont::init(const SkScalar* pts, const unsigned char* verbs) { | 80 void SkTestFont::init(const SkScalar* pts, const unsigned char* verbs) { |
81 fPaths = SkNEW_ARRAY(SkPath*, fCharCodesCount); | 81 fPaths = new SkPath* [fCharCodesCount]; |
82 for (unsigned index = 0; index < fCharCodesCount; ++index) { | 82 for (unsigned index = 0; index < fCharCodesCount; ++index) { |
83 SkPath* path = SkNEW(SkPath); | 83 SkPath* path = new SkPath; |
84 SkPath::Verb verb; | 84 SkPath::Verb verb; |
85 while ((verb = (SkPath::Verb) *verbs++) != SkPath::kDone_Verb) { | 85 while ((verb = (SkPath::Verb) *verbs++) != SkPath::kDone_Verb) { |
86 switch (verb) { | 86 switch (verb) { |
87 case SkPath::kMove_Verb: | 87 case SkPath::kMove_Verb: |
88 path->moveTo(pts[0], pts[1]); | 88 path->moveTo(pts[0], pts[1]); |
89 pts += 2; | 89 pts += 2; |
90 break; | 90 break; |
91 case SkPath::kLine_Verb: | 91 case SkPath::kLine_Verb: |
92 path->lineTo(pts[0], pts[1]); | 92 path->lineTo(pts[0], pts[1]); |
93 pts += 2; | 93 pts += 2; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale); | 273 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale); |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 private: | 277 private: |
278 SkTestTypeface* fFace; | 278 SkTestTypeface* fFace; |
279 SkMatrix fMatrix; | 279 SkMatrix fMatrix; |
280 }; | 280 }; |
281 | 281 |
282 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { | 282 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { |
283 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d
esc)); | 283 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), desc); |
284 } | 284 } |
OLD | NEW |