| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkRandomScalerContext.h" | 8 #include "SkRandomScalerContext.h" |
| 9 #include "SkGlyph.h" | 9 #include "SkGlyph.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "SkDescriptor.h" | 36 #include "SkDescriptor.h" |
| 37 | 37 |
| 38 SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, const SkDes
criptor* desc, | 38 SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, const SkDes
criptor* desc, |
| 39 bool fakeIt) | 39 bool fakeIt) |
| 40 : SkScalerContext(face, desc) | 40 : SkScalerContext(face, desc) |
| 41 , fFace(face) | 41 , fFace(face) |
| 42 , fFakeIt(fakeIt) { | 42 , fFakeIt(fakeIt) { |
| 43 fProxy = face->proxy()->createScalerContext(desc); | 43 fProxy = face->proxy()->createScalerContext(desc); |
| 44 } | 44 } |
| 45 | 45 |
| 46 SkRandomScalerContext::~SkRandomScalerContext() { | 46 SkRandomScalerContext::~SkRandomScalerContext() { delete fProxy; } |
| 47 SkDELETE(fProxy); | |
| 48 } | |
| 49 | 47 |
| 50 unsigned SkRandomScalerContext::generateGlyphCount() { | 48 unsigned SkRandomScalerContext::generateGlyphCount() { |
| 51 return fProxy->getGlyphCount(); | 49 return fProxy->getGlyphCount(); |
| 52 } | 50 } |
| 53 | 51 |
| 54 uint16_t SkRandomScalerContext::generateCharToGlyph(SkUnichar uni) { | 52 uint16_t SkRandomScalerContext::generateCharToGlyph(SkUnichar uni) { |
| 55 return fProxy->charToGlyphID(uni); | 53 return fProxy->charToGlyphID(uni); |
| 56 } | 54 } |
| 57 | 55 |
| 58 void SkRandomScalerContext::generateAdvance(SkGlyph* glyph) { | 56 void SkRandomScalerContext::generateAdvance(SkGlyph* glyph) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 , fProxy(SkRef(proxy)) | 192 , fProxy(SkRef(proxy)) |
| 195 , fPaint(paint) | 193 , fPaint(paint) |
| 196 , fFakeIt(fakeIt) {} | 194 , fFakeIt(fakeIt) {} |
| 197 | 195 |
| 198 SkRandomTypeface::~SkRandomTypeface() { | 196 SkRandomTypeface::~SkRandomTypeface() { |
| 199 fProxy->unref(); | 197 fProxy->unref(); |
| 200 } | 198 } |
| 201 | 199 |
| 202 SkScalerContext* SkRandomTypeface::onCreateScalerContext( | 200 SkScalerContext* SkRandomTypeface::onCreateScalerContext( |
| 203 const SkDescriptor* desc) const { | 201 const SkDescriptor* desc) const { |
| 204 return SkNEW_ARGS(SkRandomScalerContext, (const_cast<SkRandomTypeface*>(this
), desc, fFakeIt)); | 202 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), desc,
fFakeIt); |
| 205 } | 203 } |
| 206 | 204 |
| 207 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { | 205 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { |
| 208 fProxy->filterRec(rec); | 206 fProxy->filterRec(rec); |
| 209 rec->setHinting(SkPaint::kNo_Hinting); | 207 rec->setHinting(SkPaint::kNo_Hinting); |
| 210 rec->fMaskFormat = SkMask::kARGB32_Format; | 208 rec->fMaskFormat = SkMask::kARGB32_Format; |
| 211 } | 209 } |
| 212 | 210 |
| 213 SkAdvancedTypefaceMetrics* SkRandomTypeface::onGetAdvancedTypefaceMetrics( | 211 SkAdvancedTypefaceMetrics* SkRandomTypeface::onGetAdvancedTypefaceMetrics( |
| 214 PerGlyphInfo info, | 212 PerGlyphInfo info, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 247 |
| 250 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const { | 248 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const { |
| 251 return fProxy->getTableTags(tags); | 249 return fProxy->getTableTags(tags); |
| 252 } | 250 } |
| 253 | 251 |
| 254 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset, | 252 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset, |
| 255 size_t length, void* data) const { | 253 size_t length, void* data) const { |
| 256 return fProxy->getTableData(tag, offset, length, data); | 254 return fProxy->getTableData(tag, offset, length, data); |
| 257 } | 255 } |
| 258 | 256 |
| OLD | NEW |