fix an uninint var

This commit is contained in:
houzh 2023-11-27 16:14:19 +08:00
parent a2246eb543
commit 12610644cf
4 changed files with 10 additions and 10 deletions

View File

@ -189,7 +189,6 @@ void LayerDrawable::LayerState::invalidateCache(){
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LayerDrawable::LayerDrawable():LayerDrawable(nullptr){
mSuspendChildInvalidation=false;
}
LayerDrawable::LayerDrawable(const std::vector<Drawable*>&drawables)
@ -204,19 +203,20 @@ LayerDrawable::LayerDrawable(const std::vector<Drawable*>&drawables)
refreshPadding();
}
std::shared_ptr<LayerDrawable::LayerState> LayerDrawable::createConstantState(LayerState* state){
return std::make_shared<LayerState>(state, this);
}
LayerDrawable::LayerDrawable(std::shared_ptr<LayerState>state){
mMutated = false;
mLayerState = createConstantState(state.get());
mSuspendChildInvalidation = false;
mLayerState = createConstantState(state.get(),nullptr);
if (mLayerState->mChildren.size()) {
ensurePadding();
refreshPadding();
}
}
std::shared_ptr<LayerDrawable::LayerState> LayerDrawable::createConstantState(LayerState* state,const AttributeSet*){
return std::make_shared<LayerState>(state, this);
}
void LayerDrawable::setLayerSize(int index, int w, int h){
ChildDrawable* childDrawable = mLayerState->mChildren.at(index);
childDrawable->mWidth = w;
@ -936,7 +936,7 @@ Drawable* LayerDrawable::getFirstNonNullDrawable()const{
Drawable*LayerDrawable::mutate(){
if (!mMutated && Drawable::mutate() == this) {
mLayerState = createConstantState(mLayerState.get());
mLayerState = createConstantState(mLayerState.get(),nullptr);
for (auto child:mLayerState->mChildren) {
Drawable*dr=child->mDrawable;
if (dr != nullptr) {

View File

@ -74,7 +74,7 @@ private:
ChildDrawable* createLayer(Drawable* dr);
Drawable*getFirstNonNullDrawable()const;
protected:
virtual std::shared_ptr<LayerState> createConstantState(LayerState* state);
virtual std::shared_ptr<LayerState> createConstantState(LayerState* state,const AttributeSet*);
void onBoundsChange(const Rect& bounds)override;
bool onLevelChange(int level)override;
bool onStateChange(const std::vector<int>& state)override;

View File

@ -45,7 +45,7 @@ TransitionDrawable::TransitionDrawable(std::shared_ptr<TransitionState> state)
mTransitionState=TRANSITION_NONE;
}
std::shared_ptr<LayerDrawable::LayerState> TransitionDrawable::createConstantState(LayerState* state){
std::shared_ptr<LayerDrawable::LayerState> TransitionDrawable::createConstantState(LayerState* state,const AttributeSet*attrs){
return std::make_shared<TransitionState>((TransitionState*) state, this);
}

View File

@ -23,7 +23,7 @@ private:
};
TransitionDrawable(std::shared_ptr<TransitionState> state);
std::shared_ptr<LayerDrawable::LayerState> createConstantState(LayerState* state)override;
std::shared_ptr<LayerDrawable::LayerState> createConstantState(LayerState* state,const AttributeSet*)override;
TransitionDrawable(Context*,const AttributeSet&);
public:
TransitionDrawable();