fb_accel_td: don't crash for no reason

This commit is contained in:
Stefan Seyfried
2018-01-14 18:41:27 +01:00
committed by Thilo Graf
parent c05212e86b
commit 9832f7712f

View File

@@ -109,6 +109,7 @@ void CFbAccelTD::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t
DFBResult err;
IDirectFBSurface *surf;
DFBSurfaceDescription dsc;
int pitch = width * sizeof(fb_pixel_t);
src.x = xp;
src.y = yp;
@@ -120,12 +121,13 @@ void CFbAccelTD::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t
dsc.width = width;
dsc.height = height;
dsc.preallocated[0].data = fbbuff;
dsc.preallocated[0].pitch = width * sizeof(fb_pixel_t);
dsc.preallocated[0].pitch = pitch;
err = dfb->CreateSurface(dfb, &dsc, &surf);
/* TODO: maybe we should not die if this fails? */
if (err != DFB_OK) {
fprintf(stderr, LOGTAG "blit2FB: ");
DirectFBErrorFatal("dfb->CreateSurface(dfb, &dsc, &surf)", err);
/* probably width or height out of range... */
fprintf(stderr, LOGTAG "blit2FB: w:%d h:%d data:0x%p pitch:%d\n", width, height, fbbuff, pitch);
DirectFBError("dfb->CreateSurface(dfb, &dsc, &surf)", err);
return;
}
if (transp)