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

Unified Diff: tests/WArrayTest.cpp

Issue 1955053002: SkAdvancedTypefaceMetrics: getAdvanceData uses std::function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: typedef 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
« no previous file with comments | « 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 55f2a10b01be5f340142b75377f573a11aec3997..9a239fbe5c36de9f63ed3bf66f7e22e2619a2a3e 100644
--- a/tests/WArrayTest.cpp
+++ b/tests/WArrayTest.cpp
@@ -150,19 +150,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) {
SkAdvancedTypefaceMetrics metrics;
- metrics.setGlyphWidths((void*)this, fAdvancesLen, fSubset, fSubsetLen,
- getAdvance);
+ metrics.setGlyphWidths(
+ fAdvancesLen, fSubset, fSubsetLen,
+ std::function<bool(int, int16_t*)>([this](int gId, int16_t* advance) {
+ if (gId >= 0 && gId < fAdvancesLen) {
+ *advance = fAdvances[gId];
+ return true;
+ }
+ return false;
+ }));
SkString stringResult = stringify_advance_data(metrics.fGlyphWidths);
if (!stringResult.equals(fExpected)) {
« no previous file with comments | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698