add screen margin to graph_dfb

This commit is contained in:
houzh 2023-04-12 09:58:19 +00:00
parent b088b6550a
commit 784e675587
3 changed files with 23 additions and 10 deletions

View File

@ -4,3 +4,11 @@ if(BUILD_EXAMPLES)
add_subdirectory(uidemo2) add_subdirectory(uidemo2)
endif(BUILD_EXAMPLES) endif(BUILD_EXAMPLES)
add_subdirectory(w9) add_subdirectory(w9)
add_subdirectory(curldownload)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/hui-er-pu)
add_subdirectory(hui-er-pu)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/wifiwpa)
add_subdirectory(wifiwpa)
endif()

View File

@ -17,7 +17,8 @@ CurlDownloader::CurlDownloader(){
struct itimerspec new_value={{0,0},{1,0}}; struct itimerspec new_value={{0,0},{1,0}};
mTimerFD = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC); mTimerFD = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
timerfd_settime(mTimerFD, 0, &new_value,nullptr); const int rc=timerfd_settime(mTimerFD, 0, &new_value,nullptr);
LOGD("timerfd_settime(%d) error:%d",mTimerFD,rc);
Looper::getDefault()->addFd(mTimerFD,0,Looper::EVENT_INPUT,TimerFDCallback,this); Looper::getDefault()->addFd(mTimerFD,0,Looper::EVENT_INPUT,TimerFDCallback,this);
} }

View File

@ -12,6 +12,7 @@ NGL_MODULE(GRAPH);
static IDirectFB *directfb=NULL; static IDirectFB *directfb=NULL;
static IDirectFBSurface*primarySurface; static IDirectFBSurface*primarySurface;
static IDirectFBDisplayLayer *primaryLayer; static IDirectFBDisplayLayer *primaryLayer;
static GFXRect screenMargin={60,0,60,0};
static void DFBDisplayLayerCBK(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc, void *callbackdata){ static void DFBDisplayLayerCBK(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc, void *callbackdata){
LOGD("Layer %d[%s] type:%x surface.caps=%x accessor=%x",layer_id,desc.name,desc.type,desc.surface_caps,desc.surface_accessor); LOGD("Layer %d[%s] type:%x surface.caps=%x accessor=%x",layer_id,desc.name,desc.type,desc.surface_caps,desc.surface_accessor);
@ -51,9 +52,10 @@ INT GFXGetDisplaySize(INT disp,UINT*width,UINT*height){
DFBDisplayLayerConfig dispCfg; DFBDisplayLayerConfig dispCfg;
GFXInit(); GFXInit();
primaryLayer->GetConfiguration(primaryLayer, &dispCfg ); primaryLayer->GetConfiguration(primaryLayer, &dispCfg );
*width=dispCfg.width; *width=dispCfg.width - screenMargin.x - screenMargin.w;
*height=dispCfg.height; *height=dispCfg.height- screenMargin.y - screenMargin.h;
LOGV("screensize=%d,%d",*width,*height); LOGV("screensize=%d,%d margin=(%d,%d,%d,%d)",*width,*height,
screenMargin.x,screenMargin.y,screenMargin.w,screenMargin.h);
return E_OK; return E_OK;
} }
@ -175,17 +177,19 @@ INT GFXBlit(HANDLE dstsurface,int dx,int dy,HANDLE srcsurface,const GFXRect*srcr
const int ox=dx,oy=dy; const int ox=dx,oy=dy;
switch(GFXGetRotation(0)){/*directfb's rotation is clockwise*/ switch(GFXGetRotation(0)){/*directfb's rotation is clockwise*/
case ROTATE_0 : dfbdst->SetBlittingFlags(dfbdst,DSBLIT_NOFX); case ROTATE_0 : dfbdst->SetBlittingFlags(dfbdst,DSBLIT_NOFX);
dx += screenMargin.x;
dy += screenMargin.y;
break; break;
case ROTATE_90: dx = oy; case ROTATE_90: dx = oy + screenMargin.x;
dy = dstheight -ox - rs.w; dy = dstheight -ox - rs.w -screenMargin.h;
dfbdst->SetBlittingFlags(dfbdst,DSBLIT_ROTATE90); dfbdst->SetBlittingFlags(dfbdst,DSBLIT_ROTATE90);
break; break;
case ROTATE_180:dx = dstwidth -ox -rs.w; case ROTATE_180:dx = dstwidth -ox -rs.w - screenMargin.w;
dy = dstheight-oy -rs.h; dy = dstheight-oy -rs.h - screenMargin.h;
dfbdst->SetBlittingFlags(dfbdst,DSBLIT_ROTATE180); dfbdst->SetBlittingFlags(dfbdst,DSBLIT_ROTATE180);
break; break;
case ROTATE_270:dx = dstwidth -oy -rs.h ; case ROTATE_270:dx = dstwidth -oy -rs.h -screenMargin.w;
dy = ox; dy = ox - screenMargin.y;
dfbdst->SetBlittingFlags(dfbdst,DSBLIT_ROTATE270); dfbdst->SetBlittingFlags(dfbdst,DSBLIT_ROTATE270);
break; break;
default: return E_ERROR; default: return E_ERROR;