fix cdlogs' warnings,modify 9patch drawing

This commit is contained in:
houzh 2022-02-18 13:21:07 +00:00
parent 7899f6323c
commit 25f5f82067
4 changed files with 14 additions and 12 deletions

View File

@ -314,8 +314,9 @@ Drawable* Assets::getDrawable(const std::string&fullresid){
return d;
}
#pragma GCC push_options
#pragma GCC optimize("O0")
//#pragma GCC push_options
//#pragma GCC optimize("O0")
//codes between pragma will crashed in ubuntu GCC V8.x,bus GCC V7 wroked well.
int Assets::getColor(const std::string&refid){
std::string pkg,name=refid;
parseResource(name,nullptr,&pkg);
@ -422,7 +423,7 @@ int Assets::loadKeyValues(const std::string&fullresid,std::function<void(const s
} while(len!=0);
XML_ParserFree(parser);
}
#pragma GCC pop_options
//#pragma GCC pop_options
void Assets::clearStyles(){
mStyles.clear();

View File

@ -40,8 +40,9 @@ int UIEventSource::handleEvents(){
return 0;
}
#pragma GCC push_options
#pragma GCC optimize("O0")
//#pragma GCC push_options
//#pragma GCC optimize("O0")
//codes between pragma will crashed in ubuntu GCC V8.x,bus GCC V7 wroked well.
bool UIEventSource::post(Runnable& run,uint32_t delayedtime){
RUNNER runner;
runner.removed=false;
@ -57,7 +58,7 @@ bool UIEventSource::post(Runnable& run,uint32_t delayedtime){
}
mRunnables.push_back(runner);
}
#pragma GCC pop_options
//#pragma GCC pop_options
bool UIEventSource::hasDelayedRunners()const{
if(mRunnables.empty())return false;

View File

@ -279,11 +279,11 @@ int NinePatchDrawable::NinePatchState::get_ninepatch(std::vector<DIV>&divHorz,st
next=get_pixel(mNinePatch,x+1,edge);
if(isStretchableMarker(last)!=isStretchableMarker(next)||(x==width-2)){
bool stretchable=isStretchableMarker(last);
int len=x-pos+(x<width-2);
int len=x + 1 - pos;
DIV d={pos,len,stretchable};
divHorz.push_back(d);
if(stretchable)horz_stretch+=len;
last=next;pos=x;
last=next; pos=x+1;
}
}
//vert streatch infos
@ -294,12 +294,11 @@ int NinePatchDrawable::NinePatchState::get_ninepatch(std::vector<DIV>&divHorz,st
next=get_pixel(mNinePatch,edge,y+1);
if(isStretchableMarker(last)!=isStretchableMarker(next)||(y==height-2)){
bool stretchable = isStretchableMarker(last);
int len = y - pos+(y<height-2);
int len = y + 1 - pos;
DIV d={pos,len,stretchable};
divVert.push_back(d);
if (stretchable)vert_stretch += len;
last = next;
pos = y;
last = next; pos = y+1;
}
}
return horz_stretch<<16|vert_stretch;
@ -349,6 +348,7 @@ void NinePatchDrawable::NinePatchState::draw(Canvas&canvas,const Rect&rect){
}
RECT rd={dx0,dy0,dx1-dx0+1,dy1-dy0+1};
RECT rs={sx0, sy0,mHorz[j].len,mVert[i].len};
LOGV("rs=(%d,%d,%d,%d)",rs.left,rs.top,rs.width,rs.height);
rd.offset(rect.left,rect.top);
canvas.draw_image(mNinePatch,rd,&rs);
dx0=dx1;

View File

@ -49,7 +49,7 @@ static void LogInit(){
std::string msg;
if(dbgMessages.size()==0)dbgMessages.wait_and_pop(msg,INT_MAX);
else dbgMessages.try_and_pop(msg);
printf(msg.c_str());
printf("%s",msg.c_str());
}
});th.detach();
});