Skip to content

Commit

Permalink
changes required in code-review
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Jul 9, 2020
1 parent 40e940a commit cbc9f45
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private enum BorderStyle {
private @Nullable Path mOuterClipPathForBorderRadius;
private @Nullable Path mPathForBorderRadiusOutline;
private @Nullable Path mPathForBorder;
private Path mPathForSingleBorder = new Path();
private @Nullable Path mCenterDrawPath;
private @Nullable RectF mInnerClipTempRectForBorderRadius;
private @Nullable RectF mOuterClipTempRectForBorderRadius;
Expand Down Expand Up @@ -1100,6 +1101,7 @@ private void drawRectangularBackgroundWithBorders(Canvas canvas) {
colorTop,
colorRight,
colorBottom);

if (fastBorderColor != 0) {
if (Color.alpha(fastBorderColor) != 0) {
// Border color is not transparent.
Expand All @@ -1109,41 +1111,40 @@ private void drawRectangularBackgroundWithBorders(Canvas canvas) {
mPaint.setColor(fastBorderColor);
mPaint.setStyle(Paint.Style.STROKE);
if (borderLeft > 0) {
int leftInset = left + borderLeft;
Path path = new Path();
mPathForSingleBorder.reset();
int width = Math.round(borderWidth.left);
updatePathEffect(width);
mPaint.setStrokeWidth(width);
path.moveTo(left, top - borderWidth.top/2);
path.lineTo(left, bottom + borderWidth.bottom/2);
canvas.drawPath(path, mPaint);
mPathForSingleBorder.moveTo(left, top - borderWidth.top/2);
mPathForSingleBorder.lineTo(left, bottom + borderWidth.bottom/2);
canvas.drawPath(mPathForSingleBorder, mPaint);
}
if (borderTop > 0) {
Path path = new Path();
mPathForSingleBorder.reset();
int width = Math.round(borderWidth.top);
updatePathEffect(width);
mPaint.setStrokeWidth(width);
path.moveTo(left, top);
path.lineTo(right, top);
canvas.drawPath(path, mPaint);
mPathForSingleBorder.moveTo(left, top);
mPathForSingleBorder.lineTo(right, top);
canvas.drawPath(mPathForSingleBorder, mPaint);
}
if (borderRight > 0) {
Path path = new Path();
mPathForSingleBorder.reset();
int width = Math.round(borderWidth.right);
updatePathEffect(width);
mPaint.setStrokeWidth(width);
path.moveTo(right, top - borderWidth.top/2);
path.lineTo(right, bottom + borderWidth.bottom/2);
canvas.drawPath(path, mPaint);
mPathForSingleBorder.moveTo(right, top - borderWidth.top/2);
mPathForSingleBorder.lineTo(right, bottom + borderWidth.bottom/2);
canvas.drawPath(mPathForSingleBorder, mPaint);
}
if (borderBottom > 0) {
Path path = new Path();
mPathForSingleBorder.reset();
int width = Math.round(borderWidth.bottom);
updatePathEffect(width);
mPaint.setStrokeWidth(width);
path.moveTo(left, bottom);
path.lineTo(right, bottom);
canvas.drawPath(path, mPaint);
mPathForSingleBorder.moveTo(left, bottom);
mPathForSingleBorder.lineTo(right, bottom);
canvas.drawPath(mPathForSingleBorder, mPaint);
}
}
} else {
Expand Down

0 comments on commit cbc9f45

Please sign in to comment.