add some debug message

This commit is contained in:
侯歌 2024-05-11 10:50:37 +08:00
parent 43b7a6f586
commit e03e9fd8de
2 changed files with 14 additions and 2 deletions

View File

@ -80,7 +80,6 @@ BitmapDrawable::BitmapDrawable(Context*ctx,const std::string&resname)
:BitmapDrawable(std::make_shared<BitmapState>()){
std::ifstream fs(resname,std::ios::binary);
RefPtr<ImageSurface>b;
LOGV("%s",resname.c_str());
mBitmapState->mResource = resname;
if((ctx==nullptr)||fs.good()){
b = ImageSurface::create_from_stream(fs);
@ -88,6 +87,19 @@ BitmapDrawable::BitmapDrawable(Context*ctx,const std::string&resname)
b = ctx->loadImage(resname);
}
setBitmap(b);
#if defined(DEBUG) && ( defined(__x86_64__) || defined(__i386__) )
const char*tNames[] = {"UNKNOWN","TRANSLUCENT","TRANSPARENT","OPAQUE"};
DisplayMetrics dm = ctx->getDisplayMetrics();
const size_t fullScreenSize=dm.widthPixels*dm.heightPixels;
const size_t bitmapSize = b->get_width()*b->get_height();
char mime[32] = {0};
size_t len = 0;
b->get_mime_data(mime,len);
LOGD_IF( ( (mBitmapState->mTransparency!=PixelFormat::OPAQUE)&&(bitmapSize>=fullScreenSize/4) )
|| (b->get_stride()<b->get_width()*4),
"is %-12s bpp:%d %s/%d '%s' maby cause compose more slowly" , tNames[mBitmapState->mTransparency],
b->get_stride()/b->get_width(), mime,len,mBitmapState->mResource.c_str());
#endif
}
BitmapDrawable::~BitmapDrawable(){

View File

@ -600,7 +600,7 @@ float MotionEvent::getHistoricalAxisValue(int axis,size_t pointerIndex,size_t hi
}
float MotionEvent::getHistoricalX(size_t pointerIndex, size_t historicalIndex) const{
return getHistoricalRawAxisValue(AXIS_X, pointerIndex, historicalIndex);
return getHistoricalRawAxisValue(AXIS_X, pointerIndex, historicalIndex);
}
float MotionEvent::getHistoricalY(size_t pointerIndex, size_t historicalIndex) const{