Properly handle the negative scaling factor of canvas in VectorDrawable
Bug: 26489687
Change-Id: I91cce34759fbbac206cd59f4636fd92194396c87
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp
index 56cb104..793df92 100644
--- a/libs/hwui/VectorDrawable.cpp
+++ b/libs/hwui/VectorDrawable.cpp
@@ -407,8 +407,9 @@
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);