Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuriy Budiyev committed Nov 30, 2017
1 parent cfbe535 commit 48a10a1
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,23 @@ private void invalidateDrawRect() {
}

private void invalidateDrawRect(int width, int height) {
int size;
float thickness;
if (mDrawBackgroundStroke) {
size = Math.round(
Math.max(mForegroundStrokePaint.getStrokeWidth(), mBackgroundStrokePaint.getStrokeWidth()));
thickness = Math.max(mForegroundStrokePaint.getStrokeWidth(), mBackgroundStrokePaint.getStrokeWidth());
} else {
size = Math.round(mForegroundStrokePaint.getStrokeWidth());
thickness = mForegroundStrokePaint.getStrokeWidth();
}
if (width > height) {
int space = (width - height) / 2;
mDrawRect.set(space + size / 2 + 1, size / 2 + 1, width - space - size / 2 - 1, height - size / 2 - 1);
float offset = (width - height) / 2f;
mDrawRect.set(offset + thickness / 2f + 1f, thickness / 2f + 1f, width - offset - thickness / 2f - 1f,
height - thickness / 2f - 1f);
} else if (width < height) {
int space = (height - width) / 2;
mDrawRect.set(size / 2 + 1, space + size / 2 + 1, width - size / 2 - 1, height - space - size / 2 - 1);
float offset = (height - width) / 2f;
mDrawRect.set(thickness / 2f + 1f, offset + thickness / 2f + 1f, width - thickness / 2f - 1f,
height - offset - thickness / 2f - 1f);
} else {
mDrawRect.set(size / 2 + 1, size / 2 + 1, width - size / 2 - 1, height - size / 2 - 1);
mDrawRect.set(thickness / 2f + 1f, thickness / 2f + 1f, width - thickness / 2f - 1f,
height - thickness / 2f - 1f);
}
}

Expand Down

0 comments on commit 48a10a1

Please sign in to comment.