| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
| 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 "SkEndian.h" | 9 #include "SkEndian.h" |
| 10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 | 226 |
| 227 SkFontData* SkTypeface::createFontData() const { | 227 SkFontData* SkTypeface::createFontData() const { |
| 228 return this->onCreateFontData(); | 228 return this->onCreateFontData(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // This implementation is temporary until this method can be made pure virtual. | 231 // This implementation is temporary until this method can be made pure virtual. |
| 232 SkFontData* SkTypeface::onCreateFontData() const { | 232 SkFontData* SkTypeface::onCreateFontData() const { |
| 233 int index; | 233 int index; |
| 234 SkAutoTDelete<SkStreamAsset> stream(this->onOpenStream(&index)); | 234 SkAutoTDelete<SkStreamAsset> stream(this->onOpenStream(&index)); |
| 235 return new SkFontData(stream.detach(), index, nullptr, 0); | 235 return new SkFontData(stream.release(), index, nullptr, 0); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding, | 238 int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding, |
| 239 uint16_t glyphs[], int glyphCount) const { | 239 uint16_t glyphs[], int glyphCount) const { |
| 240 if (glyphCount <= 0) { | 240 if (glyphCount <= 0) { |
| 241 return 0; | 241 return 0; |
| 242 } | 242 } |
| 243 if (nullptr == chars || (unsigned)encoding > kUTF32_Encoding) { | 243 if (nullptr == chars || (unsigned)encoding > kUTF32_Encoding) { |
| 244 if (glyphs) { | 244 if (glyphs) { |
| 245 sk_bzero(glyphs, glyphCount * sizeof(glyphs[0])); | 245 sk_bzero(glyphs, glyphCount * sizeof(glyphs[0])); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 if (ctx.get()) { | 352 if (ctx.get()) { |
| 353 SkPaint::FontMetrics fm; | 353 SkPaint::FontMetrics fm; |
| 354 ctx->getFontMetrics(&fm); | 354 ctx->getFontMetrics(&fm); |
| 355 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize, | 355 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize, |
| 356 fm.fXMax * invTextSize, fm.fBottom * invTextSize); | 356 fm.fXMax * invTextSize, fm.fBottom * invTextSize); |
| 357 return true; | 357 return true; |
| 358 } | 358 } |
| 359 return false; | 359 return false; |
| 360 } | 360 } |
| 361 | 361 |
| OLD | NEW |