Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e410a357 authored by Doris Liu's avatar Doris Liu
Browse files

Properly handle the negative scaling factor of canvas in VectorDrawable

Bug: 26489687
Change-Id: I91cce34759fbbac206cd59f4636fd92194396c87
parent f56a60fa
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -407,8 +407,9 @@ void Tree::draw(Canvas* outCanvas, SkColorFilter* colorFilter,
    float canvasScaleY = 1.0f;
    if (mCanvasMatrix.getSkewX() == 0 && mCanvasMatrix.getSkewY() == 0) {
        // Only use the scale value when there's no skew or rotation in the canvas matrix.
        canvasScaleX = mCanvasMatrix.getScaleX();
        canvasScaleY = mCanvasMatrix.getScaleY();
        // TODO: Add a cts test for drawing VD on a canvas with negative scaling factors.
        canvasScaleX = fabs(mCanvasMatrix.getScaleX());
        canvasScaleY = fabs(mCanvasMatrix.getScaleY());
    }
    int scaledWidth = (int) (mBounds.width() * canvasScaleX);
    int scaledHeight = (int) (mBounds.height() * canvasScaleY);