--- mstools/samples/mandel/bndscan.c 2018/08/09 18:20:41 1.1 +++ mstools/samples/mandel/bndscan.c 2018/08/09 18:23:43 1.1.1.3 @@ -6,7 +6,7 @@ * Created: 14-Apr-1992 10:59:52 * Author: Petrus Wong * -* Copyright (c) 1990 Microsoft Corporation +* Copyright (c) 1993 Microsoft Corporation * * Dependencies: * @@ -18,9 +18,6 @@ #include "jtypes.h" #include "bndscan.h" -extern LONG lMul(LONG, LONG); -extern LONG lDiv(LONG, LONG); - BOOL bBoundaryScanFix(PINFO); LPPOINT pptTrace(LONG, LONG, PINFO, INT *, HDC); DWORD dwGetNextBoundaryPoint(DWORD, POINT, LPPOINT, PINFO); @@ -94,7 +91,7 @@ BOOL bBoundaryScanFix(PINFO pInfo) BOUNDTRACE: - SelectObject(hDC, hpnGreen); + SelectObject(hDC, hpnBlack); if ((lpPt = pptTrace(o, p, pInfo, &iCount, hDC)) == NULL) { m = o+1; @@ -152,10 +149,11 @@ BOUNDTRACE: #if 0 // - // SelectClipPath doesn't seem to work at this time + // Can't use SelectClipPath to set the clipping region here + // because we are on a different thread. This is only a cached DC. // if (SelectClipPath(hDC, RGN_COPY)) { - // + // Testing if the clip region is effective or not // //MoveToEx(hDC, 0, 0, NULL); @@ -166,24 +164,14 @@ BOUNDTRACE: } if (pInfo->hRgnPath != (HRGN) NULL) { - if (SelectClipRgn(hDC, pInfo->hRgnPath) == ERROR) { - sprintf( gtext,"Error in Selecting clip region\n"); - OutputDebugString( gtext ); - goto EXIT; - } // - // Testing if the clip region is effective or not + // let the main thread who owns the DC to set the clipping region. // - //MoveToEx(hDC, 0, 0, NULL); - //GetClientRect(pInfo->hwnd, &rc); - //LineTo(hDC, rc.right, rc.bottom); + SendMessage(ghwndMain, WM_COMMAND, MM_SELCLIPRGN, 0L); } - -EXIT: - pInfo->dwElapsed = GetTickCount() - dwTick1; - pInfo->hBmpSaved = SaveBitmap(pInfo->hwnd); + pInfo->hBmpSaved = SaveBitmap(pInfo->hwnd, pInfo->hPal); pInfo->bDrawing = FALSE; ReleaseDC(pInfo->hwnd, hDC); @@ -192,9 +180,6 @@ EXIT: // GlobalFree((HANDLE) lpPt); ExitThread(0); - if (!CloseHandle(pInfo->hThrd)) - MessageBox(ghwndMain, "Failed in CloseHandle!", "Error", MB_OK); - return TRUE; } @@ -364,6 +349,7 @@ DWORD dwGetNextBoundaryPoint(DWORD dwFac * Warnings: * * History: +* 16-Feb-1993 Petrus Wong 9.23 fix * 20-Feb-1992 -by- Petrus Wong * Wrote it. \**************************************************************************/ @@ -390,7 +376,7 @@ BOOL bEscape(POINT Pt, LONG x, LONG y, L y = y1; // 2 2 2 1/2 2 z = lMul(x, x) + lMul(y, y); // |Z| = ((x1 + x2 ) ) > 2 - if (z > 8192) { + if (z > 33554432) { bEscape = TRUE; break; }