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

Unified Diff: src/ports/SkScalerContext_win_dw.cpp

Issue 370463002: Remove vertical/horizontal metrics selection. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Mac. Created 6 years, 6 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/SkScalerContext_win_dw.h ('k') | src/ports/SkTypeface_win_dw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkScalerContext_win_dw.cpp
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index b6c2895175639b063f8c947564ce596a61d291fc..02d5bb96e88c0381d18d1d280db4c6c5019c87f1 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -446,18 +446,13 @@ void SkScalerContext_DW::generateMetrics(SkGlyph* glyph) {
glyph->fTop = SkToS16(bbox.top);
}
-void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* mx,
- SkPaint::FontMetrics* my) {
- if (!(mx || my))
+void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
+ if (NULL == metrics) {
return;
-
- if (mx) {
- sk_bzero(mx, sizeof(*mx));
- }
- if (my) {
- sk_bzero(my, sizeof(*my));
}
+ sk_bzero(metrics, sizeof(*metrics));
+
DWRITE_FONT_METRICS dwfm;
if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode ||
DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode)
@@ -472,33 +467,18 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* mx,
}
SkScalar upem = SkIntToScalar(dwfm.designUnitsPerEm);
- if (mx) {
- mx->fTop = -fTextSizeRender * SkIntToScalar(dwfm.ascent) / upem;
- mx->fAscent = mx->fTop;
- mx->fDescent = fTextSizeRender * SkIntToScalar(dwfm.descent) / upem;
- mx->fBottom = mx->fDescent;
- mx->fLeading = fTextSizeRender * SkIntToScalar(dwfm.lineGap) / upem;
- mx->fXHeight = fTextSizeRender * SkIntToScalar(dwfm.xHeight) / upem;
- mx->fUnderlineThickness = fTextSizeRender * SkIntToScalar(dwfm.underlineThickness) / upem;
- mx->fUnderlinePosition = -(fTextSizeRender * SkIntToScalar(dwfm.underlinePosition) / upem);
-
- mx->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
- mx->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
- }
- if (my) {
- my->fTop = -fTextSizeRender * SkIntToScalar(dwfm.ascent) / upem;
- my->fAscent = my->fTop;
- my->fDescent = fTextSizeRender * SkIntToScalar(dwfm.descent) / upem;
- my->fBottom = my->fDescent;
- my->fLeading = fTextSizeRender * SkIntToScalar(dwfm.lineGap) / upem;
- my->fXHeight = fTextSizeRender * SkIntToScalar(dwfm.xHeight) / upem;
- my->fUnderlineThickness = fTextSizeRender * SkIntToScalar(dwfm.underlineThickness) / upem;
- my->fUnderlinePosition = -(fTextSizeRender * SkIntToScalar(dwfm.underlinePosition) / upem);
-
- my->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
- my->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
- }
+ metrics->fTop = -fTextSizeRender * SkIntToScalar(dwfm.ascent) / upem;
+ metrics->fAscent = metrics->fTop;
+ metrics->fDescent = fTextSizeRender * SkIntToScalar(dwfm.descent) / upem;
+ metrics->fBottom = metrics->fDescent;
+ metrics->fLeading = fTextSizeRender * SkIntToScalar(dwfm.lineGap) / upem;
+ metrics->fXHeight = fTextSizeRender * SkIntToScalar(dwfm.xHeight) / upem;
+ metrics->fUnderlineThickness = fTextSizeRender * SkIntToScalar(dwfm.underlineThickness) / upem;
+ metrics->fUnderlinePosition = -(fTextSizeRender * SkIntToScalar(dwfm.underlinePosition) / upem);
+
+ metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
+ metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/ports/SkScalerContext_win_dw.h ('k') | src/ports/SkTypeface_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698