|
请问直接调用surface c++层有拉伸的函数吗
发表于 2015-8-6 19:37:19
浏览:7450
|
回复:2
打印
只看该作者
[复制链接]
楼主
我调用的surface c++层接口来直接显示的yuv数据,设置的hdmi分辨率与显示的图片分辨率一致时,显示正常,如果设置的hdmi分辨率大于要显示的图片分辨率时,就会出现不能填满全屏,这种情况应该需要拉伸是吗,请问surface里有拉伸的函数吗?
谢谢
static RK_S32 surface_init()
{
if (init_flag == 0)
{
DisplayInfo dinfo;
// create a client to surfaceflinger
client = new SurfaceComposerClient();
sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay(
ISurfaceComposer::eDisplayIdMain));
//获取屏幕的宽高等信息
status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo);
SHOW_YUV_LOGI("w=%d,h=%d,xdpi=%f,ydpi=%f,fps=%f,ds=%f\n",
dinfo.w, dinfo.h, dinfo.xdpi, dinfo.ydpi, dinfo.fps, dinfo.density);
if (status)
return -1;
//创建surface
surfaceControl = client->createSurface(String8("surface"),
dinfo.w, dinfo.h, PIXEL_FORMAT_RGBA_8888, 0);
init_flag = 1;
}
return 0;
}
RK_S32 show_yuv(RK_U8 *yuv_data, RK_U32 frameSize, jpeg_info jpg_info)
{
if (yuv_data == NULL)
{
SHOW_YUV_LOGW("input yuv_data is null\n");
return -1;
}
surface_init();
/*********************配置surface************************************/
SurfaceComposerClient:penGlobalTransaction();
surfaceControl->setLayer(100000);//设定Z坐标
SHOW_YUV_LOGI("left:%d top:%d\n", jpg_info.left, jpg_info.top);
surfaceControl->setPosition(jpg_info.left+jpg_info.width, jpg_info.top+jpg_info.height);//设定显示位置
surfaceControl->setSize(jpg_info.width, jpg_info.height);//设定视频显示大小
surfaceControl->setMatrix(-1, 0, 0, -1); //旋转180度
SurfaceComposerClient::closeGlobalTransaction();
sp<Surface> surface = surfaceControl->getSurface();
/**********************显示yuv数据*****************************************/
render(yuv_data,frameSize,surface,jpg_info.width,jpg_info.height); //这个函数的实现没有贴出来
return 0;
}
|
|