Skip to content

Commit

Permalink
优化绘制圆角代码
Browse files Browse the repository at this point in the history
  • Loading branch information
KaraShok committed Jan 18, 2021
1 parent 46340a3 commit 057e8ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ public void getOutline(final View view, final Outline outline) {
if(mRect!=null){
selfRect = mRect;
}else{
Rect rect = new Rect();
view.getDrawingRect(rect);
selfRect = RectUtils.getOvalRect(rect);
selfRect = new Rect();
view.getDrawingRect(selfRect);
}
outline.setOval(selfRect);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public ViewRoundRectOutlineProvider(float radius, Rect rect) {

@Override
public void getOutline(View view, Outline outline) {
Rect rect = new Rect();
view.getDrawingRect(rect);
Rect rect;
if(mRect!=null){
rect = mRect;
}else {
rect = new Rect();
view.getDrawingRect(rect);
}
outline.setRoundRect(rect, mRadius);
}
Expand Down

0 comments on commit 057e8ce

Please sign in to comment.