Fix anti aliasing rounded background
Reviewed By: shergin, achen1 Differential Revision: D7569885 fbshipit-source-id: 4bfb00485211417b475f14a92fd7b2e52a4b2ff6
This commit is contained in:
Родитель
e636eb60d7
Коммит
7500b3ec83
|
@ -343,6 +343,23 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||||
|| borderWidth.bottom > 0
|
|| borderWidth.bottom > 0
|
||||||
|| borderWidth.left > 0
|
|| borderWidth.left > 0
|
||||||
|| borderWidth.right > 0) {
|
|| borderWidth.right > 0) {
|
||||||
|
|
||||||
|
//If it's a full and even border draw inner rect path with stroke
|
||||||
|
final float fullBorderWidth = getFullBorderWidth();
|
||||||
|
if (borderWidth.top == fullBorderWidth &&
|
||||||
|
borderWidth.bottom == fullBorderWidth &&
|
||||||
|
borderWidth.left == fullBorderWidth &&
|
||||||
|
borderWidth.right == fullBorderWidth) {
|
||||||
|
if (fullBorderWidth > 0) {
|
||||||
|
int borderColor = getBorderColor(Spacing.ALL);
|
||||||
|
mPaint.setColor(ColorUtil.multiplyColorAlpha(borderColor, mAlpha));
|
||||||
|
mPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mPaint.setStrokeWidth(fullBorderWidth);
|
||||||
|
canvas.drawPath(mInnerClipPathForBorderRadius, mPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//In the case of uneven border widths/colors draw quadrilateral in each direction
|
||||||
|
else {
|
||||||
mPaint.setStyle(Paint.Style.FILL);
|
mPaint.setStyle(Paint.Style.FILL);
|
||||||
|
|
||||||
// Draw border
|
// Draw border
|
||||||
|
@ -379,8 +396,10 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||||
|
|
||||||
final boolean isColorStartDefined = isBorderColorDefined(Spacing.START);
|
final boolean isColorStartDefined = isBorderColorDefined(Spacing.START);
|
||||||
final boolean isColorEndDefined = isBorderColorDefined(Spacing.END);
|
final boolean isColorEndDefined = isBorderColorDefined(Spacing.END);
|
||||||
final boolean isDirectionAwareColorLeftDefined = isRTL ? isColorEndDefined : isColorStartDefined;
|
final boolean isDirectionAwareColorLeftDefined =
|
||||||
final boolean isDirectionAwareColorRightDefined = isRTL ? isColorStartDefined : isColorEndDefined;
|
isRTL ? isColorEndDefined : isColorStartDefined;
|
||||||
|
final boolean isDirectionAwareColorRightDefined =
|
||||||
|
isRTL ? isColorStartDefined : isColorEndDefined;
|
||||||
|
|
||||||
if (isDirectionAwareColorLeftDefined) {
|
if (isDirectionAwareColorLeftDefined) {
|
||||||
colorLeft = directionAwareColorLeft;
|
colorLeft = directionAwareColorLeft;
|
||||||
|
@ -449,7 +468,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||||
drawQuadrilateral(canvas, colorBottom, x1, y1, x2, y2, x3, y3, x4, y4);
|
drawQuadrilateral(canvas, colorBottom, x1, y1, x2, y2, x3, y3, x4, y4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче