mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-02 12:17:46 +08:00
fix gradientdrawable's stroke width error
This commit is contained in:
parent
e68199578a
commit
5a107b8b61
@ -399,6 +399,7 @@ void GradientDrawable::setSize(int width, int height) {
|
|||||||
mGradientState->setSize(width, height);
|
mGradientState->setSize(width, height);
|
||||||
mPathIsDirty = true;
|
mPathIsDirty = true;
|
||||||
invalidateSelf();
|
invalidateSelf();
|
||||||
|
LOGV("%p setSize(%d,%d)",this,width,height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GradientDrawable::setGradientType(int gradient) {
|
void GradientDrawable::setGradientType(int gradient) {
|
||||||
@ -587,7 +588,7 @@ bool GradientDrawable::ensureValidRect(){
|
|||||||
Rect bounds = getBounds();
|
Rect bounds = getBounds();
|
||||||
float inset = 0;
|
float inset = 0;
|
||||||
|
|
||||||
if (mStrokePaint)inset = mStrokeWidth;//mStrokePaint.getStrokeWidth() * 0.5f;
|
if (mStrokePaint)inset = mStrokeWidth*0.5f;
|
||||||
|
|
||||||
GradientState&st =*mGradientState;
|
GradientState&st =*mGradientState;
|
||||||
mRect.set(bounds.left + inset, bounds.top + inset, bounds.width - 2*inset, bounds.height - 2*inset);
|
mRect.set(bounds.left + inset, bounds.top + inset, bounds.width - 2*inset, bounds.height - 2*inset);
|
||||||
@ -775,7 +776,7 @@ void GradientDrawable::draw(Canvas&canvas){
|
|||||||
0,M_PI*2.f*(st->mUseLevel?(float)getLevel()/10000.f:1));
|
0,M_PI*2.f*(st->mUseLevel?(float)getLevel()/10000.f:1));
|
||||||
canvas.line_to(0,0);LOGD("useLevel=%d lvl=%d",st->mUseLevel,getLevel());
|
canvas.line_to(0,0);LOGD("useLevel=%d lvl=%d",st->mUseLevel,getLevel());
|
||||||
#else
|
#else
|
||||||
LOGV("radius=%f",(float)st->mRadius);
|
LOGV("%p size=%.fx%.f radius=%f strokewidth=%d",this,mRect.width,mRect.height,(float)st->mRadius,st->mStrokeWidth);
|
||||||
canvas.move_to(mRect.left+mRect.width/2.f,mRect.top+mRect.height/2.f);
|
canvas.move_to(mRect.left+mRect.width/2.f,mRect.top+mRect.height/2.f);
|
||||||
canvas.arc(mRect.left+mRect.width/2.f,mRect.top+mRect.height/2.f,
|
canvas.arc(mRect.left+mRect.width/2.f,mRect.top+mRect.height/2.f,
|
||||||
std::min(mRect.width,mRect.height)/2.f,
|
std::min(mRect.width,mRect.height)/2.f,
|
||||||
|
Loading…
Reference in New Issue
Block a user