Add a short description for concat and setmatrix saying whether it's a translate or something else

Change-Id: I3bb849f9e09a71ad5609840420f8f8d803e56634
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315737
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
This commit is contained in:
Nathaniel Nifong 2020-09-08 16:07:32 -04:00 committed by Skia Commit-Bot
parent 759770666b
commit 2b1b2b2e8e

View File

@ -1104,10 +1104,32 @@ ConcatCommand::ConcatCommand(const SkMatrix& matrix) : INHERITED(kConcat_OpType)
void ConcatCommand::execute(SkCanvas* canvas) const { canvas->concat(fMatrix); }
namespace {
void writeMatrixType(SkJSONWriter& writer, const SkMatrix& m) {
switch (m.getType()) {
case SkMatrix::kTranslate_Mask:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (translate)");
break;
case SkMatrix::kScale_Mask:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (scale)");
break;
case SkMatrix::kAffine_Mask:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (rotation or skew)");
break;
case SkMatrix::kPerspective_Mask:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (perspective)");
break;
default:
break;
}
}
}
void ConcatCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const {
INHERITED::toJSON(writer, urlDataManager);
writer.appendName(DEBUGCANVAS_ATTRIBUTE_MATRIX);
MakeJsonMatrix(writer, fMatrix);
writeMatrixType(writer, fMatrix);
}
Concat44Command::Concat44Command(const SkM44& matrix) : INHERITED(kConcat44_OpType) {
@ -2067,4 +2089,5 @@ void SetMatrixCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManag
INHERITED::toJSON(writer, urlDataManager);
writer.appendName(DEBUGCANVAS_ATTRIBUTE_MATRIX);
MakeJsonMatrix(writer, fMatrix);
writeMatrixType(writer, fMatrix);
}