comparison src/video/windx5/SDL_dx5video.c @ 468:0b0c2e63eb27

Fixed 2048 pixel limitation in DirectX blit code
author Sam Lantinga <slouken@libsdl.org>
date Sat, 24 Aug 2002 17:15:45 +0000
parents a6fa62b1be09
children 8b1c1ae7af11
comparison
equal deleted inserted replaced
467:e7194ff2ef3f 468:0b0c2e63eb27
1123 if ( SDL_windowid == NULL ) { 1123 if ( SDL_windowid == NULL ) {
1124 HWND top; 1124 HWND top;
1125 UINT swp_flags; 1125 UINT swp_flags;
1126 1126
1127 SDL_resizing = 1; 1127 SDL_resizing = 1;
1128 bounds.left = 0; 1128 bounds.top = 0;
1129 bounds.top = 0;
1130 bounds.right = video->w;
1131 bounds.bottom = video->h; 1129 bounds.bottom = video->h;
1130 bounds.left = 0;
1131 bounds.right = video->w;
1132 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); 1132 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
1133 width = bounds.right-bounds.left; 1133 width = bounds.right-bounds.left;
1134 height = bounds.bottom-bounds.top; 1134 height = bounds.bottom-bounds.top;
1135 x = (GetSystemMetrics(SM_CXSCREEN)-width)/2; 1135 x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
1136 y = (GetSystemMetrics(SM_CYSCREEN)-height)/2; 1136 y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
1481 return(NULL); 1481 return(NULL);
1482 } 1482 }
1483 1483
1484 /* Set the size of the window, centering and adjusting */ 1484 /* Set the size of the window, centering and adjusting */
1485 SDL_resizing = 1; 1485 SDL_resizing = 1;
1486 bounds.left = 0; 1486 bounds.top = 0;
1487 bounds.top = 0;
1488 bounds.right = video->w;
1489 bounds.bottom = video->h; 1487 bounds.bottom = video->h;
1488 bounds.left = 0;
1489 bounds.right = video->w;
1490 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); 1490 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
1491 width = bounds.right-bounds.left; 1491 width = bounds.right-bounds.left;
1492 height = bounds.bottom-bounds.top; 1492 height = bounds.bottom-bounds.top;
1493 x = (GetSystemMetrics(SM_CXSCREEN)-width)/2; 1493 x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
1494 y = (GetSystemMetrics(SM_CYSCREEN)-height)/2; 1494 y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
1763 HRESULT result; 1763 HRESULT result;
1764 1764
1765 /* Set it up.. the desination must have a DDRAW surface */ 1765 /* Set it up.. the desination must have a DDRAW surface */
1766 src_surface = src->hwdata->dd_writebuf; 1766 src_surface = src->hwdata->dd_writebuf;
1767 dst_surface = dst->hwdata->dd_writebuf; 1767 dst_surface = dst->hwdata->dd_writebuf;
1768 rect.top = srcrect->y; 1768 rect.top = (LONG)srcrect->y;
1769 rect.bottom = srcrect->y+srcrect->h; 1769 rect.bottom = (LONG)srcrect->y+srcrect->h;
1770 rect.left = srcrect->x; 1770 rect.left = (LONG)srcrect->x;
1771 rect.right = srcrect->x+srcrect->w; 1771 rect.right = (LONG)srcrect->x+srcrect->w;
1772 if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY ) 1772 if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY )
1773 flags = DDBLTFAST_SRCCOLORKEY; 1773 flags = DDBLTFAST_SRCCOLORKEY;
1774 else 1774 else
1775 flags = DDBLTFAST_NOCOLORKEY; 1775 flags = DDBLTFAST_NOCOLORKEY;
1776 /* FIXME: We can remove this flag for _really_ fast blit queuing, 1776 /* FIXME: We can remove this flag for _really_ fast blit queuing,
1856 1856
1857 #ifdef DDRAW_DEBUG 1857 #ifdef DDRAW_DEBUG
1858 fprintf(stderr, "HW accelerated fill at (%d,%d)\n", dstrect->x, dstrect->y); 1858 fprintf(stderr, "HW accelerated fill at (%d,%d)\n", dstrect->x, dstrect->y);
1859 #endif 1859 #endif
1860 dst_surface = dst->hwdata->dd_writebuf; 1860 dst_surface = dst->hwdata->dd_writebuf;
1861 area.top = dstrect->y; 1861 area.top = (LONG)dstrect->y;
1862 area.bottom = dstrect->y+dstrect->h; 1862 area.bottom = (LONG)dstrect->y+dstrect->h;
1863 area.left = dstrect->x; 1863 area.left = (LONG)dstrect->x;
1864 area.right = dstrect->x+dstrect->w; 1864 area.right = (LONG)dstrect->x+dstrect->w;
1865 bltfx.dwSize = sizeof(bltfx); 1865 bltfx.dwSize = sizeof(bltfx);
1866 #if defined(NONAMELESSUNION) 1866 #if defined(NONAMELESSUNION)
1867 bltfx.u5.dwFillColor = color; 1867 bltfx.u5.dwFillColor = color;
1868 #else 1868 #else
1869 bltfx.dwFillColor = color; 1869 bltfx.dwFillColor = color;
1983 HRESULT result; 1983 HRESULT result;
1984 int i; 1984 int i;
1985 RECT src, dst; 1985 RECT src, dst;
1986 1986
1987 for ( i=0; i<numrects; ++i ) { 1987 for ( i=0; i<numrects; ++i ) {
1988 src.top = rects[i].y; 1988 src.top = (LONG)rects[i].y;
1989 src.bottom = rects[i].y+rects[i].h; 1989 src.bottom = (LONG)rects[i].y+rects[i].h;
1990 src.left = rects[i].x; 1990 src.left = (LONG)rects[i].x;
1991 src.right = rects[i].x+rects[i].w; 1991 src.right = (LONG)rects[i].x+rects[i].w;
1992 dst.top = SDL_bounds.top+src.top; 1992 dst.top = SDL_bounds.top+src.top;
1993 dst.left = SDL_bounds.left+src.left; 1993 dst.left = SDL_bounds.left+src.left;
1994 dst.bottom = SDL_bounds.top+src.bottom; 1994 dst.bottom = SDL_bounds.top+src.bottom;
1995 dst.right = SDL_bounds.left+src.right; 1995 dst.right = SDL_bounds.left+src.right;
1996 result = IDirectDrawSurface3_Blt(SDL_primary, &dst, 1996 result = IDirectDrawSurface3_Blt(SDL_primary, &dst,
1997 this->screen->hwdata->dd_surface, &src, 1997 this->screen->hwdata->dd_surface, &src,
1998 DDBLT_WAIT, NULL); 1998 DDBLT_WAIT, NULL);
1999 /* Doh! Check for lost surface and restore it */ 1999 /* Doh! Check for lost surface and restore it */
2000 if ( result == DDERR_SURFACELOST ) { 2000 if ( result == DDERR_SURFACELOST ) {