diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp index 2ccf26b1c6..7fd96ad8b2 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp @@ -403,8 +403,6 @@ SkRect SkTextBlobBuilder::TightRunBounds(const SkTextBlob::RunRecord& run) { } SkASSERT((void*)glyphPosX <= SkTextBlob::RunRecord::Next(&run)); - SkASSERT(run.positioning() == SkTextBlob::kHorizontal_Positioning || - (void*)glyphPosY <= SkTextBlob::RunRecord::Next(&run)); return bounds.makeOffset(run.offset().x(), run.offset().y()); } diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp index ec748e7744..2a74e5a2db 100644 --- a/tests/TextBlobTest.cpp +++ b/tests/TextBlobTest.cpp @@ -149,7 +149,22 @@ public: } // Implicit bounds - // FIXME: not supported yet. + + { + // Exercise the empty bounds path, and ensure that RunRecord-aligned pos buffers + // don't trigger asserts (http://crbug.com/542643). + SkPaint p; + p.setTextSize(0); + p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); + + const char* txt = "BOOO"; + const size_t len = strlen(txt); + const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(p, (int)len); + p.textToGlyphs(txt, len, buffer.glyphs); + memset(buffer.pos, 0, sizeof(SkScalar) * len * 2); + SkAutoTUnref blob(builder.build()); + REPORTER_ASSERT(reporter, blob->bounds().isEmpty()); + } } private: