Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: tools/debugger/SkDrawCommand.cpp

Issue 2124113003: add bounds to textblob (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/debugger/SkDrawCommand.cpp
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 6c9287fa31d8c711948fd77a72aeb7bed721f6a6..d3d7cd8ffc645c0053dd98d8b5a1a2094503d372 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -2656,10 +2656,18 @@ Json::Value SkDrawTextBlobCommand::toJSON(UrlDataManager& urlDataManager) const
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;
}
@@ -2677,17 +2685,20 @@ SkDrawTextBlobCommand* SkDrawTextBlobCommand::fromJSON(Json::Value& command,
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();
@@ -2696,7 +2707,7 @@ SkDrawTextBlobCommand* SkDrawTextBlobCommand::fromJSON(Json::Value& command,
}
}
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698