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 "SkDescriptor.h" | 8 #include "SkDescriptor.h" |
9 #include "SkGScalerContext.h" | 9 #include "SkGScalerContext.h" |
10 #include "SkGlyph.h" | 10 #include "SkGlyph.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 metrics->fXMin = SkScalarMul(metrics->fXMin, scale); | 144 metrics->fXMin = SkScalarMul(metrics->fXMin, scale); |
145 metrics->fXMax = SkScalarMul(metrics->fXMax, scale); | 145 metrics->fXMax = SkScalarMul(metrics->fXMax, scale); |
146 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale); | 146 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale); |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 /////////////////////////////////////////////////////////////////////////////// | 150 /////////////////////////////////////////////////////////////////////////////// |
151 | 151 |
152 #include "SkTypefaceCache.h" | 152 #include "SkTypefaceCache.h" |
153 | 153 |
154 SkGTypeface::SkGTypeface(sk_sp<SkTypeface> proxy, const SkPaint& paint) | 154 SkGTypeface::SkGTypeface(SkTypeface* proxy, const SkPaint& paint) |
155 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) | 155 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) |
156 , fProxy(std::move(proxy)) | 156 , fProxy(SkRef(proxy)) |
157 , fPaint(paint) | 157 , fPaint(paint) {} |
158 {} | 158 |
| 159 SkGTypeface::~SkGTypeface() { |
| 160 fProxy->unref(); |
| 161 } |
159 | 162 |
160 SkScalerContext* SkGTypeface::onCreateScalerContext(const SkScalerContextEffects
& effects, | 163 SkScalerContext* SkGTypeface::onCreateScalerContext(const SkScalerContextEffects
& effects, |
161 const SkDescriptor* desc) co
nst { | 164 const SkDescriptor* desc) co
nst { |
162 return new SkGScalerContext(const_cast<SkGTypeface*>(this), effects, desc); | 165 return new SkGScalerContext(const_cast<SkGTypeface*>(this), effects, desc); |
163 } | 166 } |
164 | 167 |
165 void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { | 168 void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { |
166 fProxy->filterRec(rec); | 169 fProxy->filterRec(rec); |
167 rec->setHinting(SkPaint::kNo_Hinting); | 170 rec->setHinting(SkPaint::kNo_Hinting); |
168 rec->fMaskFormat = SkMask::kARGB32_Format; | 171 rec->fMaskFormat = SkMask::kARGB32_Format; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 251 |
249 friend class SkGFontBuilder; | 252 friend class SkGFontBuilder; |
250 SkGFont(int count, Glyph* array); | 253 SkGFont(int count, Glyph* array); |
251 }; | 254 }; |
252 | 255 |
253 class SkGFontBuilder { | 256 class SkGFontBuilder { |
254 public: | 257 public: |
255 | 258 |
256 }; | 259 }; |
257 #endif | 260 #endif |
OLD | NEW |