本文整理汇总了C++中IDirectFB类的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFB类的具体用法?C++ IDirectFB怎么用?C++ IDirectFB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDirectFB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSerialNumber
void QDirectFBPixmapData::resize(int width, int height)
{
if (width <= 0 || height <= 0) {
setSerialNumber(0);
return;
}
IDirectFB *dfb = QDirectFBScreen::instance()->dfb();
if (!dfb)
qFatal("QDirectFBPixmapData::resize(): "
"Unable to get DirectFB handle!");
DFBSurfaceDescription description;
description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH |
DSDESC_HEIGHT);
description.width = width;
description.height = height;
DFBResult result = dfb->CreateSurface(dfb, &description, &surface);
if (result != DFB_OK) {
DirectFBErrorFatal("QDirectFBPixmapData::resize(): "
"Unable to allocate surface", result);
}
setSerialNumber(++global_ser_no);
}
示例2: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
IDirectFB *dfb;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: DirectFBCreate() failed!\n" );
return ret;
}
/* Required for keyboard access */
dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
TestResize( dfb );
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}
示例3: testing_multicore
int testing_multicore() {
IDirectFB *dfb = NULL;
IDirectFBSurface *surface = NULL;
DFBSurfaceDescription dsc;
pid_t n_pid = fork();
if (n_pid) {
sleep(1);
}
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb, dfb->Release);
DFBCHECK(dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &surface ));
push_release(surface, surface->Release);
if (!n_pid) {
sleep(1);
}
sleep(2);
//DFBCHECK(surface->Release(surface));
//DFBCHECK(dfb->Release(dfb));
release_all();
if (n_pid) {
wait(NULL);
}
return 0;
}
示例4: Q_ASSERT
bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription)
{
IDirectFB *dfb = screen->dfb();
Q_ASSERT(dfb);
DFBResult result = DFB_OK;
IDirectFBDataBuffer *dataBufferPtr;
if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result);
return false;
}
QDirectFBPointer<IDirectFBDataBuffer> dataBuffer(dataBufferPtr);
IDirectFBImageProvider *providerPtr;
if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK)
return false;
QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr);
DFBImageDescription imageDescription;
result = provider->GetImageDescription(provider.data(), &imageDescription);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result);
return false;
}
if (imageDescription.caps & DICAPS_COLORKEY) {
return false;
}
DFBSurfaceDescription surfaceDescription;
if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result);
return false;
}
alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height),
imageFormat, QDirectFBScreen::TrackSurface);
result = provider->RenderTo(provider.data(), dfbSurface, 0);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result);
return false;
}
w = surfaceDescription.width;
h = surfaceDescription.height;
is_null = (w <= 0 || h <= 0);
d = QDirectFBScreen::depth(imageFormat);
setSerialNumber(++global_ser_no);
#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
screen->setDirectFBImageProvider(providerPtr);
provider.take();
#endif
return true;
}
示例5: get_display_layer_window
int get_display_layer_window() {
IDirectFB *dfb = NULL;
IDirectFBDisplayLayer *layer = NULL;
IDirectFBWindow *window = NULL;
DFBWindowDescription desc;
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb,dfb->Release);
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
push_release(layer, layer->Release);
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
desc.posx = desc.posy = desc.width = desc.height = 20;
DFBCHECK(layer->CreateWindow(layer, &desc, &window));
push_release(window, window->Release);
/* check window */
release_all();
return 0;
}
示例6: OpenDisplay
static int OpenDisplay(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
DFBSurfaceDescription dsc;
/*dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH;*/
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
/*dsc.width = 352;*/
/*dsc.height = 240;*/
IDirectFB *directfb = NULL;
if (DirectFBCreate(&directfb) != DFB_OK || !directfb)
return VLC_EGENERIC;
sys->directfb = directfb;
IDirectFBSurface *primary = NULL;
if (directfb->CreateSurface(directfb, &dsc, &primary) || !primary)
return VLC_EGENERIC;
sys->primary = primary;
primary->GetSize(primary, &sys->width, &sys->height);
primary->GetPixelFormat(primary, &sys->pixel_format);
primary->FillRectangle(primary, 0, 0, sys->width, sys->height);
primary->Flip(primary, NULL, 0);
return VLC_SUCCESS;
}
示例7: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
IDirectFB *dfb;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Init: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Init: DirectFBCreate() failed!\n" );
return ret;
}
/* Shutdown DirectFB. */
ret = dfb->Release( dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Init: IDirectFB::Release() failed!\n" );
return ret;
}
return 0;
}
示例8: main
int
main( int argc, char** argv )
{
IDirectFB *dfb = NULL;
ISaWMan *saw = NULL;
ISaWManManager *manager = NULL;
D_INFO( "SaWMan/Sample1: Initializing...\n" );
CHECK( DirectFBInit( &argc, &argv ) );
CHECK( DirectFBCreate( &dfb ) );
CHECK( SaWManCreate( &saw ) );
CHECK( saw->CreateManager( saw, &callbacks, NULL, &manager ) );
pause();
out:
D_INFO( "SaWMan/Sample1: Shutting down...\n" );
if (manager)
manager->Release( manager );
if (saw)
saw->Release( saw );
if (dfb)
dfb->Release( dfb );
return 0;
}
示例9:
DFBImageProvider::DFBImageProvider(const char* mrl) {
IDirectFB* dfb = NULL;
decoder = NULL;
if (mrl != NULL) {
dfb = (IDirectFB*)(LocalDeviceManager::getInstance()->getGfxRoot());
DFBCHECK(dfb->CreateImageProvider(dfb, mrl, &decoder));
}
}
示例10: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
int i;
IDirectFB *dfb;
DFBInputDeviceID device_id = 0;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Input: DirectFBInit() failed!\n" );
return ret;
}
/* Parse arguments. */
for (i=1; i<argc; i++) {
const char *arg = argv[i];
if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0)
return print_usage( argv[0] );
else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
fprintf (stderr, "dfbtest_input version %s\n", DIRECTFB_VERSION);
return false;
}
else if (strcmp (arg, "-d") == 0 || strcmp (arg, "--device") == 0) {
if (++i == argc) {
print_usage (argv[0]);
return false;
}
if (!parse_id( argv[i], &device_id ))
return false;
}
else
return print_usage( argv[0] );
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Input: DirectFBCreate() failed!\n" );
return ret;
}
Test_Sensitivity( dfb, device_id );
/* Shutdown DirectFB. */
ret = dfb->Release( dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Input: IDirectFB::Release() failed!\n" );
return ret;
}
return 0;
}
示例11: main
int
main( int argc, char *argv[] )
{
int i;
DFBResult ret;
IDirectFB *dfb;
IDirectFBDisplayLayer *layer = NULL;
App apps[1];
DFBDisplayLayerConfig config;
/* Parse arguments. */
for (i=1; i<argc; i++) {
if (!strcmp( argv[i], "-h" ))
return show_usage( argv[0] );
}
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: DirectFBCreate() failed!\n" );
return ret;
}
/* Get primary layer. */
ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: IDirectFB::GetDisplayLayer( PRIMARY ) failed!\n" );
goto out;
}
layer->GetConfiguration( layer, &config );
app_init( &apps[0], layer, 100, 50, config.width-300, config.height-150, 0 );
while (true) {
direct_thread_sleep( 1000000 );
app_update( &apps[0] );
}
out:
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}
示例12: CloseDisplay
static void CloseDisplay(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
IDirectFBSurface *primary = sys->primary;
if (primary)
primary->Release(primary);
IDirectFB *directfb = sys->directfb;
if (directfb)
directfb->Release(directfb);
}
示例13:
DFBFontProvider::DFBFontProvider(const char* fontUri, int heightInPixel) {
IDirectFB* dfb;
DFBFontDescription desc;
dfb = (IDirectFB*)(LocalDeviceManager::getInstance()->getGfxRoot());
desc.flags = (DFBFontDescriptionFlags)(
DFDESC_HEIGHT | DFDESC_ATTRIBUTES);
desc.height = heightInPixel;
desc.attributes = (DFBFontAttributes)0;
DFBCHECK(dfb->CreateFont(dfb, fontUri, &desc, &font));
}
示例14: DFBCHECK
DFBEventBuffer::DFBEventBuffer() {
IDirectFB* dfb;
dfb = (IDirectFB*)(LocalDeviceManager::getInstance()->getGfxRoot());
//dfb_true => the focus doesn't matter
DFBCHECK(dfb->CreateInputEventBuffer(
dfb,
DICAPS_ALL,
DFB_TRUE,
&eventBuffer));
pool->insert(eventBuffer);
}
示例15: Q_ASSERT
void QDirectFBPixmapData::fill(const QColor &color)
{
if (!serialNumber())
return;
Q_ASSERT(surface);
if (color.alpha() < 255 && !hasAlphaChannel()) {
// convert to surface supporting alpha channel
DFBSurfacePixelFormat format;
surface->GetPixelFormat(surface, &format);
switch (format) {
case DSPF_YUY2:
case DSPF_UYVY:
format = DSPF_AYUV;
break;
#if (Q_DIRECTFB_VERSION >= 0x010100)
case DSPF_RGB444:
format = DSPF_ARGB4444;
break;
case DSPF_RGB555:
#endif
case DSPF_RGB18:
format = DSPF_ARGB6666;
break;
default:
format = DSPF_ARGB;
break;
}
DFBSurfaceDescription description;
description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH |
DSDESC_HEIGHT |
DSDESC_PIXELFORMAT);
surface->GetSize(surface, &description.width, &description.height);
description.pixelformat = format;
surface->Release(surface); // release old surface
IDirectFB *fb = QDirectFBScreen::instance()->dfb();
DFBResult result = fb->CreateSurface(fb, &description, &surface);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fill()", result);
setSerialNumber(0);
return;
}
}
surface->Clear(surface, color.red(), color.green(), color.blue(),
color.alpha());
}