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

Unified Diff: tests/WArrayTest.cpp

Issue 1955053002: SkAdvancedTypefaceMetrics: getAdvanceData uses std::function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« src/ports/SkFontHost_FreeType.cpp ('K') | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/WArrayTest.cpp
diff --git a/tests/WArrayTest.cpp b/tests/WArrayTest.cpp
index 40128fa2b4dd47c1e62c1a5dc5f0d8ce606928bf..82a25e69c5a399dea57f99363a342966637c6a25 100644
--- a/tests/WArrayTest.cpp
+++ b/tests/WArrayTest.cpp
@@ -151,18 +151,17 @@ class TestWData {
const int fSubsetLen;
const char* fExpected;
- static bool getAdvance(void* tc, int gId, int16_t* advance) {
- TestWData* testCase = (TestWData*)tc;
- if (gId >= 0 && gId < testCase->fAdvancesLen) {
- *advance = testCase->fAdvances[gId];
- return true;
- }
- return false;
- }
-
void runTest(skiatest::Reporter* reporter) {
SkAutoTDelete<SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t> > result;
- result.reset(getAdvanceData((void*)this, fAdvancesLen, fSubset, fSubsetLen, getAdvance));
+ std::function<bool(int gId, int16_t* data)> getWidthAdvanceFn =
+ [this](int gId, int16_t* advance) {
+ if (gId >= 0 && gId < fAdvancesLen) {
+ *advance = fAdvances[gId];
+ return true;
+ }
+ return false;
+ };
+ result.reset(getAdvanceData(fAdvancesLen, fSubset, fSubsetLen, getWidthAdvanceFn));
SkString stringResult = stringify_advance_data(result);
if (!stringResult.equals(fExpected)) {
« src/ports/SkFontHost_FreeType.cpp ('K') | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698