mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
fix an uninitialized var in gradientdrawable's mPadding
This commit is contained in:
parent
e30c477266
commit
924b1342fb
@ -138,7 +138,13 @@ int AttributeSet::getInt(const std::string&key,const std::map<const std::string,
|
||||
}
|
||||
|
||||
int AttributeSet::getResourceId(const std::string&key,int def)const{
|
||||
return getInt(key,def);
|
||||
const std::string str=getString(key);
|
||||
int value = def;
|
||||
if(!str.empty()){
|
||||
value = mContext->getId(str);
|
||||
return value==-1?def:value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
int AttributeSet::getColor(const std::string&key,int def)const{
|
||||
|
@ -495,7 +495,7 @@ static void endElement(void *userData, const XML_Char *name){
|
||||
ld->setLayerGravity(idx,atts.getGravity("gravity",Gravity::NO_GRAVITY));
|
||||
ld->setLayerWidth(idx,atts.getDimensionPixelOffset("width",-1));
|
||||
ld->setLayerHeight(idx,atts.getDimensionPixelOffset("height",-1));
|
||||
const int id = atts.getInt("id",-1);
|
||||
const int id = atts.getResourceId("id",-1);
|
||||
const std::string src = atts.getString("drawable");
|
||||
if(id!=-1)ld->setId(idx,id);
|
||||
LOGV("add drawable %p to LayerDrawable %p index=%d id=%d gravity=%x size=%dx%d",topchild,
|
||||
|
@ -5,9 +5,10 @@
|
||||
namespace cdroid{
|
||||
|
||||
DrawableWrapper::DrawableWrapperState::DrawableWrapperState(){
|
||||
mDrawableState=nullptr;
|
||||
mDensity = DisplayMetrics::DENSITY_DEFAULT;
|
||||
mSrcDensityOverride =0;
|
||||
mDrawableState = nullptr;
|
||||
mSrcDensityOverride = 0;
|
||||
mChangingConfigurations =0;
|
||||
}
|
||||
|
||||
DrawableWrapper::DrawableWrapperState::DrawableWrapperState(const DrawableWrapperState& orig){
|
||||
|
@ -222,16 +222,19 @@ void GradientDrawable::GradientState::setGradientRadius(float gradientRadius,int
|
||||
|
||||
GradientDrawable::GradientDrawable(){
|
||||
mGradientState=std::make_shared<GradientState>();
|
||||
mPadding.set(0,0,0,0);
|
||||
mAlpha = 255;
|
||||
}
|
||||
|
||||
GradientDrawable::GradientDrawable(std::shared_ptr<GradientState>state){
|
||||
mPadding.set(0,0,0,0);
|
||||
mGradientState=state;
|
||||
mAlpha = 255;
|
||||
}
|
||||
|
||||
GradientDrawable::GradientDrawable(Orientation orientation,const std::vector<int>&colors){
|
||||
mGradientState=std::make_shared<GradientState>(orientation,colors);
|
||||
mPadding.set(0,0,0,0);
|
||||
mAlpha = 255;
|
||||
}
|
||||
|
||||
|
@ -649,11 +649,11 @@ void ProgressBar::updateDrawableBounds(int w,int h){
|
||||
h -= mPaddingTop + mPaddingBottom;
|
||||
int right = w;
|
||||
int bottom = h;
|
||||
int top = 0;
|
||||
int left = 0;
|
||||
|
||||
LOGV("mIndeterminateDrawable=%p,mOnlyIndeterminate=%d",mIndeterminateDrawable,mOnlyIndeterminate);
|
||||
if (mIndeterminateDrawable) {
|
||||
int top = 0;
|
||||
int left = 0;
|
||||
// Aspect ratio logic does not apply to AnimationDrawables
|
||||
if (mOnlyIndeterminate && !(dynamic_cast<AnimationDrawable*>(mIndeterminateDrawable))) {
|
||||
// Maintain aspect ratio. Certain kinds of animated drawables
|
||||
@ -687,7 +687,7 @@ void ProgressBar::updateDrawableBounds(int w,int h){
|
||||
}
|
||||
|
||||
if (mProgressDrawable != nullptr) {
|
||||
mProgressDrawable->setBounds(0, 0, right, bottom);
|
||||
mProgressDrawable->setBounds(0, 0, right-left, bottom-top);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user