From 47f148564d1cbca5304e5bcb9f47284555ae5344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0egina?= Date: Tue, 26 Sep 2017 11:19:30 +0100 Subject: Fix clip expansion amount The clipping rectangle needs to be expanded in order to cover the content drawn by the stroke. Since half the stroke is drawn on one side of the bounding rectangle and the other half on the other side, we need to expand the clip by half of the stroke width. The previous implementation expanded the clipping rectangle by the whole stroke width, this allowed for a part of the rounded rectangle to draw outside of the bounding box. Test: manual - verify smart select still works and that the rounded rectangle does not draw outside of the bounding box Change-Id: I8ca80b7b224d1ac2aa7638405b3cf516bd04b39f --- core/java/android/widget/SmartSelectSprite.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/java/android/widget/SmartSelectSprite.java') diff --git a/core/java/android/widget/SmartSelectSprite.java b/core/java/android/widget/SmartSelectSprite.java index 27b93bc74969..0b3aac8a257d 100644 --- a/core/java/android/widget/SmartSelectSprite.java +++ b/core/java/android/widget/SmartSelectSprite.java @@ -173,7 +173,7 @@ final class SmartSelectSprite { canvas.save(); mClipRect.set(mBoundingRectangle); - mClipRect.inset(-mStrokeWidth, -mStrokeWidth); + mClipRect.inset(-mStrokeWidth / 2, -mStrokeWidth / 2); canvas.clipRect(mClipRect); canvas.drawRoundRect(mDrawRect, adjustedCornerRadius, adjustedCornerRadius, paint); canvas.restore(); -- cgit v1.2.3