本文整理汇总了C++中SDL_DFB_CHECKERR函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_DFB_CHECKERR函数的具体用法?C++ SDL_DFB_CHECKERR怎么用?C++ SDL_DFB_CHECKERR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_DFB_CHECKERR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DirectFB_GL_SwapWindow
void
DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
{
SDL_DFB_WINDOWDATA(window);
DFBRegion region;
DirectFB_GLContext *p;
region.x1 = 0;
region.y1 = 0;
region.x2 = window->w;
region.y2 = window->h;
#if 0
if (devdata->glFinish)
devdata->glFinish();
else if (devdata->glFlush)
devdata->glFlush();
#endif
for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
if (p->sdl_window == window && p->is_locked)
{
SDL_DFB_CHECKERR(p->context->Unlock(p->context));
p->is_locked = 0;
}
SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL, DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC ));
return;
error:
return;
}
示例2: DirectFB_GL_MakeCurrent
int
DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
{
//SDL_DFB_WINDOWDATA(window);
DirectFB_GLContext *ctx = (DirectFB_GLContext *) context;
DirectFB_GLContext *p;
for (p = _this->gl_data->firstgl; p; p = p->next)
{
if (p->is_locked) {
SDL_DFB_CHECKERR(p->context->Unlock(p->context));
p->is_locked = 0;
}
}
if (ctx != NULL) {
SDL_DFB_CHECKERR(ctx->context->Lock(ctx->context));
ctx->is_locked = 1;
}
return 0;
error:
return -1;
}
示例3: DirectFB_GL_CreateContext
SDL_GLContext
DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
{
SDL_DFB_WINDOWDATA(window);
DirectFB_GLContext *context;
int ret;
SDL_DFB_CALLOC(context, 1, sizeof(*context));
SDL_DFB_CHECKERR(windata->surface->GetGL(windata->surface,
&context->context));
if (!context->context)
return NULL;
SDL_DFB_CHECKERR(context->context->Unlock(context->context));
context->next = _this->gl_data->firstgl;
_this->gl_data->firstgl = context;
if (DirectFB_GL_MakeCurrent(_this, window, context) < 0) {
DirectFB_GL_DeleteContext(_this, context);
return NULL;
}
return context;
error:
return NULL;
}
示例4: DisplayPaletteChanged
static int
DisplayPaletteChanged(void *userdata, SDL_Palette * palette)
{
#if USE_DISPLAY_PALETTE
DirectFB_RenderData *data = (DirectFB_RenderData *) userdata;
SDL_DFB_WINDOWSURFACE(data->window);
IDirectFBPalette *surfpal;
int i;
int ncolors;
DFBColor entries[256];
SDL_DFB_CHECKERR(destsurf->GetPalette(destsurf, &surfpal));
/* FIXME: number of colors */
ncolors = (palette->ncolors < 256 ? palette->ncolors : 256);
for (i = 0; i < ncolors; ++i) {
entries[i].r = palette->colors[i].r;
entries[i].g = palette->colors[i].g;
entries[i].b = palette->colors[i].b;
entries[i].a = palette->colors[i].a;
}
SDL_DFB_CHECKERR(surfpal->SetEntries(surfpal, entries, ncolors, 0));
return 0;
error:
#else
SDL_Unsupported();
#endif
return -1;
}
示例5: PrepareDraw
static int
PrepareDraw(SDL_Renderer * renderer)
{
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
IDirectFBSurface *destsurf = data->target;
Uint8 r, g, b, a;
r = renderer->r;
g = renderer->g;
b = renderer->b;
a = renderer->a;
SetBlendMode(data, renderer->blendMode, NULL);
SDL_DFB_CHECKERR(destsurf->SetDrawingFlags(destsurf, data->drawFlags));
switch (renderer->blendMode) {
case SDL_BLENDMODE_NONE:
/* case SDL_BLENDMODE_MASK: */
case SDL_BLENDMODE_BLEND:
break;
case SDL_BLENDMODE_ADD:
case SDL_BLENDMODE_MOD:
r = ((int) r * (int) a) / 255;
g = ((int) g * (int) a) / 255;
b = ((int) b * (int) a) / 255;
a = 255;
break;
}
SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, r, g, b, a));
return 0;
error:
return -1;
}
示例6: DirectFB_RenderDrawLines
static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
const SDL_FPoint * points, int count)
{
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
IDirectFBSurface *destsurf = data->target;
DFBRegion clip_region;
int i;
DirectFB_ActivateRenderer(renderer);
PrepareDraw(renderer);
/* Use antialiasing when available */
#if (DFB_VERSION_ATLEAST(1,2,0))
SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
#endif
destsurf->GetClip(destsurf, &clip_region);
for (i=0; i < count - 1; i++) {
int x1 = points[i].x + clip_region.x1;
int y1 = points[i].y + clip_region.y1;
int x2 = points[i + 1].x + clip_region.x1;
int y2 = points[i + 1].y + clip_region.y1;
SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2));
}
return 0;
error:
return -1;
}
示例7: CheckSetDisplayMode
static void
CheckSetDisplayMode(_THIS, SDL_VideoDisplay * display, DFB_DisplayData * data, SDL_DisplayMode * mode)
{
SDL_DFB_DEVICEDATA(_this);
DFBDisplayLayerConfig config;
DFBDisplayLayerConfigFlags failed;
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
DLSCL_ADMINISTRATIVE));
config.width = mode->w;
config.height = mode->h;
config.pixelformat = DirectFB_SDLToDFBPixelFormat(mode->format);
config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
if (devdata->use_yuv_underlays) {
config.flags |= DLCONF_OPTIONS;
config.options = DLOP_ALPHACHANNEL;
}
failed = 0;
data->layer->TestConfiguration(data->layer, &config, &failed);
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
DLSCL_SHARED));
if (failed == 0)
{
SDL_AddDisplayMode(display, mode);
SDL_DFB_LOG("Mode %d x %d Added\n", mode->w, mode->h);
}
else
SDL_DFB_ERR("Mode %d x %d not available: %x\n", mode->w,
mode->h, failed);
return;
error:
return;
}
示例8: DirectFB_UpdateTexture
static int
DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
{
DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
DFBResult ret;
Uint8 *dpixels;
int dpitch;
Uint8 *src, *dst;
int row;
size_t length;
int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format));
// FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes
SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
DSLF_WRITE | DSLF_READ,
((void **) &dpixels), &dpitch));
src = (Uint8 *) pixels;
dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
length = rect->w * bpp;
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
dst += dpitch;
}
SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
return 0;
error:
return 1;
}
示例9: DirectFB_AcquireVidLayer
static int
DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
{
//SDL_DFB_RENDERERDATA(renderer);
SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DFB_DEVICEDATA(display->device);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
DirectFB_TextureData *data = texture->driverdata;
DFBDisplayLayerConfig layconf;
DFBResult ret;
if (devdata->use_yuv_direct && (dispdata->vidID >= 0)
&& (!dispdata->vidIDinuse)
&& SDL_ISPIXELFORMAT_FOURCC(data->format)) {
layconf.flags =
DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
DLCONF_SURFACE_CAPS;
layconf.width = texture->w;
layconf.height = texture->h;
layconf.pixelformat = DirectFB_SDLToDFBPixelFormat(data->format);
layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE;
SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
dispdata->vidID,
&dispdata->vidlayer));
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetCooperativeLevel(dispdata->vidlayer,
DLSCL_EXCLUSIVE));
if (devdata->use_yuv_underlays) {
ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1);
if (ret != DFB_OK)
SDL_DFB_DEBUG("Underlay Setlevel not supported\n");
}
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetConfiguration(dispdata->vidlayer,
&layconf));
SDL_DFB_CHECKERR(dispdata->
vidlayer->GetSurface(dispdata->vidlayer,
&data->surface));
dispdata->vidIDinuse = 1;
data->display = display;
return 0;
}
return 1;
error:
if (dispdata->vidlayer) {
SDL_DFB_RELEASE(data->surface);
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetCooperativeLevel(dispdata->vidlayer,
DLSCL_ADMINISTRATIVE));
SDL_DFB_RELEASE(dispdata->vidlayer);
}
return 1;
}
示例10: DirectFB_UpdateTexture
static int
DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
{
DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
Uint8 *dpixels;
int dpitch;
Uint8 *src, *dst;
int row;
size_t length;
int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
/* FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes */
DirectFB_ActivateRenderer(renderer);
if ((texture->format == SDL_PIXELFORMAT_YV12) ||
(texture->format == SDL_PIXELFORMAT_IYUV)) {
bpp = 1;
}
SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
DSLF_WRITE | DSLF_READ,
((void **) &dpixels), &dpitch));
src = (Uint8 *) pixels;
dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
length = rect->w * bpp;
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
dst += dpitch;
}
/* copy other planes for 3 plane formats */
if ((texture->format == SDL_PIXELFORMAT_YV12) ||
(texture->format == SDL_PIXELFORMAT_IYUV)) {
src = (Uint8 *) pixels + texture->h * pitch;
dst = (Uint8 *) dpixels + texture->h * dpitch + rect->y * dpitch / 4 + rect->x * bpp / 2;
for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
SDL_memcpy(dst, src, length / 2);
src += pitch / 2;
dst += dpitch / 2;
}
src = (Uint8 *) pixels + texture->h * pitch + texture->h * pitch / 4;
dst = (Uint8 *) dpixels + texture->h * dpitch + texture->h * dpitch / 4 + rect->y * dpitch / 4 + rect->x * bpp / 2;
for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
SDL_memcpy(dst, src, length / 2);
src += pitch / 2;
dst += dpitch / 2;
}
}
SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
data->isDirty = 0;
return 0;
error:
return 1;
}
示例11: DirectFB_CreateDefaultCursor
static SDL_Cursor *
DirectFB_CreateDefaultCursor(void)
{
SDL_VideoDevice *dev = SDL_GetVideoDevice();
SDL_DFB_DEVICEDATA(dev);
DFB_CursorData *curdata;
DFBResult ret;
DFBSurfaceDescription dsc;
SDL_Cursor *cursor;
Uint32 *dest;
Uint32 *p;
int pitch, i, j;
SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor));
SDL_DFB_ALLOC_CLEAR(curdata, sizeof(*curdata));
dsc.flags =
DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
dsc.caps = DSCAPS_VIDEOONLY;
dsc.width = 32;
dsc.height = 32;
dsc.pixelformat = DSPF_ARGB;
SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
&curdata->surf));
curdata->hotx = 0;
curdata->hoty = 0;
cursor->driverdata = curdata;
SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
(void *) &dest, &pitch));
/* Relies on the fact that this is only called with ARGB surface. */
for (i = 0; i < 32; i++)
{
for (j = 0; j < 32; j++)
{
switch (arrow[i][j])
{
case ' ': dest[j] = 0x00000000; break;
case '.': dest[j] = 0xffffffff; break;
case 'X': dest[j] = 0xff000000; break;
}
}
dest += (pitch >> 2);
}
curdata->surf->Unlock(curdata->surf);
return cursor;
error:
return NULL;
}
示例12: DirectFB_SetWindowIcon
void
DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
SDL_Surface *surface = NULL;
DFBResult ret;
if (icon) {
SDL_PixelFormat format;
DFBSurfaceDescription dsc;
Uint32 *dest;
Uint32 *p;
int pitch, i;
/* Convert the icon to ARGB for modern window managers */
SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
0xFF000000);
surface = SDL_ConvertSurface(icon, &format, 0);
if (!surface) {
return;
}
dsc.flags =
DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
dsc.caps = DSCAPS_VIDEOONLY;
dsc.width = surface->w;
dsc.height = surface->h;
dsc.pixelformat = DSPF_ARGB;
SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
&windata->icon));
SDL_DFB_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE,
(void *) &dest, &pitch));
p = surface->pixels;
for (i = 0; i < surface->h; i++)
memcpy((char *) dest + i * pitch,
(char *) p + i * surface->pitch, 4 * surface->w);
windata->icon->Unlock(windata->icon);
SDL_FreeSurface(surface);
} else {
SDL_DFB_RELEASE(windata->icon);
}
return;
error:
if (surface)
SDL_FreeSurface(surface);
SDL_DFB_RELEASE(windata->icon);
return;
}
示例13: DirectFB_SetTexturePalette
static int
DirectFB_SetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture,
const SDL_Color * colors, int firstcolor,
int ncolors)
{
DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
if (SDL_ISPIXELFORMAT_INDEXED(data->format)
&& !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
DFBColor entries[256];
int i;
if (ncolors > 256)
ncolors = 256;
for (i = 0; i < ncolors; ++i) {
entries[i].r = colors[i].r;
entries[i].g = colors[i].g;
entries[i].b = colors[i].b;
entries[i].a = 0xff;
}
SDL_DFB_CHECKERR(data->
palette->SetEntries(data->palette, entries, ncolors, firstcolor));
return 0;
} else {
return SDL_SetError("YUV textures don't have a palette");
}
error:
return -1;
}
示例14: DirectFB_GL_CreateContext
SDL_GLContext
DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
{
//SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DirectFB_GLContext *context;
SDL_DFB_ALLOC_CLEAR(context, sizeof(DirectFB_GLContext));
SDL_DFB_CHECKERR(windata->surface->GetGL(windata->surface,
&context->context));
if (!context->context)
return NULL;
context->is_locked = 0;
context->sdl_window = window;
context->next = _this->gl_data->firstgl;
_this->gl_data->firstgl = context;
SDL_DFB_CHECK(context->context->Unlock(context->context));
if (DirectFB_GL_MakeCurrent(_this, window, context) < 0) {
DirectFB_GL_DeleteContext(_this, context);
return NULL;
}
return context;
error:
return NULL;
}
示例15: DirectFB_GetDisplayModes
void
DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
{
SDL_DFB_DEVICEDATA(_this);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
SDL_DisplayMode mode;
struct modes_callback_t data;
int i;
data.nummodes = 0;
/* Enumerate the available fullscreen modes */
SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode));
SDL_DFB_CHECKERR(devdata->dfb->EnumVideoModes(devdata->dfb,
EnumModesCallback, &data));
for (i = 0; i < data.nummodes; ++i) {
mode = data.modelist[i];
mode.format = SDL_PIXELFORMAT_ARGB8888;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_RGB888;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_RGB24;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_RGB565;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_INDEX8;
CheckSetDisplayMode(_this, display, dispdata, &mode);
}
SDL_DFB_FREE(data.modelist);
error:
return;
}