Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 1955053002: SkAdvancedTypefaceMetrics: getAdvanceData uses std::function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-05-06 (Friday) 12:08:37 EDT Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 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 "SkTypes.h" // Keep this before any #ifdef ... 8 #include "SkTypes.h" // Keep this before any #ifdef ...
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
10 10
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 } 1617 }
1618 } 1618 }
1619 1619
1620 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { 1620 if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
1621 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { 1621 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) {
1622 skia_advanced_typeface_metrics_utils::appendRange(&info->fGlyphWidth s, 0); 1622 skia_advanced_typeface_metrics_utils::appendRange(&info->fGlyphWidth s, 0);
1623 info->fGlyphWidths->fAdvance.append(1, &min_width); 1623 info->fGlyphWidths->fAdvance.append(1, &min_width);
1624 skia_advanced_typeface_metrics_utils::finishRange(info->fGlyphWidths .get(), 0, 1624 skia_advanced_typeface_metrics_utils::finishRange(info->fGlyphWidths .get(), 0,
1625 SkAdvancedTypefaceMetrics::WidthRange::kDefault); 1625 SkAdvancedTypefaceMetrics::WidthRange::kDefault);
1626 } else { 1626 } else {
1627 auto fontData = ctFont.get();
1628 std::function<bool(int gId, int16_t* data)> getWidthAdvanceFn =
bungeman-skia 2016/05/09 00:14:08 There's no particular reason to give these functio
hal.canary 2016/05/09 12:15:08 Done.
1629 [fontData](int gId, int16_t* data) {
1630 return getWidthAdvance(fontData, gId, data);
1631 };
1627 info->fGlyphWidths.reset( 1632 info->fGlyphWidths.reset(
1628 skia_advanced_typeface_metrics_utils::getAdvanceData(ctFont.get( ), 1633 skia_advanced_typeface_metrics_utils::getAdvanceData(
1629 SkToInt(glyphCount), 1634 SkToInt(glyphCount),
1630 glyphIDs, 1635 glyphIDs,
1631 glyphIDsCount, 1636 glyphIDsCount,
1632 &getWidthAdvance)); 1637 getWidthAdvanceFn));
1633 } 1638 }
1634 } 1639 }
1635 return info; 1640 return info;
1636 } 1641 }
1637 1642
1638 /////////////////////////////////////////////////////////////////////////////// 1643 ///////////////////////////////////////////////////////////////////////////////
1639 1644
1640 static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) { 1645 static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) {
1641 CTFontRef ctFont = typeface->fFontRef.get(); 1646 CTFontRef ctFont = typeface->fFontRef.get();
1642 AutoCFRelease<CFNumberRef> fontFormatRef( 1647 AutoCFRelease<CFNumberRef> fontFormatRef(
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 2580
2576 return SkSafeRef(GetDefaultFace()); 2581 return SkSafeRef(GetDefaultFace());
2577 } 2582 }
2578 }; 2583 };
2579 2584
2580 /////////////////////////////////////////////////////////////////////////////// 2585 ///////////////////////////////////////////////////////////////////////////////
2581 2586
2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } 2587 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; }
2583 2588
2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 2589 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698