Mercurial > projects > dwt-win
diff dwt/graphics/GC.d @ 117:25f88bf5a6df
Only one file was damaged
Backed out changeset 640928daee8c
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 11 Feb 2008 04:18:24 +0100 |
parents | 640928daee8c |
children | 3afcd4ddcf90 |
line wrap: on
line diff
--- a/dwt/graphics/GC.d Mon Feb 11 04:05:55 2008 +0100 +++ b/dwt/graphics/GC.d Mon Feb 11 04:18:24 2008 +0100 @@ -553,25 +553,27 @@ * vertical and horizontal scrolling. The fix is to do a * BitBlt and invalidate the appropriate source area. */ - if (res is 0 && OS.IsWinCE) { - OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY); - if (paint) { - int deltaX = destX - srcX, deltaY = destY - srcY; - bool disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY); - if (disjoint) { - OS.InvalidateRect(hwnd, &lprcScroll, true); - } else { - if (deltaX !is 0) { - int newX = destX - deltaX; - if (deltaX < 0) newX = destX + width; - OS.SetRect(&lprcScroll, newX, srcY, newX + Math.abs(deltaX), srcY + height); + static if (OS.IsWinCE) { + if (res is 0) { + OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY); + if (paint) { + int deltaX = destX - srcX, deltaY = destY - srcY; + bool disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY); + if (disjoint) { OS.InvalidateRect(hwnd, &lprcScroll, true); - } - if (deltaY !is 0) { - int newY = destY - deltaY; - if (deltaY < 0) newY = destY + height; - OS.SetRect(&lprcScroll, srcX, newY, srcX + width, newY + Math.abs(deltaY)); - OS.InvalidateRect(hwnd, &lprcScroll, true); + } else { + if (deltaX !is 0) { + int newX = destX - deltaX; + if (deltaX < 0) newX = destX + width; + OS.SetRect(&lprcScroll, newX, srcY, newX + Math.abs(deltaX), srcY + height); + OS.InvalidateRect(hwnd, &lprcScroll, true); + } + if (deltaY !is 0) { + int newY = destY - deltaY; + if (deltaY < 0) newY = destY + height; + OS.SetRect(&lprcScroll, srcX, newY, srcX + width, newY + Math.abs(deltaY)); + OS.InvalidateRect(hwnd, &lprcScroll, true); + } } } } @@ -768,7 +770,7 @@ * WinCE SDK. The fix is to emulate arc drawing by using * Polyline. */ - if (OS.IsWinCE) { + static if (OS.IsWinCE) { /* compute arc with a simple linear interpolation */ if (arcAngle < 0) { startAngle += arcAngle; @@ -1057,7 +1059,7 @@ /* Get the icon info */ ICONINFO srcIconInfo; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { Image.GetIconInfo(srcImage, &srcIconInfo); } else { OS.GetIconInfo(srcImage.handle, &srcIconInfo); @@ -1109,7 +1111,7 @@ auto oldDestBitmap = OS.SelectObject(dstHdc, newIconInfo.hbmColor); bool stretch = !simple && (srcWidth !is destWidth || srcHeight !is destHeight); if (stretch) { - if (!OS.IsWinCE) OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR); + static if (!OS.IsWinCE) OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR); OS.StretchBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCCOPY); } else { OS.BitBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, OS.SRCCOPY); @@ -1336,7 +1338,7 @@ if (tempDib is null) DWT.error(DWT.ERROR_NO_HANDLES); auto oldTempBitmap = OS.SelectObject(tempHdc, tempDib); if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) { - if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR); + static if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR); OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY); } else { OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY); @@ -1347,7 +1349,7 @@ OS.DeleteDC(tempHdc); } else { if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) { - if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR); + static if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR); OS.StretchBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY); } else { OS.BitBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY); @@ -1412,7 +1414,7 @@ if (result is 1) OS.CombineRgn(rgn, rgn, clip, OS.RGN_AND); OS.SelectClipRgn(handle, rgn); int rop2 = 0; - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { rop2 = OS.GetROP2(handle); } else { rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN); @@ -1421,9 +1423,9 @@ int dwRop = rop2 is OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY; if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) { int mode = 0; - if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR); + static if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR); OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop); - if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode); + static if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode); } else { OS.BitBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, dwRop); } @@ -1458,13 +1460,13 @@ } if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) { int mode = 0; - if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR); + static if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR); OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCINVERT); OS.SelectObject(srcHdc, srcMask); OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND); OS.SelectObject(srcHdc, srcColor); OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCINVERT); - if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode); + static if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode); } else { OS.BitBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, OS.SRCINVERT); OS.SetTextColor(destHdc, 0); @@ -1498,7 +1500,7 @@ if (bm.bmBitsPixel <= 8) { if (isDib) { /* Palette-based DIBSECTION */ - if (OS.IsWinCE) { + static if (OS.IsWinCE) { byte* pBits = cast(byte*)bm.bmBits; //OS.MoveMemory(pBits, bm.bmBits, 1); byte oldValue = pBits[0]; @@ -1549,7 +1551,7 @@ bmiHeader.biBitCount = bm.bmBitsPixel; byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + numColors * 4]; bmi[] = (cast(byte*)&bmiHeader)[ 0 .. BITMAPINFOHEADER.sizeof ]; - if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED); + static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED); OS.GetDIBits(srcHdc, srcImage.handle, 0, 0, null, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS); int offset = BITMAPINFOHEADER.sizeof + 4 * srcImage.transparentPixel; transRed = bmi[offset + 2] & 0xFF; @@ -1610,7 +1612,7 @@ auto oldTempBitmap = OS.SelectObject(tempHdc, tempBitmap); OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, handle, destX, destY, OS.SRCCOPY); if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) { - if (!OS.IsWinCE) OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR); + static if (!OS.IsWinCE) OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR); OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT); OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, maskHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND); OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT); @@ -1637,7 +1639,7 @@ auto srcHdc = OS.CreateCompatibleDC(handle); auto oldSrcBitmap = OS.SelectObject(srcHdc, srcImage.handle); int rop2 = 0; - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { rop2 = OS.GetROP2(handle); } else { rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN); @@ -1646,9 +1648,9 @@ int dwRop = rop2 is OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY; if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) { int mode = 0; - if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR); + static if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR); OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop); - if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode); + static if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode); } else { OS.BitBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, dwRop); } @@ -1685,7 +1687,7 @@ x2--; } } - if (OS.IsWinCE) { + static if (OS.IsWinCE) { int [] points = [x1, y1, x2, y2]; OS.Polyline (handle, cast(POINT*)points.ptr, points.length / 2); } else { @@ -1985,7 +1987,7 @@ if ((data.style & DWT.MIRRORED) !is 0) { if (data.lineWidth !is 0 && data.lineWidth % 2 is 0) x--; } - if (OS.IsWinCE) { + static if (OS.IsWinCE) { /* * Bug in WinCE PPC. On certain devices, RoundRect does not draw * all the pixels. The workaround is to draw a round rectangle @@ -2176,7 +2178,7 @@ return; } int rop2 = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { rop2 = OS.SetROP2(handle, OS.R2_COPYPEN); OS.SetROP2(handle, rop2); } else { @@ -2400,7 +2402,7 @@ uFormat |= OS.DT_HIDEPREFIX; } int rop2 = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { rop2 = OS.SetROP2(handle, OS.R2_COPYPEN); OS.SetROP2(handle, rop2); } else { @@ -2517,7 +2519,7 @@ * Feature in WinCE. The function Pie is not present in the * WinCE SDK. The fix is to emulate it by using Polygon. */ - if (OS.IsWinCE) { + static if (OS.IsWinCE) { /* compute arc with a simple linear interpolation */ if (arcAngle < 0) { startAngle += arcAngle; @@ -2651,7 +2653,7 @@ * GradientFill for printer devices. */ int rop2 = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { rop2 = OS.SetROP2(handle, OS.R2_COPYPEN); OS.SetROP2(handle, rop2); } else { @@ -2821,7 +2823,7 @@ return; } int rop2 = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { rop2 = OS.SetROP2(handle, OS.R2_COPYPEN); OS.SetROP2(handle, rop2); } else { @@ -3267,7 +3269,7 @@ */ public int getFillRule() { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (OS.IsWinCE) return DWT.FILL_EVEN_ODD; + static if (OS.IsWinCE) return DWT.FILL_EVEN_ODD; return OS.GetPolyFillMode(handle) is OS.WINDING ? DWT.FILL_WINDING : DWT.FILL_EVEN_ODD; } @@ -3613,7 +3615,7 @@ public bool getXORMode() { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); int rop2 = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN); OS.SetROP2 (handle, rop2); } else { @@ -3691,7 +3693,7 @@ width = rect.right - rect.left; } POINT pt; - if (!OS.IsWinCE) OS.GetWindowOrgEx (handle, &pt); + static if (!OS.IsWinCE) OS.GetWindowOrgEx (handle, &pt); return Gdip.Matrix_new(-1, 0, 0, 1, width + 2 * pt.x, 0); } return Gdip.Matrix_new(1, 0, 0, 1, 0, 0); @@ -4148,7 +4150,7 @@ */ public void setFillRule(int rule) { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (OS.IsWinCE) return; + static if (OS.IsWinCE) return; int mode = OS.ALTERNATE; switch (rule) { case DWT.FILL_WINDING: mode = OS.WINDING; break;