请问直接调用surface c++层有拉伸的函数吗
我调用的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;
}
据我了解你的方法已经是按比例拉伸填满你的surface,我觉得是你的surface尺寸比hdmi小所有看上去没填满全屏,你试一下设置你的surface的尺寸。 非常感谢,确实是这样,问题解决了。
谢谢
页:
[1]