From 67510d3a7d294705dc78386dd4fc6e903ae0f53c Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Thu, 1 Nov 2018 16:57:26 -0400 Subject: [PATCH] remove (unused and weird) zoom parameter on getFontMetrics Bug: skia: Change-Id: I17d1d79da7518aaa37daf22768f1b2624bd59bcf Reviewed-on: https://skia-review.googlesource.com/c/167540 Reviewed-by: Ben Wagner Commit-Queue: Mike Reed --- include/core/SkPaint.h | 7 ++----- src/core/SkPaint_text.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index e35205991c..957471d7ac 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -1091,14 +1091,11 @@ public: Results are scaled by text size but does not take into account dimensions required by text scale x, text skew x, fake bold, style stroke, and SkPathEffect. - Results can be additionally scaled by scale; a scale of zero - is ignored. @param metrics storage for SkPaint::FontMetrics from SkTypeface; may be nullptr - @param scale additional multiplier for returned values @return recommended spacing between lines */ - SkScalar getFontMetrics(FontMetrics* metrics, SkScalar scale = 0) const; + SkScalar getFontMetrics(FontMetrics* metrics) const; /** Returns the recommended spacing between lines: the sum of metrics descent, ascent, and leading. @@ -1108,7 +1105,7 @@ public: @return recommended spacing between lines */ - SkScalar getFontSpacing() const { return this->getFontMetrics(nullptr, 0); } + SkScalar getFontSpacing() const { return this->getFontMetrics(nullptr); } /** Converts text into glyph indices. Returns the number of glyph indices represented by text. diff --git a/src/core/SkPaint_text.cpp b/src/core/SkPaint_text.cpp index 89a606838f..2e3b4bdf23 100644 --- a/src/core/SkPaint_text.cpp +++ b/src/core/SkPaint_text.cpp @@ -472,17 +472,11 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth, /////////////////////////////////////////////////////////////////////////////// -SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const { +SkScalar SkPaint::getFontMetrics(FontMetrics* metrics) const { SkCanonicalizePaint canon(*this); const SkPaint& paint = canon.getPaint(); SkScalar scale = canon.getScale(); - SkMatrix zoomMatrix, *zoomPtr = nullptr; - if (zoom) { - zoomMatrix.setScale(zoom, zoom); - zoomPtr = &zoomMatrix; - } - FontMetrics storage; if (nullptr == metrics) { metrics = &storage; @@ -492,7 +486,7 @@ SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const { SkScalerContextEffects effects; auto desc = SkScalerContext::CreateDescriptorAndEffectsUsingPaint( - paint, nullptr, SkScalerContextFlags::kNone, zoomPtr, &ad, &effects); + paint, nullptr, SkScalerContextFlags::kNone, nullptr, &ad, &effects); { auto typeface = SkPaintPriv::GetTypefaceOrDefault(paint);