fb_accel_td: fix blit2FB() for yp != 0 case

This commit is contained in:
Stefan Seyfried
2018-02-18 00:21:14 +01:00
committed by Thilo Graf
parent 405d77565d
commit b95b0cceeb

View File

@@ -110,22 +110,23 @@ void CFbAccelTD::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t
IDirectFBSurface *surf;
DFBSurfaceDescription dsc;
int pitch = width * sizeof(fb_pixel_t);
uint8_t *srcbuf = (uint8_t *)fbbuff + (pitch * yp);
src.x = xp;
src.y = yp;
src.y = 0; /* y != 0 does not work => add offset to the buffer instead */
src.w = width - xp;
src.h = height - yp;
src.h = height;
dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED);
dsc.caps = DSCAPS_NONE;
dsc.width = width;
dsc.height = height;
dsc.preallocated[0].data = fbbuff;
dsc.preallocated[0].data = srcbuf;
dsc.preallocated[0].pitch = pitch;
err = dfb->CreateSurface(dfb, &dsc, &surf);
if (err != DFB_OK) {
/* 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);
fprintf(stderr, LOGTAG "blit2FB: w:%d h:%d data:0x%p pitch:%d\n", width, height, srcbuf, pitch);
DirectFBError("dfb->CreateSurface(dfb, &dsc, &surf)", err);
return;
}
@@ -138,7 +139,13 @@ void CFbAccelTD::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t
else
dfbdest->SetBlittingFlags(dfbdest, DSBLIT_BLEND_ALPHACHANNEL);
dfbdest->Blit(dfbdest, surf, &src, xoff, yoff);
err = dfbdest->Blit(dfbdest, surf, &src, xoff, yoff);
if (err != DFB_OK) {
/* something wrong with src or x/yoff... */
fprintf(stderr, LOGTAG "blit2FB: w:%d h:%d data:0x%p pitch:%d xp:%d yp:%d xo:%d yo:%d\n",
width, height, srcbuf, pitch, xp, yp, xoff, yoff);
DirectFBError("dfbdest->Blit(dfbdest, surf, &src, xoff, yoff)", err);
}
surf->Release(surf);
return;
}