Index: src/gpu/batches/GrAAFillRectBatch.cpp |
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp |
index 859328af3b369528aa075f5b30eae75521ac05c6..2c90b8bcf2e06558dbb8d68ecc3d721363a1cc00 100644 |
--- a/src/gpu/batches/GrAAFillRectBatch.cpp |
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp |
@@ -84,10 +84,12 @@ static void generate_aa_fill_rect_geometry(intptr_t verts, |
SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts); |
SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vertexStride); |
- SkScalar inset = SkMinScalar(devRect.width(), SK_Scalar1); |
- inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height()); |
+ SkScalar inset; |
if (viewMatrix.rectStaysRect()) { |
+ inset = SkMinScalar(devRect.width(), SK_Scalar1); |
+ inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height()); |
+ |
set_inset_fan(fan0Pos, vertexStride, devRect, -SK_ScalarHalf, -SK_ScalarHalf); |
set_inset_fan(fan1Pos, vertexStride, devRect, inset, inset); |
} else { |
@@ -97,11 +99,14 @@ static void generate_aa_fill_rect_geometry(intptr_t verts, |
{ viewMatrix[SkMatrix::kMSkewX], viewMatrix[SkMatrix::kMScaleY] } |
}; |
- vec[0].normalize(); |
+ SkScalar len1 = SkPoint::Normalize(&vec[0]); |
vec[0].scale(SK_ScalarHalf); |
- vec[1].normalize(); |
+ SkScalar len2 = SkPoint::Normalize(&vec[1]); |
vec[1].scale(SK_ScalarHalf); |
+ inset = SkMinScalar(len1 * rect.width(), SK_Scalar1); |
+ inset = SK_ScalarHalf * SkMinScalar(inset, len2 * rect.height()); |
+ |
// create the rotated rect |
fan0Pos->setRectFan(rect.fLeft, rect.fTop, |
rect.fRight, rect.fBottom, vertexStride); |