| Index: dxglcfg/tests.cpp |
| — | — | @@ -48,6 +48,7 @@ |
| 49 | 49 | static unsigned int randnum;
|
| 50 | 50 | static int testtypes[] = {0,1,0,1,0,1,0,0,2,1,0,0,0,0,0,0,0};
|
| 51 | 51 | static DWORD counter;
|
| | 52 | +static DWORD hotspotx,hotspoty;
|
| 52 | 53 |
|
| 53 | 54 | #define FVF_COLORVERTEX (D3DFVF_VERTEX | D3DFVF_DIFFUSE | D3DFVF_SPECULAR)
|
| 54 | 55 | struct COLORVERTEX
|
| — | — | @@ -800,6 +801,7 @@ |
| 801 | 802 | bgcolor = 0;
|
| 802 | 803 | DDCOLORKEY ckey;
|
| 803 | 804 | HCURSOR cursor;
|
| | 805 | + ICONINFO iconinfo;
|
| 804 | 806 | HDC memorydc;
|
| 805 | 807 | BITMAPINFO bitmapinfo;
|
| 806 | 808 | HBITMAP bitmap;
|
| — | — | @@ -1045,6 +1047,11 @@ |
| 1046 | 1048 | bitmap = CreateDIBSection(memorydc, &bitmapinfo, DIB_RGB_COLORS, &bmppointer, NULL, 0);
|
| 1047 | 1049 | temp = SelectObject(memorydc, bitmap);
|
| 1048 | 1050 | DeleteObject(temp);
|
| | 1051 | + GetIconInfo(cursor,&iconinfo);
|
| | 1052 | + hotspotx = iconinfo.xHotspot;
|
| | 1053 | + hotspoty = iconinfo.yHotspot;
|
| | 1054 | + if(iconinfo.hbmColor) DeleteObject(iconinfo.hbmColor);
|
| | 1055 | + if(iconinfo.hbmMask) DeleteObject(iconinfo.hbmMask);
|
| 1049 | 1056 | for (i = 0; i < 7; i++)
|
| 1050 | 1057 | {
|
| 1051 | 1058 | DrawIcon(memorydc, i*sprites[0].ddsd.dwWidth, 0, cursor);
|
| — | — | @@ -1318,6 +1325,11 @@ |
| 1319 | 1326 | bltfx.dwFillColor = 0;
|
| 1320 | 1327 | sprites[0].surface->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltfx);
|
| 1321 | 1328 | cursor = LoadCursor(NULL, IDC_ARROW);
|
| | 1329 | + GetIconInfo(cursor,&iconinfo);
|
| | 1330 | + hotspotx = iconinfo.xHotspot;
|
| | 1331 | + hotspoty = iconinfo.yHotspot;
|
| | 1332 | + if(iconinfo.hbmColor) DeleteObject(iconinfo.hbmColor);
|
| | 1333 | + if(iconinfo.hbmMask) DeleteObject(iconinfo.hbmMask);
|
| 1322 | 1334 | sprites[0].surface->GetDC(&hRenderDC);
|
| 1323 | 1335 | DrawIcon(hRenderDC, 0, 0, cursor);
|
| 1324 | 1336 | sprites[0].surface->ReleaseDC(hRenderDC);
|
| — | — | @@ -1535,29 +1547,53 @@ |
| 1536 | 1548 | {
|
| 1537 | 1549 | if (!out[i])
|
| 1538 | 1550 | {
|
| 1539 | | - destrect.left = GET_X_LPARAM(lastmouselparam[i]);
|
| 1540 | | - destrect.top = GET_Y_LPARAM(lastmouselparam[i]);
|
| 1541 | | - destrect.right = GET_X_LPARAM(lastmouselparam[i]) + sprites[0].ddsd.dwWidth;
|
| | 1551 | + destrect.left = GET_X_LPARAM(lastmouselparam[i])-hotspotx;
|
| | 1552 | + destrect.top = GET_Y_LPARAM(lastmouselparam[i])-hotspoty;
|
| | 1553 | + destrect.right = (GET_X_LPARAM(lastmouselparam[i])-hotspotx) + sprites[0].ddsd.dwWidth;
|
| 1542 | 1554 | if (destrect.right > width) destrect.right = width;
|
| 1543 | | - destrect.bottom = GET_Y_LPARAM(lastmouselparam[i]) + sprites[0].ddsd.dwHeight;
|
| | 1555 | + destrect.bottom = (GET_Y_LPARAM(lastmouselparam[i])-hotspoty) + sprites[0].ddsd.dwHeight;
|
| 1544 | 1556 | if (destrect.bottom > height) destrect.bottom = height;
|
| 1545 | 1557 | srcrect.left = srcrect.top = 0;
|
| 1546 | | - srcrect.right = destrect.right - destrect.left;
|
| 1547 | | - srcrect.bottom = destrect.bottom - destrect.top;
|
| | 1558 | + if(destrect.left >= 0) srcrect.right = destrect.right - destrect.left;
|
| | 1559 | + else
|
| | 1560 | + {
|
| | 1561 | + srcrect.left = -destrect.left-1;
|
| | 1562 | + destrect.left = 0;
|
| | 1563 | + srcrect.right = sprites[0].ddsd.dwWidth;
|
| | 1564 | + }
|
| | 1565 | + if(destrect.top >= 0) srcrect.bottom = destrect.bottom - destrect.top;
|
| | 1566 | + else
|
| | 1567 | + {
|
| | 1568 | + srcrect.top = -destrect.top-1;
|
| | 1569 | + destrect.top = 0;
|
| | 1570 | + srcrect.bottom = sprites[0].ddsd.dwWidth;
|
| | 1571 | + }
|
| 1548 | 1572 | temp1->Blt(&destrect, sprites[0].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
| 1549 | 1573 | }
|
| 1550 | 1574 | }
|
| 1551 | 1575 | if (!out[8])
|
| 1552 | 1576 | {
|
| 1553 | | - destrect.left = p.x;
|
| 1554 | | - destrect.top = p.y;
|
| 1555 | | - destrect.right = p.x + sprites[1].ddsd.dwWidth;
|
| | 1577 | + destrect.left = p.x-hotspotx;
|
| | 1578 | + destrect.top = p.y-hotspoty;
|
| | 1579 | + destrect.right = (p.x-hotspotx) + sprites[1].ddsd.dwWidth;
|
| 1556 | 1580 | if (destrect.right > width) destrect.right = width;
|
| 1557 | | - destrect.bottom = p.y + sprites[1].ddsd.dwHeight;
|
| | 1581 | + destrect.bottom = (p.y-hotspoty) + sprites[1].ddsd.dwHeight;
|
| 1558 | 1582 | if (destrect.bottom > height) destrect.bottom = height;
|
| 1559 | 1583 | srcrect.left = srcrect.top = 0;
|
| 1560 | | - srcrect.right = destrect.right - destrect.left;
|
| 1561 | | - srcrect.bottom = destrect.bottom - destrect.top;
|
| | 1584 | + if(destrect.left >= 0) srcrect.right = destrect.right - destrect.left;
|
| | 1585 | + else
|
| | 1586 | + {
|
| | 1587 | + srcrect.left = -destrect.left-1;
|
| | 1588 | + destrect.left = 0;
|
| | 1589 | + srcrect.right = sprites[0].ddsd.dwWidth;
|
| | 1590 | + }
|
| | 1591 | + if(destrect.top >= 0) srcrect.bottom = destrect.bottom - destrect.top;
|
| | 1592 | + else
|
| | 1593 | + {
|
| | 1594 | + srcrect.top = -destrect.top-1;
|
| | 1595 | + destrect.top = 0;
|
| | 1596 | + srcrect.bottom = sprites[0].ddsd.dwWidth;
|
| | 1597 | + }
|
| 1562 | 1598 | temp1->Blt(&destrect, sprites[1].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
| 1563 | 1599 | }
|
| 1564 | 1600 | if (backbuffers) temp1->Release();
|
| — | — | @@ -1988,15 +2024,27 @@ |
| 1989 | 2025 | {
|
| 1990 | 2026 | if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 1991 | 2027 | else temp1 = ddsrender;
|
| 1992 | | - destrect.left = (LONG)sprites[0].x;
|
| 1993 | | - destrect.top = (LONG)sprites[0].y;
|
| 1994 | | - destrect.right = (LONG)sprites[0].x + sprites[0].ddsd.dwWidth;
|
| | 2028 | + destrect.left = (LONG)sprites[0].x-hotspotx;
|
| | 2029 | + destrect.top = (LONG)sprites[0].y-hotspoty;
|
| | 2030 | + destrect.right = (LONG)(sprites[0].x-hotspotx) + sprites[0].ddsd.dwWidth;
|
| 1995 | 2031 | if (destrect.right > width) destrect.right = width;
|
| 1996 | | - destrect.bottom = (LONG)sprites[0].y + sprites[0].ddsd.dwHeight;
|
| | 2032 | + destrect.bottom = (LONG)(sprites[0].y-hotspoty) + sprites[0].ddsd.dwHeight;
|
| 1997 | 2033 | if (destrect.bottom > height) destrect.bottom = height;
|
| 1998 | 2034 | srcrect.left = srcrect.top = 0;
|
| 1999 | | - srcrect.right = destrect.right - destrect.left;
|
| 2000 | | - srcrect.bottom = destrect.bottom - destrect.top;
|
| | 2035 | + if(destrect.left >= 0) srcrect.right = destrect.right - destrect.left;
|
| | 2036 | + else
|
| | 2037 | + {
|
| | 2038 | + srcrect.left = -destrect.left-1;
|
| | 2039 | + destrect.left = 0;
|
| | 2040 | + srcrect.right = sprites[0].ddsd.dwWidth;
|
| | 2041 | + }
|
| | 2042 | + if(destrect.top >= 0) srcrect.bottom = destrect.bottom - destrect.top;
|
| | 2043 | + else
|
| | 2044 | + {
|
| | 2045 | + srcrect.top = -destrect.top-1;
|
| | 2046 | + destrect.top = 0;
|
| | 2047 | + srcrect.bottom = sprites[0].ddsd.dwWidth;
|
| | 2048 | + }
|
| 2001 | 2049 | temp1->Blt(&destrect, sprites[0].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
| 2002 | 2050 | if (backbuffers) temp1->Release();
|
| 2003 | 2051 | }
|