diff --git a/src/driver/fb_accel_td.cpp b/src/driver/fb_accel_td.cpp index 9b45f1570..a41cd1df3 100644 --- a/src/driver/fb_accel_td.cpp +++ b/src/driver/fb_accel_td.cpp @@ -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; }