本文整理汇总了C++中IDirectFB::EnumDisplayLayers方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFB::EnumDisplayLayers方法的具体用法?C++ IDirectFB::EnumDisplayLayers怎么用?C++ IDirectFB::EnumDisplayLayers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFB
的用法示例。
在下文中一共展示了IDirectFB::EnumDisplayLayers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: list_layers
int list_layers() {
IDirectFB *dfb = NULL;
//IDirectFBSurface *surface = NULL;
//IDirectFBLayer *layer = NULL;
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb, dfb->Release);
DFBCHECK(dfb->EnumDisplayLayers(dfb, layer_cb, dfb));
sleep(1);
release_all();
return 0;
}
示例2: CreateYUVSurface
static DFBResult CreateYUVSurface(_THIS, struct private_yuvhwdata *hwdata,
int width, int height, Uint32 format)
{
DFBResult ret;
IDirectFB *dfb = HIDDEN->dfb;
IDirectFBDisplayLayer *layer;
DFBDisplayLayerConfig conf;
ret = dfb->EnumDisplayLayers (dfb, enum_layers_callback, hwdata);
if (ret)
{
SetDirectFBerror("IDirectFB::EnumDisplayLayers", ret);
return ret;
}
if (!hwdata->layer_id)
return DFB_UNSUPPORTED;
ret = dfb->GetDisplayLayer (dfb, hwdata->layer_id, &layer);
if (ret)
{
SetDirectFBerror("IDirectFB::GetDisplayLayer", ret);
return ret;
}
conf.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
conf.width = width;
conf.height = height;
switch (format)
{
case SDL_YV12_OVERLAY:
conf.pixelformat = DSPF_YV12;
break;
case SDL_IYUV_OVERLAY:
conf.pixelformat = DSPF_I420;
break;
case SDL_YUY2_OVERLAY:
conf.pixelformat = DSPF_YUY2;
break;
case SDL_UYVY_OVERLAY:
conf.pixelformat = DSPF_UYVY;
break;
default:
fprintf (stderr, "SDL_DirectFB: Unsupported YUV format (0x%08x)!\n", format);
break;
}
/* Need to set coop level or newer DirectFB versions will fail here. */
ret = layer->SetCooperativeLevel (layer, DLSCL_ADMINISTRATIVE);
if (ret)
{
SetDirectFBerror("IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret);
layer->Release (layer);
return ret;
}
ret = layer->SetConfiguration (layer, &conf);
if (ret)
{
SetDirectFBerror("IDirectFBDisplayLayer::SetConfiguration", ret);
layer->Release (layer);
return ret;
}
ret = layer->GetSurface (layer, &hwdata->surface);
if (ret)
{
SetDirectFBerror("IDirectFBDisplayLayer::GetSurface", ret);
layer->Release (layer);
return ret;
}
hwdata->layer = layer;
return DFB_OK;
}