Fix bound rectangle calculation in SkiaCanvasProxy::onDrawPosText
SkiaCanvasProxy::onDrawPosText was calculating wrong bound rectangle,
because the initial rectangle used to accumulate the result was not
initialized.
bug: 30357689
Change-Id: I2c2afd4645237c50a3fcf2bbd99ae1ce2cd911c1
diff --git a/libs/hwui/SkiaCanvasProxy.cpp b/libs/hwui/SkiaCanvasProxy.cpp
index f264a35..ec4defe 100644
--- a/libs/hwui/SkiaCanvasProxy.cpp
+++ b/libs/hwui/SkiaCanvasProxy.cpp
@@ -323,9 +323,9 @@
// by Minikin then it had already computed these bounds. Unfortunately,
// there is no way to capture those bounds as part of the Skia drawPosText
// API so we need to do that computation again here.
- SkRect bounds;
+ SkRect bounds = SkRect::MakeEmpty();
for (int i = 0; i < glyphs.count; i++) {
- SkRect glyphBounds;
+ SkRect glyphBounds = SkRect::MakeEmpty();
glyphs.paint.measureText(&glyphs.glyphIDs[i], sizeof(uint16_t), &glyphBounds);
glyphBounds.offset(pos[i].fX, pos[i].fY);
bounds.join(glyphBounds);