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 "SkGScalerContext.h" | 8 #include "SkGScalerContext.h" |
9 #include "SkGlyph.h" | 9 #include "SkGlyph.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 SkASSERT(descSize == newDesc->getLength()); | 57 SkASSERT(descSize == newDesc->getLength()); |
58 newDesc->computeChecksum(); | 58 newDesc->computeChecksum(); |
59 | 59 |
60 fProxy = face->proxy()->createScalerContext(newDesc); | 60 fProxy = face->proxy()->createScalerContext(newDesc); |
61 | 61 |
62 fRec.getSingleMatrix(&fMatrix); | 62 fRec.getSingleMatrix(&fMatrix); |
63 fMatrix.preScale(SK_Scalar1 / STD_SIZE, SK_Scalar1 / STD_SIZE); | 63 fMatrix.preScale(SK_Scalar1 / STD_SIZE, SK_Scalar1 / STD_SIZE); |
64 } | 64 } |
65 | 65 |
66 SkGScalerContext::~SkGScalerContext() { | 66 SkGScalerContext::~SkGScalerContext() { delete fProxy; } |
67 SkDELETE(fProxy); | |
68 } | |
69 | 67 |
70 unsigned SkGScalerContext::generateGlyphCount() { | 68 unsigned SkGScalerContext::generateGlyphCount() { |
71 return fProxy->getGlyphCount(); | 69 return fProxy->getGlyphCount(); |
72 } | 70 } |
73 | 71 |
74 uint16_t SkGScalerContext::generateCharToGlyph(SkUnichar uni) { | 72 uint16_t SkGScalerContext::generateCharToGlyph(SkUnichar uni) { |
75 return fProxy->charToGlyphID(uni); | 73 return fProxy->charToGlyphID(uni); |
76 } | 74 } |
77 | 75 |
78 void SkGScalerContext::generateAdvance(SkGlyph* glyph) { | 76 void SkGScalerContext::generateAdvance(SkGlyph* glyph) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) | 159 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) |
162 , fProxy(SkRef(proxy)) | 160 , fProxy(SkRef(proxy)) |
163 , fPaint(paint) {} | 161 , fPaint(paint) {} |
164 | 162 |
165 SkGTypeface::~SkGTypeface() { | 163 SkGTypeface::~SkGTypeface() { |
166 fProxy->unref(); | 164 fProxy->unref(); |
167 } | 165 } |
168 | 166 |
169 SkScalerContext* SkGTypeface::onCreateScalerContext( | 167 SkScalerContext* SkGTypeface::onCreateScalerContext( |
170 const SkDescriptor* desc) const { | 168 const SkDescriptor* desc) const { |
171 return SkNEW_ARGS(SkGScalerContext, (const_cast<SkGTypeface*>(this), desc)); | 169 return new SkGScalerContext(const_cast<SkGTypeface*>(this), desc); |
172 } | 170 } |
173 | 171 |
174 void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { | 172 void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { |
175 fProxy->filterRec(rec); | 173 fProxy->filterRec(rec); |
176 rec->setHinting(SkPaint::kNo_Hinting); | 174 rec->setHinting(SkPaint::kNo_Hinting); |
177 rec->fMaskFormat = SkMask::kARGB32_Format; | 175 rec->fMaskFormat = SkMask::kARGB32_Format; |
178 } | 176 } |
179 | 177 |
180 SkAdvancedTypefaceMetrics* SkGTypeface::onGetAdvancedTypefaceMetrics( | 178 SkAdvancedTypefaceMetrics* SkGTypeface::onGetAdvancedTypefaceMetrics( |
181 PerGlyphInfo info, | 179 PerGlyphInfo info, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 255 |
258 friend class SkGFontBuilder; | 256 friend class SkGFontBuilder; |
259 SkGFont(int count, Glyph* array); | 257 SkGFont(int count, Glyph* array); |
260 }; | 258 }; |
261 | 259 |
262 class SkGFontBuilder { | 260 class SkGFontBuilder { |
263 public: | 261 public: |
264 | 262 |
265 }; | 263 }; |
266 #endif | 264 #endif |
OLD | NEW |