SkMatrix44::postScale for SkM44

11 views
Skip to first unread message

Clark Kent

unread,
Sep 8, 2022, 1:48:42 AMSep 8
to skia-discuss
in the old code there is

SkMatrix44& SkMatrix44::postScale(SkScalar sx, SkScalar sy, SkScalar sz) {
    if (1 == sx && 1 == sy && 1 == sz) {
        return *this;
    }

    for (int i = 0; i < 4; i++) {
        fMat[i][0] *= sx;
        fMat[i][1] *= sy;
        fMat[i][2] *= sz;
    }
    this->recomputeTypeMask();
    return *this;
}


could the same be achieved by creating a scale M44 and then postConcat it?

eg

    SkM44* m44 = AsM44(matrix);
    m44->concat(m44, SkM44::Scale(sx, sy, sz));

Clark Kent

unread,
Sep 8, 2022, 1:49:19 AMSep 8
to skia-discuss
m44->postConcat(SkM44::Scale(sx, sy, sz));        *
Message has been deleted

Michael Ludwig

unread,
Sep 8, 2022, 10:20:40 AMSep 8
to skia-discuss
Yes that is equivalent. Alternatively it's the same as "SkM44::Scale(sx,sy,sz) * m44". A post operation applies the argument to the left of the caller, whereas a pre-operation applies to the right (assuming matrix multiplication is processed right-to-left in the expression).

Clark Kent

unread,
Sep 8, 2022, 10:56:50 PMSep 8
to skia-discuss
alright :)
Reply all
Reply to author
Forward
0 new messages