Fix cross-hair on magnifier in color panel

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@35996 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2013-01-18 01:29:06 +00:00
parent a91ebbd8b8
commit 1c5a0d1e0a

View file

@ -2484,15 +2484,16 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
HBITMAP hOldAndMaskBitmap = (HBITMAP)SelectObject(hAndMaskDC, hAndMaskBitmap); HBITMAP hOldAndMaskBitmap = (HBITMAP)SelectObject(hAndMaskDC, hAndMaskBitmap);
HBITMAP hOldXorMaskBitmap = (HBITMAP)SelectObject(hXorMaskDC, hXorMaskBitmap); HBITMAP hOldXorMaskBitmap = (HBITMAP)SelectObject(hXorMaskDC, hXorMaskBitmap);
//S can each pixel of the souce bitmap and create the masks // Scan each pixel of the souce bitmap and create the masks
int x; int x;
int *pixel = [rep bitmapData];
for(x = 0; x < bm.bmWidth; ++x) for(x = 0; x < bm.bmWidth; ++x)
{ {
int y; int y;
for (y = 0; y < bm.bmHeight; ++y) for (y = 0; y < bm.bmHeight; ++y)
{ {
COLORREF MainBitPixel = GetPixel(hMainDC, x, y); COLORREF MainBitPixel = GetPixel(hMainDC, x, y);
if (MainBitPixel == RGB(0, 0, 0)) if (*pixel++ == 0x00000000)
{ {
SetPixel(hAndMaskDC, x, y, RGB(255, 255, 255)); SetPixel(hAndMaskDC, x, y, RGB(255, 255, 255));
SetPixel(hXorMaskDC, x, y, RGB(0, 0, 0)); SetPixel(hXorMaskDC, x, y, RGB(0, 0, 0));
@ -2505,6 +2506,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
} }
} }
// Reselect the old bitmap objects...
SelectObject(hMainDC, hOldMainBitmap); SelectObject(hMainDC, hOldMainBitmap);
SelectObject(hAndMaskDC, hOldAndMaskBitmap); SelectObject(hAndMaskDC, hOldAndMaskBitmap);
SelectObject(hXorMaskDC, hOldXorMaskBitmap); SelectObject(hXorMaskDC, hOldXorMaskBitmap);
@ -2526,9 +2528,9 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
DeleteDC(hMainDC); DeleteDC(hMainDC);
// Cleanup the bitmaps... // Cleanup the bitmaps...
DeleteObject(hOldXorMaskBitmap); DeleteObject(hXorMaskBitmap);
DeleteObject(hOldAndMaskBitmap); DeleteObject(hAndMaskBitmap);
DeleteObject(hOldMainBitmap); DeleteObject(hSourceBitmap);
// Release the screen HDC... // Release the screen HDC...
ReleaseDC(NULL,hDC); ReleaseDC(NULL,hDC);
@ -2565,12 +2567,19 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (void) freecursor: (void*) cid - (void) freecursor: (void*) cid
{ {
// This is only allowed on non-shared cursors and we have no way of knowing that. // This is only allowed on non-shared cursors - currently limited to ones
HCURSOR cursorId = [[systemCursors objectForKey:[NSValue valueWithPointer:(HCURSOR)cid]] pointerValue]; // that we create upon request...
if ((cursorId == NULL) || (cursorId != (HCURSOR)cid)) HCURSOR cursorId = [systemCursors objectForKey:[NSValue valueWithPointer:(HCURSOR)cid]];
NSWarnMLog(@"trying to free a cursor not created by us: %p", cid); if (cursorId == NULL)
{
NSWarnMLog(@"trying to free a cursor not created by us: %p", cid);
}
else else
DestroyCursor((HCURSOR)cid); {
// Remove the entry and destroy the cursor...
[systemCursors removeObjectForKey:[NSValue valueWithPointer:(HCURSOR)cid]];
DestroyCursor((HCURSOR)cid);
}
} }
- (void) setParentWindow: (int)parentWin - (void) setParentWindow: (int)parentWin