OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 { | 325 { |
326 #if OS(MACOSX) | 326 #if OS(MACOSX) |
327 hb_face_t* face = hb_coretext_face_create(m_platformData->cgFont()); | 327 hb_face_t* face = hb_coretext_face_create(m_platformData->cgFont()); |
328 #else | 328 #else |
329 hb_face_t* face = nullptr; | 329 hb_face_t* face = nullptr; |
330 | 330 |
331 DEFINE_STATIC_LOCAL(BooleanHistogram, | 331 DEFINE_STATIC_LOCAL(BooleanHistogram, |
332 zeroCopySuccessHistogram, | 332 zeroCopySuccessHistogram, |
333 ("Blink.Fonts.HarfBuzzFaceZeroCopyAccess")); | 333 ("Blink.Fonts.HarfBuzzFaceZeroCopyAccess")); |
334 SkTypeface* typeface = m_platformData->typeface(); | 334 SkTypeface* typeface = m_platformData->typeface(); |
| 335 CHECK(typeface); |
335 int ttcIndex = 0; | 336 int ttcIndex = 0; |
336 SkStreamAsset* typefaceStream = typeface->openStream(&ttcIndex); | 337 SkStreamAsset* typefaceStream = typeface->openStream(&ttcIndex); |
337 if (typefaceStream->getMemoryBase()) { | 338 if (typefaceStream && typefaceStream->getMemoryBase()) { |
338 std::unique_ptr<hb_blob_t, void(*)(hb_blob_t*)> faceBlob(hb_blob_create( | 339 std::unique_ptr<hb_blob_t, void(*)(hb_blob_t*)> faceBlob(hb_blob_create( |
339 reinterpret_cast<const char*>(typefaceStream->getMemoryBase()), | 340 reinterpret_cast<const char*>(typefaceStream->getMemoryBase()), |
340 typefaceStream->getLength(), | 341 typefaceStream->getLength(), |
341 HB_MEMORY_MODE_READONLY, | 342 HB_MEMORY_MODE_READONLY, |
342 typefaceStream, | 343 typefaceStream, |
343 deleteTypefaceStream), | 344 deleteTypefaceStream), |
344 hb_blob_destroy); | 345 hb_blob_destroy); |
345 face = hb_face_create(faceBlob.get(), ttcIndex); | 346 face = hb_face_create(faceBlob.get(), ttcIndex); |
346 } | 347 } |
347 | 348 |
(...skipping 26 matching lines...) Expand all Loading... |
374 m_platformData->setupPaint(&m_harfBuzzFontData->m_paint); | 375 m_platformData->setupPaint(&m_harfBuzzFontData->m_paint); |
375 m_harfBuzzFontData->m_rangeSet = rangeSet; | 376 m_harfBuzzFontData->m_rangeSet = rangeSet; |
376 m_harfBuzzFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromF
ontPlatformData(m_platformData).get(); | 377 m_harfBuzzFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromF
ontPlatformData(m_platformData).get(); |
377 ASSERT(m_harfBuzzFontData->m_simpleFontData); | 378 ASSERT(m_harfBuzzFontData->m_simpleFontData); |
378 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); | 379 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); |
379 hb_font_set_scale(m_unscaledFont, scale, scale); | 380 hb_font_set_scale(m_unscaledFont, scale, scale); |
380 return m_unscaledFont; | 381 return m_unscaledFont; |
381 } | 382 } |
382 | 383 |
383 } // namespace blink | 384 } // namespace blink |
OLD | NEW |