OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkScalerContext.h" | 10 #include "SkScalerContext.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID, | 140 SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID, |
141 fRec.fOrigFontID, | 141 fRec.fOrigFontID, |
142 fPaintOptionsAndroid); | 142 fPaintOptionsAndroid); |
143 if (0 == newFace) { | 143 if (0 == newFace) { |
144 return NULL; | 144 return NULL; |
145 } | 145 } |
146 | 146 |
147 SkAutoTUnref<SkTypeface> aur(newFace); | 147 SkAutoTUnref<SkTypeface> aur(newFace); |
148 uint32_t newFontID = newFace->uniqueID(); | 148 uint32_t newFontID = newFace->uniqueID(); |
149 | 149 |
150 SkOrderedWriteBuffer androidBuffer(128); | 150 SkOrderedWriteBuffer androidBuffer; |
151 fPaintOptionsAndroid.flatten(androidBuffer); | 151 fPaintOptionsAndroid.flatten(androidBuffer); |
152 | 152 |
153 SkAutoDescriptor ad(sizeof(fRec) + androidBuffer.size() + SkDescriptor::C
omputeOverhead(2)); | 153 SkAutoDescriptor ad(sizeof(fRec) + androidBuffer.size() + SkDescriptor::C
omputeOverhead(2)); |
154 SkDescriptor* desc = ad.getDesc(); | 154 SkDescriptor* desc = ad.getDesc(); |
155 | 155 |
156 desc->init(); | 156 desc->init(); |
157 SkScalerContext::Rec* newRec = | 157 SkScalerContext::Rec* newRec = |
158 (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag, | 158 (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag, |
159 sizeof(fRec), &fRec); | 159 sizeof(fRec), &fRec); |
160 androidBuffer.writeToMemory(desc->addEntry(kAndroidOpts_SkDescriptorTag, | 160 androidBuffer.writeToMemory(desc->addEntry(kAndroidOpts_SkDescriptorTag, |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 980 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
981 bool allowFailure) const { | 981 bool allowFailure) const { |
982 SkScalerContext* c = this->onCreateScalerContext(desc); | 982 SkScalerContext* c = this->onCreateScalerContext(desc); |
983 | 983 |
984 if (!c && !allowFailure) { | 984 if (!c && !allowFailure) { |
985 c = SkNEW_ARGS(SkScalerContext_Empty, | 985 c = SkNEW_ARGS(SkScalerContext_Empty, |
986 (const_cast<SkTypeface*>(this), desc)); | 986 (const_cast<SkTypeface*>(this), desc)); |
987 } | 987 } |
988 return c; | 988 return c; |
989 } | 989 } |
OLD | NEW |