diff --git a/src/include/newgal.h b/src/include/newgal.h index b1b73a9c..a2d5b6db 100644 --- a/src/include/newgal.h +++ b/src/include/newgal.h @@ -70,6 +70,7 @@ #endif #define DISABLE_THREADS + #define GAL_mutex int #define GAL_bool BOOL diff --git a/src/newgal/blit_N.c b/src/newgal/blit_N.c index 1ea8e4a7..d4aaec24 100644 --- a/src/newgal/blit_N.c +++ b/src/newgal/blit_N.c @@ -69,8 +69,8 @@ #define STACKCALL typedef Uint32 int32; -#include "HeadMMX.h" -#include "HeadX86.h" +#include "hermes/HeadMMX.h" +#include "hermes/HeadX86.h" #else diff --git a/src/newgal/stretch.c b/src/newgal/stretch.c index 0c66a816..1d279426 100644 --- a/src/newgal/stretch.c +++ b/src/newgal/stretch.c @@ -376,13 +376,16 @@ static int GAL_StretchBltLegacy (GAL_Surface *src, GAL_Rect *srcrect, clipped_dstrect = *dstrect; } else if (GAL_IntersectRect (dstrect, &dst->clip_rect, &clipped_dstrect)) { - float ratio_x = clipped_dstrect.w * 1.0f / dstrect->w; - float ratio_y = clipped_dstrect.h * 1.0f / dstrect->h; + float ratio_x = (dstrect->x + dstrect->w - clipped_dstrect.x) * 1.0f / dstrect->w; + float ratio_y = (dstrect->y + dstrect->h - clipped_dstrect.y) * 1.0f / dstrect->h; + clipped_srcrect.x = srcrect->x + srcrect->w * (1.0f - ratio_x); + clipped_srcrect.y = srcrect->y + srcrect->h * (1.0f - ratio_y); + + ratio_x = (clipped_dstrect.w) * 1.0f / dstrect->w; + ratio_y = (clipped_dstrect.h) * 1.0f / dstrect->h; clipped_srcrect.w = (srcrect->w * ratio_x); clipped_srcrect.h = (srcrect->h * ratio_y); - clipped_srcrect.x = srcrect->x + (clipped_dstrect.x - dstrect->x) * ratio_x; - clipped_srcrect.y = srcrect->y + (clipped_dstrect.y - dstrect->y) * ratio_y; if (clipped_srcrect.w <= 0 || clipped_srcrect.h <= 0 || clipped_dstrect.w <= 0 || clipped_dstrect.h <= 0) diff --git a/src/newgdi/bitmap.c b/src/newgdi/bitmap.c index a9a0c690..a5e4b893 100644 --- a/src/newgdi/bitmap.c +++ b/src/newgdi/bitmap.c @@ -1419,6 +1419,7 @@ void GUIAPI StretchBltLegacy (HDC hsdc, int sx, int sy, int sw, int sh, if (dy >= RECTH(pddc->DevRC)) goto error_ret; +#if 0 // shrink source and destination rectangles if dx < 0 if (dx < 0) { // dx and overflow is negative @@ -1456,6 +1457,7 @@ void GUIAPI StretchBltLegacy (HDC hsdc, int sx, int sy, int sw, int sh, sh -= (int)(sh * overflow * 1.0f / dh + 0.5f); dh -= overflow; } +#endif if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) goto error_ret; @@ -1572,6 +1574,7 @@ void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, if (dy >= RECTH(pddc->DevRC)) goto error_ret; +#if 0 // shrink source and destination rectangles if dx < 0 if (dx < 0) { // dx and overflow is negative @@ -1609,6 +1612,7 @@ void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, sh -= (int)(sh * overflow * 1.0f / dh + 0.5f); dh -= overflow; } +#endif if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) goto error_ret; @@ -1616,12 +1620,12 @@ void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, SetRect (&srcOutput, sx, sy, sx + sw, sy + sh); SetRect (&dstOutput, dx, dy, dx + dw, dy + dh); - if (pddc->surface == psdc->surface) + if (pddc->surface == psdc->surface) GetBoundRect (&pddc->rc_output, &srcOutput, &dstOutput); else pddc->rc_output = dstOutput; - if (pddc->surface != psdc->surface && (psdc->surface == __gal_screen)) + if (pddc->surface != psdc->surface && (psdc->surface == __gal_screen)) psdc->rc_output = srcOutput; ENTER_DRAWING (pddc); @@ -1629,13 +1633,12 @@ void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, if (pddc->surface != psdc->surface && IS_SCREEN_SURFACE (psdc)) kernel_ShowCursorForGDI (FALSE, psdc); + src.x = sx; src.y = sy; src.w = sw; src.h = sh; + dst.x = dx; dst.y = dy; dst.w = dw; dst.h = dh; cliprect = pddc->ecrgn.head; while(cliprect) { if (IntersectRect (&eff_rc, &pddc->rc_output, &cliprect->rc)) { SET_GAL_CLIPRECT (pddc, eff_rc); - - src.x = sx; src.y = sy; src.w = sw; src.h = sh; - dst.x = dx; dst.y = dy; dst.w = dw; dst.h = dh; GAL_StretchBlt (psdc->surface, &src, pddc->surface, &dst, dwRop); }