本文整理汇总了C++中DirectFBError函数的典型用法代码示例。如果您正苦于以下问题:C++ DirectFBError函数的具体用法?C++ DirectFBError怎么用?C++ DirectFBError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DirectFBError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: unlockSurface
bool QDirectFBPixmapData::scroll(int dx, int dy, const QRect &rect)
{
if (!dfbSurface) {
return false;
}
unlockSurface();
DFBResult result = dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::scroll", result);
return false;
}
result = dfbSurface->SetPorterDuff(dfbSurface, DSPD_NONE);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::scroll", result);
return false;
}
const DFBRectangle source = { rect.x(), rect.y(), rect.width(), rect.height() };
result = dfbSurface->Blit(dfbSurface, dfbSurface, &source, source.x + dx, source.y + dy);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::scroll", result);
return false;
}
return true;
}
示例3: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
Reaction reaction;
/* Initialize DirectFB including command line parsing. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
DirectFBError( "DirectFBInit() failed", ret );
return -1;
}
/* Parse the command line. */
if (!parse_command_line( argc, argv ))
return -2;
/* Create the super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
DirectFBError( "DirectFBCreate() failed", ret );
return -3;
}
if (!unique_wm_running()) {
D_ERROR( "UniQuE/Test: This session doesn't run UniQuE!\n" );
dfb->Release( dfb );
return EXIT_FAILURE;
}
unique_wm_enum_contexts( context_callback, NULL );
if (!context) {
D_ERROR( "UniQuE/Test: No context available!\n" );
dfb->Release( dfb );
return EXIT_FAILURE;
}
unique_input_channel_attach( context->foo_channel, foo_channel_listener, context, &reaction );
pause();
unique_input_channel_detach( context->foo_channel, &reaction );
unique_context_unref( context );
/* Release the super interface. */
dfb->Release( dfb );
return EXIT_SUCCESS;
}
示例4: main
int
main( int argc, char *argv[] )
{
DirectResult ret;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret)
return DirectFBError( "DirectFBInit()", ret );
dfb_system_lookup();
ret = fusion_enter( -1, 0, FER_MASTER, &world );
if (ret)
return DirectFBError( "fusion_enter()", ret );
printf( "\n" );
#if FUSION_BUILD_MULTI
printf( "Fusion Benchmark (Multi Application Core)\n" );
#else
printf( "Fusion Benchmark (Single Application Core)\n" );
#endif
printf( "\n" );
bench_flock();
bench_mutex();
bench_mutex_threaded();
bench_skirmish();
bench_skirmish_threaded();
//bench_spinlock_threaded();
bench_property();
bench_ref();
bench_reactor();
bench_shmpool( false );
bench_shmpool( true );
printf( "\n" );
fusion_exit( world, false );
return 0;
}
示例5: QImage
QImage QDirectFBPixmapData::toImage() const
{
if (!surface)
return QImage();
#ifdef QT_NO_DIRECTFB_PREALLOCATED
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
const QImage *img = that->buffer();
const QImage copied = img->copy();
that->unlockDirectFB();
return copied;
#else
int w, h;
surface->GetSize(surface, &w, &h);
DFBSurfacePixelFormat format;
surface->GetPixelFormat(surface, &format);
QImage::Format imageFormat = QDirectFBScreen::getImageFormat(format);
if (imageFormat == QImage::Format_Invalid)
imageFormat = QImage::Format_ARGB32_Premultiplied;
imageFormat = QImage::Format_ARGB32;
QImage image(w, h, imageFormat);
DFBSurfaceDescription description;
description = QDirectFBScreen::getSurfaceDescription(image);
IDirectFB *fb = QDirectFBScreen::instance()->dfb();
IDirectFBSurface *imgSurface;
DFBResult result = fb->CreateSurface(fb, &description, &imgSurface);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::toImage()", result);
return QImage();
}
imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX);
result = imgSurface->Blit(imgSurface, surface, 0, 0, 0);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::toImage() blit failed", result);
return QImage();
}
imgSurface->Release(imgSurface);
return image;
#endif // QT_NO_DIRECTFB_PREALLOCATED
}
示例6: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
/* Initialize DirectFB including command line parsing. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
DirectFBError( "DirectFBInit() failed", ret );
return -1;
}
/* Parse the command line. */
if (!parse_command_line( argc, argv ))
return -2;
/* Create the super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
DirectFBError( "DirectFBCreate() failed", ret );
return -3;
}
if (!prophecy_wm_running()) {
D_ERROR( "Prophecy/Test: This session doesn't run Prophecy!\n" );
dfb->Release( dfb );
return EXIT_FAILURE;
}
prophecy_wm_enum_contexts( context_callback, NULL );
if (!context) {
D_ERROR( "Prophecy/Test: No context available!\n" );
dfb->Release( dfb );
return EXIT_FAILURE;
}
/* Set the background according to the users wishes. */
if (color)
set_color();
prophecy_context_unref( context );
/* Release the super interface. */
dfb->Release( dfb );
return EXIT_SUCCESS;
}
示例7: Q_ASSERT
void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect)
{
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->width() && data->height());
Q_ASSERT(data->classId() == QPixmapData::BlitterClass);
QBlittablePixmapData *blitPm = static_cast<QBlittablePixmapData*>(data);
QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blitPm->blittable());
dfbBlitter->unlock();
IDirectFBSurface *s = dfbBlitter->m_surface.data();
DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX;
DFBSurfacePorterDuffRule porterDuff = DSPD_SRC;
if (pixmap.hasAlpha()) {
blittingFlags = DSBLIT_BLEND_ALPHACHANNEL;
porterDuff = DSPD_SRC_OVER;
}
m_surface->SetBlittingFlags(m_surface.data(), DFBSurfaceBlittingFlags(blittingFlags));
m_surface->SetPorterDuff(m_surface.data(), porterDuff);
m_surface->SetDstBlendFunction(m_surface.data(), DSBF_INVSRCALPHA);
const DFBRectangle sRect = { srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height() };
DFBResult result;
if (rect.width() == srcRect.width() && rect.height() == srcRect.height())
result = m_surface->Blit(m_surface.data(), s, &sRect, rect.x(), rect.y());
else {
const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() };
result = m_surface->StretchBlit(m_surface.data(), s, &sRect, &dRect);
}
if (result != DFB_OK)
DirectFBError("QDirectFBBlitter::drawPixmap()", result);
}
示例8: Q_ASSERT
void QDirectFbWindow::createDirectFBWindow()
{
Q_ASSERT(!m_dfbWindow.data());
DFBDisplayLayerConfig layerConfig;
IDirectFBDisplayLayer *layer;
layer = toDfbScreen(window())->dfbLayer();
layer->GetConfiguration(layer, &layerConfig);
DFBWindowDescription description;
memset(&description,0,sizeof(DFBWindowDescription));
description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS
|DWDESC_OPTIONS
|DWDESC_CAPS);
description.width = qMax(1, window()->width());
description.height = qMax(1, window()->height());
description.posx = window()->x();
description.posy = window()->y();
if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED)
description.surface_caps = DSCAPS_PREMULTIPLIED;
description.pixelformat = layerConfig.pixelformat;
description.options = DFBWindowOptions(DWOP_ALPHACHANNEL);
description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL);
DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr());
if (result != DFB_OK)
DirectFBError("QDirectFbWindow: failed to create window", result);
m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff);
m_inputHandler->addWindow(m_dfbWindow.data(), window());
}
示例9: while
void QDirectFbInput::handleEvents()
{
DFBResult hasEvent = m_eventBuffer->HasEvent(m_eventBuffer.data());
while(hasEvent == DFB_OK){
DFBEvent event;
DFBResult ok = m_eventBuffer->GetEvent(m_eventBuffer.data(), &event);
if (ok != DFB_OK)
DirectFBError("Failed to get event",ok);
if (event.clazz == DFEC_WINDOW) {
switch (event.window.type) {
case DWET_BUTTONDOWN:
case DWET_BUTTONUP:
case DWET_MOTION:
handleMouseEvents(event);
break;
case DWET_WHEEL:
handleWheelEvent(event);
break;
case DWET_KEYDOWN:
case DWET_KEYUP:
handleKeyEvents(event);
break;
case DWET_ENTER:
case DWET_LEAVE:
handleEnterLeaveEvents(event);
default:
break;
}
}
hasEvent = m_eventBuffer->HasEvent(m_eventBuffer.data());
}
}
示例10: Q_ASSERT
void QDirectFbWindowEGL::createDirectFBWindow()
{
// Use the default for the raster surface.
if (window()->surfaceType() == QSurface::RasterSurface)
return QDirectFbWindow::createDirectFBWindow();
Q_ASSERT(!m_dfbWindow.data());
DFBWindowDescription description;
memset(&description, 0, sizeof(DFBWindowDescription));
description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH | DWDESC_HEIGHT|
DWDESC_POSX | DWDESC_POSY|
DWDESC_PIXELFORMAT | DWDESC_SURFACE_CAPS);
description.width = qMax(1, window()->width());
description.height = qMax(1, window()->height());
description.posx = window()->x();
description.posy = window()->y();
description.surface_caps = DSCAPS_GL;
description.pixelformat = DSPF_RGB16;
IDirectFBDisplayLayer *layer;
layer = toDfbScreen(window())->dfbLayer();
DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr());
if (result != DFB_OK)
DirectFBError("QDirectFbWindow: failed to create window", result);
m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff);
m_inputHandler->addWindow(m_dfbWindow.data(), window());
}
示例11: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
int i;
VoodooPlayInfo info;
VoodooPlayer *player = NULL;
/* Initialize DirectFB including command line parsing. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
DirectFBError( "DirectFBInit() failed", ret );
return -1;
}
/* Parse the command line. */
if (!parse_command_line( argc, argv ))
return -2;
if (m_name) {
direct_snputs( info.name, m_name, VOODOO_PLAYER_NAME_LENGTH );
}
ret = voodoo_player_create( m_name ? &info : NULL, &player );
if (ret) {
D_ERROR( "Voodoo/Play: Could not create the player (%s)!\n", DirectFBErrorString(ret) );
goto out;
}
do {
voodoo_player_broadcast( player );
direct_thread_sleep( 100000 );
voodoo_player_enumerate( player, player_callback, NULL );
if (m_lookup) {
for (i=1; i<argc; i++) {
char buf[100];
if (voodoo_player_lookup( player, (const u8 *)argv[i], NULL, buf, sizeof(buf) )) {
D_ERROR( "Voodoo/Play: No '%s' found!\n", argv[i] );
continue;
}
D_INFO( "Voodoo/Play: Found '%s' with address %s\n", argv[i], buf );
}
}
direct_thread_sleep( 2000000 );
} while (m_run);
out:
if (player)
voodoo_player_destroy( player );
return ret;
}
示例12: init_application
static void
init_application( int *argc, char **argv[] )
{
DFBResult ret;
DFBSurfaceDescription desc;
/* Initialize DirectFB including command line parsing. */
ret = DirectFBInit( argc, argv );
if (ret) {
DirectFBError( "DirectFBInit() failed", ret );
exit_application( 1 );
}
/* Create the super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
DirectFBError( "DirectFBCreate() failed", ret );
exit_application( 2 );
}
/* Request fullscreen mode. */
dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
/* Fill the surface description. */
desc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
desc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
desc.pixelformat = DSPF_ARGB;
/* Create an 8 bit palette surface. */
ret = dfb->CreateSurface( dfb, &desc, &primary );
if (ret) {
DirectFBError( "IDirectFB::CreateSurface() failed", ret );
exit_application( 3 );
}
/* Create an event buffer with key capable devices attached. */
ret = dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, DFB_FALSE, &events );
if (ret) {
DirectFBError( "IDirectFB::CreateEventBuffer() failed", ret );
exit_application( 4 );
}
/* Clear with black. */
primary->Clear( primary, 0x00, 0x00, 0x00, 0xff );
primary->Flip( primary, NULL, 0 );
}
示例13: dump_mixers
static void
dump_mixers( IDirectFBScreen *screen,
int num )
{
int i, n;
DFBResult ret;
DFBScreenMixerDescription descs[num];
ret = screen->GetMixerDescriptions( screen, descs );
if (ret) {
DirectFBError( "IDirectFBScreen::GetMixerDescriptions", ret );
return;
}
for (i=0; i<num; i++) {
printf( " Mixer (%d) %s\n", i, descs[i].name );
/* Caps */
printf( " Caps: " );
for (n=0; mixer_caps[n].capability; n++) {
if (descs[i].caps & mixer_caps[n].capability)
printf( "%s ", mixer_caps[n].name );
}
printf( "\n" );
/* Full mode layers */
if (descs[i].caps & DSMCAPS_FULL) {
printf( " Layers (full mode): " );
for (n=0; n<DFB_DISPLAYLAYER_IDS_MAX; n++) {
if (DFB_DISPLAYLAYER_IDS_HAVE( descs[i].layers, n ))
printf( "(%02x) ", n );
}
printf( "\n" );
}
/* Sub mode layers */
if (descs[i].caps & DSMCAPS_SUB_LAYERS) {
printf( " Layers (sub mode): %2d of ", descs[i].sub_num );
for (n=0; n<DFB_DISPLAYLAYER_IDS_MAX; n++) {
if (DFB_DISPLAYLAYER_IDS_HAVE( descs[i].sub_layers, n ))
printf( "(%02x) ", n );
}
printf( "\n" );
}
printf( "\n" );
}
printf( "\n" );
}
示例14: enum_display_layers
static void
enum_display_layers( IDirectFBScreen *screen )
{
DFBResult ret;
ret = screen->EnumDisplayLayers( screen, display_layer_callback, NULL );
if (ret)
DirectFBError( "IDirectFBScreen::EnumDisplayLayers", ret );
}
示例15: qFatal
void QDirectFBWindowSurface::createWindow(const QRect &rect)
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
if (!layer)
qFatal("QDirectFBWindowSurface: Unable to get primary display layer!");
updateIsOpaque();
DFBWindowDescription description;
memset(&description, 0, sizeof(DFBWindowDescription));
description.flags = DWDESC_CAPS|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT;
description.caps = DWCAPS_NODECORATION;
description.surface_caps = DSCAPS_NONE;
imageFormat = screen->pixelFormat();
if (!(surfaceFlags() & Opaque)) {
imageFormat = screen->alphaPixmapFormat();
description.caps |= DWCAPS_ALPHACHANNEL;
#if (Q_DIRECTFB_VERSION >= 0x010200)
description.flags |= DWDESC_OPTIONS;
description.options |= DWOP_ALPHACHANNEL;
#endif
}
description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat);
description.posx = rect.x();
description.posy = rect.y();
description.width = rect.width();
description.height = rect.height();
if (QDirectFBScreen::isPremultiplied(imageFormat))
description.surface_caps = DSCAPS_PREMULTIPLIED;
if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
description.surface_caps |= DSCAPS_VIDEOONLY;
DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
if (result != DFB_OK)
DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
if (window()) {
if (window()->windowFlags() & Qt::WindowStaysOnTopHint) {
dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER);
}
DFBWindowID winid;
result = dfbWindow->GetID(dfbWindow, &winid);
if (result != DFB_OK) {
DirectFBError("QDirectFBWindowSurface::createWindow. Can't get ID", result);
} else {
window()->setProperty("_q_DirectFBWindowID", winid);
}
}
Q_ASSERT(!dfbSurface);
dfbWindow->GetSurface(dfbWindow, &dfbSurface);
}