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

Side by Side Diff: src/ports/SkFontHost_win.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" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 10
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 } 1833 }
1834 } 1834 }
1835 1835
1836 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { 1836 if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
1837 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { 1837 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) {
1838 appendRange(&info->fGlyphWidths, 0); 1838 appendRange(&info->fGlyphWidths, 0);
1839 info->fGlyphWidths->fAdvance.append(1, &min_width); 1839 info->fGlyphWidths->fAdvance.append(1, &min_width);
1840 finishRange(info->fGlyphWidths.get(), 0, 1840 finishRange(info->fGlyphWidths.get(), 0,
1841 SkAdvancedTypefaceMetrics::WidthRange::kDefault); 1841 SkAdvancedTypefaceMetrics::WidthRange::kDefault);
1842 } else { 1842 } else {
1843 std::function<bool(int gId, int16_t* data)> getWidthAdvanceFn =
1844 [hdc](int gId, int16_t* advance) {
1845 return getWidthAdvance(hdc, gId, advance);
1846 };
1843 info->fGlyphWidths.reset( 1847 info->fGlyphWidths.reset(
1844 getAdvanceData(hdc, 1848 getAdvanceData(glyphCount,
1845 glyphCount,
1846 glyphIDs, 1849 glyphIDs,
1847 glyphIDsCount, 1850 glyphIDsCount,
1848 &getWidthAdvance)); 1851 getWidthAdvanceFn));
1849 } 1852 }
1850 } 1853 }
1851 1854
1852 Error: 1855 Error:
1853 ReturnInfo: 1856 ReturnInfo:
1854 SelectObject(hdc, savefont); 1857 SelectObject(hdc, savefont);
1855 DeleteObject(designFont); 1858 DeleteObject(designFont);
1856 DeleteObject(font); 1859 DeleteObject(font);
1857 DeleteDC(hdc); 1860 DeleteDC(hdc);
1858 1861
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 2517
2515 private: 2518 private:
2516 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2519 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2517 }; 2520 };
2518 2521
2519 /////////////////////////////////////////////////////////////////////////////// 2522 ///////////////////////////////////////////////////////////////////////////////
2520 2523
2521 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } 2524 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; }
2522 2525
2523 #endif//defined(SK_BUILD_FOR_WIN32) 2526 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698