}
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());
}
}
// 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<const SkTextBlob> blob(builder.build());
+ REPORTER_ASSERT(reporter, blob->bounds().isEmpty());
+ }
}
private: