diff options
author | Herb Derby <herb@google.com> | 2018-05-21 16:10:17 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-21 21:53:54 +0000 |
commit | 1e7c65806f3fbde13b5d8064dc5734d98c32a284 (patch) | |
tree | e758fae7c14f09ba185b8aaa8f8306dad5cd4905 | |
parent | 4bfb50b904e0e92d10145398eb3a6f8dd7868867 (diff) |
drawPosText no longer obeys paint alignment
Change-Id: Iac498b54dea4aa1b203d2b9c58e15bb5f2147f82
Reviewed-on: https://skia-review.googlesource.com/129462
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
-rw-r--r-- | gm/glyph_pos_align.cpp | 66 | ||||
-rw-r--r-- | gn/gm.gni | 1 | ||||
-rw-r--r-- | include/core/SkCanvas.h | 8 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 8 | ||||
-rw-r--r-- | src/core/SkFindAndPlaceGlyph.h | 90 | ||||
-rw-r--r-- | src/core/SkOverdrawCanvas.cpp | 2 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextContext.cpp | 22 | ||||
-rw-r--r-- | src/xps/SkXPSDevice.cpp | 3 | ||||
-rw-r--r-- | tests/DrawTextTest.cpp | 34 |
9 files changed, 39 insertions, 195 deletions
diff --git a/gm/glyph_pos_align.cpp b/gm/glyph_pos_align.cpp deleted file mode 100644 index 50bcf82742..0000000000 --- a/gm/glyph_pos_align.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "gm.h" -#include "SkCanvas.h" -#include "SkGradientShader.h" - -/** - * This test exercises drawPosTextH and drawPosText with every text align. - */ -constexpr int kWidth = 480; -constexpr int kHeight = 600; -constexpr SkScalar kTextHeight = 64.0f; -constexpr int kMaxStringLength = 12; - -static void drawTestCase(SkCanvas*, const char*, SkScalar, const SkPaint&); - -DEF_SIMPLE_GM_BG(glyph_pos_align, canvas, kWidth, kHeight, SK_ColorBLACK) { - SkPaint paint; - paint.setTextSize(kTextHeight); - paint.setFakeBoldText(true); - const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; - const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; - paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), - SkShader::kMirror_TileMode)); - paint.setTextAlign(SkPaint::kRight_Align); - drawTestCase(canvas, "Right Align", kTextHeight, paint); - - paint.setTextAlign(SkPaint::kCenter_Align); - drawTestCase(canvas, "Center Align", 4 * kTextHeight, paint); - - paint.setTextAlign(SkPaint::kLeft_Align); - drawTestCase(canvas, "Left Align", 7 * kTextHeight, paint); -} - -void drawTestCase(SkCanvas* canvas, const char* text, SkScalar y, const SkPaint& paint) { - SkScalar widths[kMaxStringLength]; - SkScalar posX[kMaxStringLength]; - SkPoint pos[kMaxStringLength]; - int length = SkToInt(strlen(text)); - SkASSERT(length <= kMaxStringLength); - - paint.getTextWidths(text, length, widths); - - float originX; - switch (paint.getTextAlign()) { - case SkPaint::kRight_Align: originX = 1; break; - case SkPaint::kCenter_Align: originX = 0.5f; break; - case SkPaint::kLeft_Align: originX = 0; break; - default: SK_ABORT("Invalid paint origin"); return; - } - - float x = kTextHeight; - for (int i = 0; i < length; ++i) { - posX[i] = x + originX * widths[i]; - pos[i].set(posX[i], i ? pos[i - 1].y() + 3 : y + kTextHeight); - x += widths[i]; - } - - canvas->drawPosTextH(text, length, posX, y, paint); - canvas->drawPosText(text, length, pos, paint); -} @@ -148,7 +148,6 @@ gm_sources = [ "$_gm/getpostextpath.cpp", "$_gm/giantbitmap.cpp", "$_gm/glyph_pos.cpp", - "$_gm/glyph_pos_align.cpp", "$_gm/gm.cpp", "$_gm/gradient_matrix.cpp", "$_gm/gradientDirtyLaundry.cpp", diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 8a46320ea9..97de70b5f7 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -1964,8 +1964,8 @@ public: described by byteLength of text. text meaning depends on SkPaint::TextEncoding; by default, text is encoded as - UTF-8. pos elements' meaning depends on SkPaint::Align and SkPaint vertical text; - by default each glyph left side bearing is positioned at x and its + UTF-8. pos elements' meaning depends on SkPaint vertical text; + by each glyph left side bearing is positioned at x and its baseline is positioned at y. Text size is affected by SkMatrix and SkPaint text size. @@ -1989,8 +1989,8 @@ public: must match the number of glyphs described by byteLength of text. text meaning depends on SkPaint::TextEncoding; by default, text is encoded as - UTF-8. xpos elements' meaning depends on SkPaint::Align and SkPaint vertical text; - by default each glyph left side bearing is positioned at an xpos element and + UTF-8. xpos elements' meaning depends SkPaint vertical text; + each glyph left side bearing is positioned at an xpos element and its baseline is positioned at constY. Text size is affected by SkMatrix and SkPaint text size. diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 7e526e6098..b7150f85f8 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1590,7 +1590,6 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, const SkS paint, props, this->scalerContextFlags(), nullptr); const char* stop = text + byteLength; - SkTextAlignProc alignProc(paint.getTextAlign()); SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); // Now restore the original settings, so we "draw" with whatever style/stroking. @@ -1602,10 +1601,8 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength, const SkS if (glyph.fWidth) { const SkPath* path = cache->findPath(glyph); if (path) { - SkPoint tmsLoc; - tmsProc(pos, &tmsLoc); SkPoint loc; - alignProc(tmsLoc, glyph, &loc); + tmsProc(pos, &loc); matrix[SkMatrix::kMTransX] = loc.fX; matrix[SkMatrix::kMTransY] = loc.fY; @@ -1641,11 +1638,10 @@ void SkDraw::drawPosText(const char text[], size_t byteLength, const SkScalar po SkAutoBlitterChoose blitterChooser(*this, nullptr, paint); SkAAClipBlitterWrapper wrapper(*fRC, blitterChooser.get()); DrawOneGlyph drawOneGlyph(*this, paint, cache.get(), wrapper.getBlitter()); - SkPaint::Align textAlignment = paint.getTextAlign(); SkFindAndPlaceGlyph::ProcessPosText( paint.getTextEncoding(), text, byteLength, - offset, *fMatrix, pos, scalarsPerPosition, textAlignment, cache.get(), drawOneGlyph); + offset, *fMatrix, pos, scalarsPerPosition, cache.get(), drawOneGlyph); } #if defined _WIN32 diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h index 00417152ab..69debe4d59 100644 --- a/src/core/SkFindAndPlaceGlyph.h +++ b/src/core/SkFindAndPlaceGlyph.h @@ -44,7 +44,6 @@ public: static void ProcessPosText( SkPaint::TextEncoding, const char text[], size_t byteLength, SkPoint offset, const SkMatrix& matrix, const SkScalar pos[], int scalarsPerPosition, - SkPaint::Align textAlignment, SkGlyphCache* cache, ProcessOneGlyph&& processOneGlyph); // The SubpixelAlignment function produces a suitable position for the glyph cache to @@ -288,23 +287,6 @@ private: const SkMatrixPriv::MapXYProc fMapProc; }; - // TextAlignmentAdjustment handles shifting the glyph based on its width. - static SkPoint TextAlignmentAdjustment(SkPaint::Align textAlignment, const SkGlyph& glyph) { - switch (textAlignment) { - case SkPaint::kLeft_Align: - return {0.0f, 0.0f}; - case SkPaint::kCenter_Align: - return {SkFloatToScalar(glyph.fAdvanceX) / 2, - SkFloatToScalar(glyph.fAdvanceY) / 2}; - case SkPaint::kRight_Align: - return {SkFloatToScalar(glyph.fAdvanceX), - SkFloatToScalar(glyph.fAdvanceY)}; - } - // Even though the entire enum is covered above, MVSC doesn't think so. Make it happy. - SK_ABORT("Should never get here."); - return {0.0f, 0.0f}; - } - // The "call" to SkFixedToScalar is actually a macro. It's macros all the way down. // Needs to be a macro because you can't have a const float unless you make it constexpr. static constexpr SkScalar kSubpixelRounding = SkFixedToScalar(SkGlyph::kSubpixelRound); @@ -336,8 +318,7 @@ private: // GlyphFindAndPlaceSubpixel handles finding and placing glyphs when sub-pixel positioning is // requested. After it has found and placed the glyph it calls the templated function // ProcessOneGlyph in order to actually perform an action. - template<typename ProcessOneGlyph, SkPaint::Align kTextAlignment, - SkAxisAlignment kAxisAlignment> + template<typename ProcessOneGlyph, SkAxisAlignment kAxisAlignment> class GlyphFindAndPlaceSubpixel final : public GlyphFindAndPlaceInterface<ProcessOneGlyph> { public: explicit GlyphFindAndPlaceSubpixel(GlyphFinderInterface* glyphFinder) @@ -346,24 +327,6 @@ private: SkPoint findAndPositionGlyph( const char** text, SkPoint position, ProcessOneGlyph&& processOneGlyph) override { - if (kTextAlignment != SkPaint::kLeft_Align) { - // Get the width of an un-sub-pixel positioned glyph for calculating the - // alignment. This is not needed for kLeftAlign because its adjustment is - // always {0, 0}. - const char* tempText = *text; - const SkGlyph &metricGlyph = fGlyphFinder->lookupGlyph(&tempText); - - if (metricGlyph.fWidth <= 0) { - // Exiting early, be sure to update text pointer. - *text = tempText; - return position + SkPoint{SkFloatToScalar(metricGlyph.fAdvanceX), - SkFloatToScalar(metricGlyph.fAdvanceY)}; - } - - // Adjust the final position by the alignment adjustment. - position -= TextAlignmentAdjustment(kTextAlignment, metricGlyph); - } - // Find the glyph. SkIPoint lookupPosition = SubpixelAlignment(kAxisAlignment, position); const SkGlyph& renderGlyph = @@ -384,7 +347,7 @@ private: // GlyphFindAndPlaceFullPixel handles finding and placing glyphs when no sub-pixel // positioning is requested. - template<typename ProcessOneGlyph, SkPaint::Align kTextAlignment> + template<typename ProcessOneGlyph> class GlyphFindAndPlaceFullPixel final : public GlyphFindAndPlaceInterface<ProcessOneGlyph> { public: explicit GlyphFindAndPlaceFullPixel(GlyphFinderInterface* glyphFinder) @@ -397,7 +360,6 @@ private: const SkGlyph& glyph = fGlyphFinder->lookupGlyph(text); if (glyph.fWidth > 0) { - finalPosition -= TextAlignmentAdjustment(kTextAlignment, glyph); processOneGlyph(glyph, finalPosition, {SK_ScalarHalf, SK_ScalarHalf}); } return finalPosition + SkPoint{SkFloatToScalar(glyph.fAdvanceX), @@ -408,20 +370,20 @@ private: GlyphFinderInterface* fGlyphFinder; }; - template <typename ProcessOneGlyph, SkPaint::Align kTextAlignment> + template <typename ProcessOneGlyph> static GlyphFindAndPlaceInterface<ProcessOneGlyph>* getSubpixel( SkArenaAlloc* arena, SkAxisAlignment axisAlignment, GlyphFinderInterface* glyphFinder) { switch (axisAlignment) { case kX_SkAxisAlignment: return arena->make<GlyphFindAndPlaceSubpixel< - ProcessOneGlyph, kTextAlignment, kX_SkAxisAlignment>>(glyphFinder); + ProcessOneGlyph, kX_SkAxisAlignment>>(glyphFinder); case kNone_SkAxisAlignment: return arena->make<GlyphFindAndPlaceSubpixel< - ProcessOneGlyph, kTextAlignment, kNone_SkAxisAlignment>>(glyphFinder); + ProcessOneGlyph, kNone_SkAxisAlignment>>(glyphFinder); case kY_SkAxisAlignment: return arena->make<GlyphFindAndPlaceSubpixel< - ProcessOneGlyph, kTextAlignment, kY_SkAxisAlignment>>(glyphFinder); + ProcessOneGlyph, kY_SkAxisAlignment>>(glyphFinder); } SK_ABORT("Should never get here."); return nullptr; @@ -449,7 +411,6 @@ template<typename ProcessOneGlyph> inline void SkFindAndPlaceGlyph::ProcessPosText( SkPaint::TextEncoding textEncoding, const char text[], size_t byteLength, SkPoint offset, const SkMatrix& matrix, const SkScalar pos[], int scalarsPerPosition, - SkPaint::Align textAlignment, SkGlyphCache* cache, ProcessOneGlyph&& processOneGlyph) { SkAxisAlignment axisAlignment = cache->getScalerContext()->computeAxisAlignmentForHText(); @@ -457,7 +418,6 @@ inline void SkFindAndPlaceGlyph::ProcessPosText( // Specialized code for handling the most common case for blink. if (textEncoding == SkPaint::kGlyphID_TextEncoding - && textAlignment == SkPaint::kLeft_Align && axisAlignment == kX_SkAxisAlignment && cache->isSubpixel() && mtype <= SkMatrix::kTranslate_Mask) @@ -465,7 +425,7 @@ inline void SkFindAndPlaceGlyph::ProcessPosText( GlyphIdGlyphFinder glyphFinder(cache); using Positioner = GlyphFindAndPlaceSubpixel < - ProcessOneGlyph, SkPaint::kLeft_Align, kX_SkAxisAlignment>; + ProcessOneGlyph, kX_SkAxisAlignment>; HorizontalPositions hPositions{pos}; ArbitraryPositions aPositions{pos}; PositionReaderInterface* positions = nullptr; @@ -509,37 +469,9 @@ inline void SkFindAndPlaceGlyph::ProcessPosText( GlyphFindAndPlaceInterface<ProcessOneGlyph>* findAndPosition = nullptr; if (cache->isSubpixel()) { - switch (textAlignment) { - case SkPaint::kLeft_Align: - findAndPosition = getSubpixel<ProcessOneGlyph, SkPaint::kLeft_Align>( - &arena, axisAlignment, glyphFinder); - break; - case SkPaint::kCenter_Align: - findAndPosition = getSubpixel<ProcessOneGlyph, SkPaint::kCenter_Align>( - &arena, axisAlignment, glyphFinder); - break; - case SkPaint::kRight_Align: - findAndPosition = getSubpixel<ProcessOneGlyph, SkPaint::kRight_Align>( - &arena, axisAlignment, glyphFinder); - break; - } + findAndPosition = getSubpixel<ProcessOneGlyph>(&arena, axisAlignment, glyphFinder); } else { - switch (textAlignment) { - case SkPaint::kLeft_Align: - findAndPosition = arena.make< - GlyphFindAndPlaceFullPixel<ProcessOneGlyph, SkPaint::kLeft_Align>>(glyphFinder); - break; - case SkPaint::kCenter_Align: - findAndPosition = arena.make< - GlyphFindAndPlaceFullPixel<ProcessOneGlyph, - SkPaint::kCenter_Align>>(glyphFinder); - break; - case SkPaint::kRight_Align: - findAndPosition = arena.make< - GlyphFindAndPlaceFullPixel<ProcessOneGlyph, - SkPaint::kRight_Align>>(glyphFinder); - break; - } + findAndPosition = arena.make<GlyphFindAndPlaceFullPixel<ProcessOneGlyph>>(glyphFinder); } const char* stop = text + byteLength; @@ -575,10 +507,10 @@ inline void SkFindAndPlaceGlyph::ProcessText( GlyphFindAndPlaceInterface<ProcessOneGlyph>* findAndPosition = nullptr; if (cache->isSubpixel()) { SkAxisAlignment axisAlignment = cache->getScalerContext()->computeAxisAlignmentForHText(); - findAndPosition = getSubpixel<ProcessOneGlyph, SkPaint::kLeft_Align>( + findAndPosition = getSubpixel<ProcessOneGlyph>( &arena, axisAlignment, glyphFinder); } else { - using FullPixel = GlyphFindAndPlaceFullPixel<ProcessOneGlyph, SkPaint::kLeft_Align>; + using FullPixel = GlyphFindAndPlaceFullPixel<ProcessOneGlyph>; findAndPosition = arena.make<FullPixel>(glyphFinder); } diff --git a/src/core/SkOverdrawCanvas.cpp b/src/core/SkOverdrawCanvas.cpp index 050ddf76fb..e5bf5a6325 100644 --- a/src/core/SkOverdrawCanvas.cpp +++ b/src/core/SkOverdrawCanvas.cpp @@ -81,7 +81,7 @@ void SkOverdrawCanvas::drawPosTextCommon(const void* text, size_t byteLength, co paint, &props, SkScalerContextFlags::kNone, &this->getTotalMatrix()); SkFindAndPlaceGlyph::ProcessPosText(paint.getTextEncoding(), (const char*) text, byteLength, SkPoint::Make(0, 0), SkMatrix(), (const SkScalar*) pos, 2, - paint.getTextAlign(), cache.get(), processBounds); + cache.get(), processBounds); } void SkOverdrawCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 1086bc4894..8c964ba35e 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -425,7 +425,7 @@ void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex, auto cache = blob->setupCache(runIndex, props, scalerContextFlags, paint, &viewMatrix); SkFindAndPlaceGlyph::ProcessPosText( paint.skPaint().getTextEncoding(), text, byteLength, offset, viewMatrix, pos, - scalarsPerPosition, paint.skPaint().getTextAlign(), cache.get(), + scalarsPerPosition, cache.get(), [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { position += rounding; BmpAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph, @@ -504,16 +504,13 @@ void GrAtlasTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runInd const char* stop = text + byteLength; const char* lastText = text; - SkTextAlignProc alignProc(pathPaint.getTextAlign()); SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); while (text < stop) { const SkGlyph& glyph = glyphCacheProc(cache.get(), &text); if (glyph.fWidth) { - SkPoint tmsLoc; - tmsProc(pos, &tmsLoc); SkPoint loc; - alignProc(tmsLoc, glyph, &loc); + tmsProc(pos, &loc); if (SkMask::kARGB32_Format == glyph.fMaskFormat) { fallbackTextHelper.appendText(glyph, text - lastText, lastText, loc); } else { @@ -729,12 +726,7 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex, y -= alignY; SkPoint offset = SkPoint::Make(x, y); - SkPaint leftAlignedSkPaint(skPaint); - leftAlignedSkPaint.setTextAlign(SkPaint::kLeft_Align); - - GrTextUtils::Paint leftAlignedPaint(&leftAlignedSkPaint, paint.dstColorSpaceInfo()); - - this->drawDFPosText(blob, runIndex, glyphCache, props, leftAlignedPaint, scalerContextFlags, + this->drawDFPosText(blob, runIndex, glyphCache, props, paint, scalerContextFlags, viewMatrix, text, byteLength, positions.begin(), 2, offset); } @@ -777,9 +769,6 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, const char* stop = text + byteLength; - SkPaint::Align align = dfPaint.getTextAlign(); - SkScalar alignMul = SkPaint::kCenter_Align == align ? SK_ScalarHalf : - (SkPaint::kRight_Align == align ? SK_Scalar1 : 0); while (text < stop) { const char* lastText = text; // the last 2 parameters are ignored @@ -787,9 +776,8 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, if (glyph.fWidth) { SkPoint glyphPos(offset); - glyphPos.fX += pos[0] - SkFloatToScalar(glyph.fAdvanceX) * alignMul * textRatio; - glyphPos.fY += (2 == scalarsPerPosition ? pos[1] : 0) - - SkFloatToScalar(glyph.fAdvanceY) * alignMul * textRatio; + glyphPos.fX += pos[0]; + glyphPos.fY += (2 == scalarsPerPosition ? pos[1] : 0); if (glyph.fMaskFormat == SkMask::kSDF_Format) { DfAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph, glyphPos.fX, diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp index 215951622c..29ee8f3eca 100644 --- a/src/xps/SkXPSDevice.cpp +++ b/src/xps/SkXPSDevice.cpp @@ -2137,8 +2137,7 @@ void SkXPSDevice::drawPosText(const void* text, size_t byteLen, SkFindAndPlaceGlyph::ProcessPosText( paint.getTextEncoding(), static_cast<const char*>(text), byteLen, - offset, SkMatrix::I(), pos, scalarsPerPos, paint.getTextAlign(), - cache.get(), processOneGlyph); + offset, SkMatrix::I(), pos, scalarsPerPos, cache.get(), processOneGlyph); if (xpsGlyphs.count() == 0) { return; diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp index 8dd5917326..ac13140507 100644 --- a/tests/DrawTextTest.cpp +++ b/tests/DrawTextTest.cpp @@ -88,29 +88,25 @@ DEF_TEST(DrawText, reporter) { SkPoint point = SkPoint::Make(25.0f + offsetX, 25.0f + offsetY); - for (int align = 0; align < SkPaint::kAlignCount; ++align) { - paint.setTextAlign(static_cast<SkPaint::Align>(align)); + for (unsigned int flags = 0; flags < (1 << 3); ++flags) { + static const unsigned int antiAliasFlag = 1; + static const unsigned int subpixelFlag = 1 << 1; + static const unsigned int lcdFlag = 1 << 2; - for (unsigned int flags = 0; flags < (1 << 3); ++flags) { - static const unsigned int antiAliasFlag = 1; - static const unsigned int subpixelFlag = 1 << 1; - static const unsigned int lcdFlag = 1 << 2; + paint.setAntiAlias(SkToBool(flags & antiAliasFlag)); + paint.setSubpixelText(SkToBool(flags & subpixelFlag)); + paint.setLCDRenderText(SkToBool(flags & lcdFlag)); - paint.setAntiAlias(SkToBool(flags & antiAliasFlag)); - paint.setSubpixelText(SkToBool(flags & subpixelFlag)); - paint.setLCDRenderText(SkToBool(flags & lcdFlag)); + // Test: drawText and drawPosText draw the same. + drawBG(&drawTextCanvas); + drawTextCanvas.drawText(c, 1, point.fX, point.fY, paint); - // Test: drawText and drawPosText draw the same. - drawBG(&drawTextCanvas); - drawTextCanvas.drawText(c, 1, point.fX, point.fY, paint); + drawBG(&drawPosTextCanvas); + drawPosTextCanvas.drawPosText(c, 1, &point, paint); - drawBG(&drawPosTextCanvas); - drawPosTextCanvas.drawPosText(c, 1, &point, paint); - - REPORTER_ASSERT(reporter, - compare(drawTextBitmap, drawTextRect, - drawPosTextBitmap, drawPosTextRect)); - } + REPORTER_ASSERT(reporter, + compare(drawTextBitmap, drawTextRect, + drawPosTextBitmap, drawPosTextRect)); } } } |