add bounds to textblob
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2124113003
TBR=
Review-Url: https://codereview.chromium.org/2124113003
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index d58b3c9..d309839 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -2658,10 +2658,18 @@
runs.append(run);
iter.next();
}
+ SkRect bounds = fBlob->bounds();
result[SKDEBUGCANVAS_ATTRIBUTE_RUNS] = runs;
result[SKDEBUGCANVAS_ATTRIBUTE_X] = Json::Value(fXPos);
result[SKDEBUGCANVAS_ATTRIBUTE_Y] = Json::Value(fYPos);
+ result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(bounds);
result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = MakeJsonPaint(fPaint, urlDataManager);
+
+ SkString desc;
+ // make the bounds local by applying the x,y
+ bounds.offset(fXPos, fYPos);
+ result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, bounds)->c_str());
+
return result;
}
@@ -2679,17 +2687,20 @@
Json::Value coords = run[SKDEBUGCANVAS_ATTRIBUTE_COORDS];
SkScalar x = coords[0].asFloat();
SkScalar y = coords[1].asFloat();
+ SkRect bounds;
+ extract_json_rect(command[SKDEBUGCANVAS_ATTRIBUTE_COORDS], &bounds);
+
if (run.isMember(SKDEBUGCANVAS_ATTRIBUTE_POSITIONS)) {
Json::Value positions = run[SKDEBUGCANVAS_ATTRIBUTE_POSITIONS];
if (positions.size() > 0 && positions[0].isNumeric()) {
- SkTextBlobBuilder::RunBuffer buffer = builder.allocRunPosH(font, count, y);
+ SkTextBlobBuilder::RunBuffer buffer = builder.allocRunPosH(font, count, y, &bounds);
for (int j = 0; j < count; j++) {
buffer.glyphs[j] = glyphs[j].asUInt();
buffer.pos[j] = positions[j].asFloat();
}
}
else {
- SkTextBlobBuilder::RunBuffer buffer = builder.allocRunPos(font, count);
+ SkTextBlobBuilder::RunBuffer buffer = builder.allocRunPos(font, count, &bounds);
for (int j = 0; j < count; j++) {
buffer.glyphs[j] = glyphs[j].asUInt();
buffer.pos[j * 2] = positions[j][0].asFloat();
@@ -2698,7 +2709,7 @@
}
}
else {
- SkTextBlobBuilder::RunBuffer buffer = builder.allocRun(font, count, x, y);
+ SkTextBlobBuilder::RunBuffer buffer = builder.allocRun(font, count, x, y, &bounds);
for (int j = 0; j < count; j++) {
buffer.glyphs[j] = glyphs[j].asUInt();
}