modify gradientdrawable,fix some uninitialized vars

This commit is contained in:
houzh 2023-03-26 14:53:16 +00:00
parent 924b1342fb
commit 8168d688da
2 changed files with 9 additions and 10 deletions

View File

@ -22,6 +22,7 @@ int main(int argc,const char*argv[]){
pb->setSecondaryProgress(15);
w->addView(pb).setPos(50,50);
w->addView(pb2).setPos(50,100);
Runnable progress;
progress=[w,pb,pb2,&progress](){
pb->setSecondaryProgress((pb->getSecondaryProgress()+1)%100);
@ -60,7 +61,6 @@ int main(int argc,const char*argv[]){
//pb5->setProgressDrawable(new ColorDrawable(0xFF111111));
w->addView(pb5).setId(105).setPos(50,150);
//////////////////////////////////////////////////////////
#if 1
SeekBar*sb = new SeekBar(800,50);
SeekBar*sb2= new SeekBar(800,50);
@ -77,6 +77,5 @@ int main(int argc,const char*argv[]){
sb2->setMirrorForRtl(true);
w->addView(sb).setId(200).setPos(50,300).setKeyboardNavigationCluster(true);
w->addView(sb2).setId(201).setPos(50,380).setLayoutDirection(View::LAYOUT_DIRECTION_RTL);
#endif
return app.exec();
}

View File

@ -220,22 +220,22 @@ void GradientDrawable::GradientState::setGradientRadius(float gradientRadius,int
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GradientDrawable::GradientDrawable(){
mGradientState=std::make_shared<GradientState>();
mPadding.set(0,0,0,0);
mAlpha = 255;
GradientDrawable::GradientDrawable()
:GradientDrawable(std::make_shared<GradientState>()){
}
GradientDrawable::GradientDrawable(std::shared_ptr<GradientState>state){
mPathIsDirty = mGradientIsDirty =false;
mPadding.set(0,0,0,0);
mGradientState=state;
mMutated = false;
mGradientRadius=0;
mStrokeWidth =1.f;
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;
GradientDrawable::GradientDrawable(Orientation orientation,const std::vector<int>&colors)
:GradientDrawable(std::make_shared<GradientState>(orientation,colors)){
}
std::shared_ptr<Drawable::ConstantState>GradientDrawable::getConstantState(){