From c4b84aef1adeb68bc853f35abb85b79fa1fcaac6 Mon Sep 17 00:00:00 2001 From: rmistry Date: Mon, 23 Jun 2014 06:59:15 -0700 Subject: Revert of Revert of Fix SkPaint::measureText for stroked hairline text (https://codereview.chromium.org/354433002/) Reason for revert: Rebaseline CL is ready to be submitted Original issue's description: > Revert of Fix SkPaint::measureText for stroked hairline text (https://codereview.chromium.org/335603003/) > > Reason for revert: > Caused many shadertext GM failures > > Original issue's description: > > Fix SkPaint::measureText for stroked hairline text > > > > SkPaint::measureText and text drawing used different criteria for > > determining whether text should be drawn as paths or not. > > > > Adds tests glyph_pos_(h/n)_(s/f/b) to test the text rendering and the glyph > > positioning in the rendering. Mainly added in order to define what is the > > expected text rendering when hairline stroke is used with various transform > > options. > > > > The testcase also tries to note or highlight the fact that SkPaint::measureText > > is not expected to produce intuitively matching results when compared to a > > rendering, if the rendering is done so that the device ends up having a device > > transform. > > > > This fixes the glyph_pos_h_s (hairline, stroked) test-case. > > > > Ignore shadertext2_pdf-poppler.png gm on > > Test-Ubuntu13.10-ShuttleA-NoGPU-x86_64-Debug temporarily, as that fails. > > > > Committed: https://skia.googlesource.com/skia/+/196af738027c5e18c3eb792dbcaf90ef27821793 > > TBR=jvanverth@google.com,reed@google.com,kkinnunen@nvidia.com > NOTREECHECKS=true > NOTRY=true > > Committed: https://skia.googlesource.com/skia/+/abc9bb55ddfeb4b1a7acc335a34841fddcd22d27 R=jvanverth@google.com, reed@google.com, kkinnunen@nvidia.com TBR=jvanverth@google.com, kkinnunen@nvidia.com, reed@google.com NOTREECHECKS=true NOTRY=true Author: rmistry@google.com Review URL: https://codereview.chromium.org/349153005 --- src/core/SkPaint.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/core/SkPaint.cpp') diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 16d8bb2e4e..86b54f22c8 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -11,6 +11,7 @@ #include "SkColorFilter.h" #include "SkData.h" #include "SkDeviceProperties.h" +#include "SkDraw.h" #include "SkFontDescriptor.h" #include "SkFontHost.h" #include "SkGlyphCache.h" @@ -506,15 +507,6 @@ bool SkPaint::TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM) { return tooBig(matrix, MaxCacheSize2()); } -bool SkPaint::tooBigToUseCache(const SkMatrix& ctm) const { - SkMatrix textM; - return TooBigToUseCache(ctm, *this->setTextMatrix(&textM)); -} - -bool SkPaint::tooBigToUseCache() const { - SkMatrix textM; - return tooBig(*this->setTextMatrix(&textM), MaxCacheSize2()); -} /////////////////////////////////////////////////////////////////////////////// @@ -997,7 +989,7 @@ SkScalar SkPaint::setupForAsPaths() { class SkCanonicalizePaint { public: SkCanonicalizePaint(const SkPaint& paint) : fPaint(&paint), fScale(0) { - if (paint.isLinearText() || paint.tooBigToUseCache()) { + if (paint.isLinearText() || SkDraw::ShouldDrawTextAsPaths(paint, SkMatrix::I())) { SkPaint* p = fLazy.set(paint); fScale = p->setupForAsPaths(); fPaint = p; -- cgit v1.2.3