--- a/WinWorkstation.st Tue Mar 25 10:01:41 2014 +0100
+++ b/WinWorkstation.st Tue Mar 25 13:14:50 2014 +0100
@@ -9923,7 +9923,7 @@
!WinWorkstation methodsFor:'drawing'!
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId
- width:w height:h
+ width:w height:h
"do a bit-blt; copy bits from the rectangle defined by
srcX/srcY and w/h from the sourceId drawable to the rectangle
below dstX/dstY in the destId drawable. Trigger an error if any
@@ -9940,7 +9940,7 @@
if (! __isExternalAddress(srcGCId)
|| ! __isExternalAddress(dstGCId)) {
- goto fail;
+ goto fail;
}
srcGcData = _GCDATA(srcGCId);
dstGcData = _GCDATA(dstGCId);
@@ -9950,229 +9950,229 @@
&& __bothSmallInteger(dstX, dstY)
&& srcGcData
&& dstGcData) {
- int fun = BITBLT_COPY;
- int src_fg, src_bg, dst_fg, dst_bg;
-
- fun = dstGcData->bitbltrop2;
-#if 0
- switch (fun) {
- case BITBLT_COPY:
- console_printf("BITBLT_COPY\n");
- break;
- case BITBLT_COPYINVERTED:
- console_printf("BITBLT_COPYINVERTED\n");
- break;
- case BITBLT_XOR:
- console_printf("BITBLT_XOR\n");
- break;
- case BITBLT_AND:
- console_printf("BITBLT_AND\n");
- break;
- case BITBLT_OR:
- console_printf("BITBLT_OR\n");
- break;
- }
-#endif
-
- /*
- * a scroll operation ?
- */
- if (srcGcData->hWnd
- && ((srcGcData->hWnd == dstGcData->hWnd)
- && (fun == BITBLT_COPY))) {
- RECT rec, updRect;
- RECT invRec;
- HRGN updRgn = 0, dstRgn = 0, nUpdRgn = 0;
- int _srcX = __intVal(srcX);
- int _srcY = __intVal(srcY);
- int _dstX = __intVal(dstX);
- int _dstY = __intVal(dstY);
- int _w = __intVal(w);
- int _h = __intVal(h);
- int noExpose = 0;
- int _deltaX, _deltaY;
+ int fun = BITBLT_COPY;
+ int src_fg, src_bg, dst_fg, dst_bg;
+
+ fun = dstGcData->bitbltrop2;
+#if 0
+ switch (fun) {
+ case BITBLT_COPY:
+ console_printf("BITBLT_COPY\n");
+ break;
+ case BITBLT_COPYINVERTED:
+ console_printf("BITBLT_COPYINVERTED\n");
+ break;
+ case BITBLT_XOR:
+ console_printf("BITBLT_XOR\n");
+ break;
+ case BITBLT_AND:
+ console_printf("BITBLT_AND\n");
+ break;
+ case BITBLT_OR:
+ console_printf("BITBLT_OR\n");
+ break;
+ }
+#endif
+
+ /*
+ * a scroll operation ?
+ */
+ if (srcGcData->hWnd
+ && ((srcGcData->hWnd == dstGcData->hWnd)
+ && (fun == BITBLT_COPY))) {
+ RECT rec, updRect;
+ RECT invRec;
+ HRGN updRgn = 0, dstRgn = 0, nUpdRgn = 0;
+ int _srcX = __intVal(srcX);
+ int _srcY = __intVal(srcY);
+ int _dstX = __intVal(dstX);
+ int _dstY = __intVal(dstY);
+ int _w = __intVal(w);
+ int _h = __intVal(h);
+ int noExpose = 0;
+ int _deltaX, _deltaY;
#ifdef CACHE_LAST_DC
- if (lastGcData) {
- _releaseDC(lastGcData);
- }
-#endif
-
- rec.left = _srcX;
- rec.top = _srcY;
- rec.right = rec.left + _w;
- rec.bottom = rec.top + _h;
-
- _deltaX = _dstX - _srcX;
- _deltaY = _dstY - _srcY;
-
- DDPRINTF(("dst and src is HWND %x fun == BITBLT_COPY --> scroll %d/%d\n",
- srcGcData->hWnd,
- _deltaX,
- _deltaY));
-
- if ((_deltaX == 0) && (_deltaY == 0)) {
- noExpose = 1;
- } else {
- updRgn = CreateRectRgn(0, 0, 0, 0);
- ScrollWindowEx(srcGcData->hWnd,
- _deltaX,
- _deltaY,
- &rec, /* area to scroll */
- 0, /* clip region */
- updRgn,
- NULL, /* &invRec, */
- 0 /* SW_ERASE | SW_INVALIDATE */);
-
- /*
- * we are not interested in the source-area;
- * only care for exposed areas in the dst area.
- */
- dstRgn = CreateRectRgn(_dstX, _dstY, _dstX+_w, _dstY+_h);
- nUpdRgn = CreateRectRgn(0, 0, 0, 0);
- switch (CombineRgn(nUpdRgn, updRgn, dstRgn, RGN_AND)) {
- case ERROR:
- _DeleteObject(nUpdRgn, __LINE__);
- nUpdRgn = updRgn;
- noExpose = 1;
- break;
- case NULLREGION:
- noExpose = 1;
- break;
- default:
- if (__generateExposes(srcGcData->hWnd, nUpdRgn, __WM_GEXPOSE, 1) <= 0) {
- noExpose = 1;
- }
- break;
- }
- }
- if (noExpose) {
- /*
- * no exposes generated - must send a NOEXPOSE
- */
- enqEvent(ExposureMask, srcGcData->hWnd, __WM_NOGEXPOSE, 0, 0, 0, 0, 0, EV_NOTIME);
- }
-
- if (dstRgn) {
- _DeleteObject(dstRgn, __LINE__);
- }
- if (nUpdRgn && (nUpdRgn != updRgn)) {
- _DeleteObject(nUpdRgn, __LINE__);
- }
- if (updRgn) {
- _DeleteObject(updRgn, __LINE__);
- }
- RETURN ( self );
- }
-
- fun = dstGcData->bitbltrop2;
-
- if (0 /* fun == BITBLT_COPY */) {
- src_fg = dst_fg = 0xFFFFFF;
- src_bg = dst_bg = 0x000000;
- } else {
- src_fg = srcGcData->fgColor;
- src_bg = srcGcData->bgColor;
- dst_fg = dstGcData->fgColor;
- dst_bg = dstGcData->bgColor;
- }
-
- /*
- * a simple copy (like scroll, but in a bitmap) ?
- */
- if ((srcGcData == dstGcData)
- && (fun == BITBLT_COPY)) {
- RECT rec, uprec;
- int _srcX, _srcY;
-
- rec.left = _srcX = __intVal(srcX);
- rec.top = _srcY = __intVal(srcY);
- rec.right = rec.left + __intVal(w);
- rec.bottom = rec.top + __intVal(h);
- srcDC = _getDC(srcGcData);
- SetBkColor(srcDC, src_fg);
- SetTextColor(srcDC, src_bg);
-
- DDPRINTF(("dst and src is DC %x fun == BITBLT_COPY --> scrolling %d %d\n",srcDC,__intVal(dstX) - __intVal(srcX),__intVal(dstY) - __intVal(srcY)));
- ScrollDC(srcDC, __intVal(dstX)-_srcX,
- __intVal(dstY)-_srcY,
- &rec, 0, 0, &uprec);
-
- SetBkColor(srcDC, srcGcData->bgColor);
- SetTextColor(srcDC, srcGcData->fgColor);
+ if (lastGcData) {
+ _releaseDC(lastGcData);
+ }
+#endif
+
+ rec.left = _srcX;
+ rec.top = _srcY;
+ rec.right = rec.left + _w;
+ rec.bottom = rec.top + _h;
+
+ _deltaX = _dstX - _srcX;
+ _deltaY = _dstY - _srcY;
+
+ DDPRINTF(("dst and src is HWND %x fun == BITBLT_COPY --> scroll %d/%d\n",
+ srcGcData->hWnd,
+ _deltaX,
+ _deltaY));
+
+ if ((_deltaX == 0) && (_deltaY == 0)) {
+ noExpose = 1;
+ } else {
+ updRgn = CreateRectRgn(0, 0, 0, 0);
+ ScrollWindowEx(srcGcData->hWnd,
+ _deltaX,
+ _deltaY,
+ &rec, /* area to scroll */
+ 0, /* clip region */
+ updRgn,
+ NULL, /* &invRec, */
+ 0 /* SW_ERASE | SW_INVALIDATE */);
+
+ /*
+ * we are not interested in the source-area;
+ * only care for exposed areas in the dst area.
+ */
+ dstRgn = CreateRectRgn(_dstX, _dstY, _dstX+_w, _dstY+_h);
+ nUpdRgn = CreateRectRgn(0, 0, 0, 0);
+ switch (CombineRgn(nUpdRgn, updRgn, dstRgn, RGN_AND)) {
+ case ERROR:
+ _DeleteObject(nUpdRgn, __LINE__);
+ nUpdRgn = updRgn;
+ noExpose = 1;
+ break;
+ case NULLREGION:
+ noExpose = 1;
+ break;
+ default:
+ if (__generateExposes(srcGcData->hWnd, nUpdRgn, __WM_GEXPOSE, 1) <= 0) {
+ noExpose = 1;
+ }
+ break;
+ }
+ }
+ if (noExpose) {
+ /*
+ * no exposes generated - must send a NOEXPOSE
+ */
+ enqEvent(ExposureMask, srcGcData->hWnd, __WM_NOGEXPOSE, 0, 0, 0, 0, 0, EV_NOTIME);
+ }
+
+ if (dstRgn) {
+ _DeleteObject(dstRgn, __LINE__);
+ }
+ if (nUpdRgn && (nUpdRgn != updRgn)) {
+ _DeleteObject(nUpdRgn, __LINE__);
+ }
+ if (updRgn) {
+ _DeleteObject(updRgn, __LINE__);
+ }
+ RETURN ( self );
+ }
+
+ fun = dstGcData->bitbltrop2;
+
+ if (0 /* fun == BITBLT_COPY */) {
+ src_fg = dst_fg = 0xFFFFFF;
+ src_bg = dst_bg = 0x000000;
+ } else {
+ src_fg = srcGcData->fgColor;
+ src_bg = srcGcData->bgColor;
+ dst_fg = dstGcData->fgColor;
+ dst_bg = dstGcData->bgColor;
+ }
+
+ /*
+ * a simple copy (like scroll, but in a bitmap) ?
+ */
+ if ((srcGcData == dstGcData)
+ && (fun == BITBLT_COPY)) {
+ RECT rec, uprec;
+ int _srcX, _srcY;
+
+ rec.left = _srcX = __intVal(srcX);
+ rec.top = _srcY = __intVal(srcY);
+ rec.right = rec.left + __intVal(w);
+ rec.bottom = rec.top + __intVal(h);
+ srcDC = _getDC(srcGcData);
+ SetBkColor(srcDC, src_fg);
+ SetTextColor(srcDC, src_bg);
+
+ DDPRINTF(("dst and src is DC %x fun == BITBLT_COPY --> scrolling %d %d\n",srcDC,__intVal(dstX) - __intVal(srcX),__intVal(dstY) - __intVal(srcY)));
+ ScrollDC(srcDC, __intVal(dstX)-_srcX,
+ __intVal(dstY)-_srcY,
+ &rec, 0, 0, &uprec);
+
+ SetBkColor(srcDC, srcGcData->bgColor);
+ SetTextColor(srcDC, srcGcData->fgColor);
#ifndef CACHE_LAST_DC
- _releaseDC(srcGcData);
-#endif
- RETURN ( self );
- }
+ _releaseDC(srcGcData);
+#endif
+ RETURN ( self );
+ }
#ifdef xxCACHE_LAST_DC
/* mhmh - this should not be needed */
- if (lastGcData) {
- _releaseDC(lastGcData);
- }
-#endif
-
- if (dstGcData == srcGcData) {
- srcDC = dstDC = _getDC(dstGcData);
- } else {
- srcDC = _getDC(srcGcData);
-
- /*
- * kludge - pretent nothing is cached for a moment,
- * to avoid release in getDC below ...
- */
+ if (lastGcData) {
+ _releaseDC(lastGcData);
+ }
+#endif
+
+ if (dstGcData == srcGcData) {
+ srcDC = dstDC = _getDC(dstGcData);
+ } else {
+ srcDC = _getDC(srcGcData);
+
+ /*
+ * kludge - pretent nothing is cached for a moment,
+ * to avoid release in getDC below ...
+ */
#ifdef CACHE_LAST_DC
- dstGcOwnerThreadID = lastGcOwnerThreadID;
- dstGcHWIN = lastGcHWIN;
- dstGcHBITMAP = lastGcHBITMAP;
- lastGcData = 0;
-#endif
-
- dstDC = _getDC(dstGcData);
- SetBkColor(dstDC, dst_fg);
- SetTextColor(dstDC, dst_bg);
- }
-
- SetBkColor(srcDC, src_fg);
- SetTextColor(srcDC, src_bg);
-
- CPRINTF(("bitblt src f:%x b:%x",GetTextColor(srcDC),GetBkColor(srcDC)));
- CPRINTF(("dst f:%x b:%x\n",GetTextColor(dstDC),GetBkColor(dstDC)));
- if (BitBlt(dstDC,
- __intVal(dstX), __intVal(dstY),
- __intVal(w), __intVal(h),
- srcDC,
- __intVal(srcX), __intVal(srcY),
- fun)
- == 0
- ) {
- console_fprintf(stderr, "WinWorkstation [info]: ERROR in BitBlt\n");
- }
-
- if (dstGcData != srcGcData) {
- SetBkColor(dstDC, dstGcData->bgColor);
- SetTextColor(dstDC, dstGcData->fgColor);
- }
- SetBkColor(srcDC, srcGcData->bgColor);
- SetTextColor(srcDC, srcGcData->fgColor);
-
- if (srcGcData != dstGcData) {
- _releaseDC(srcGcData);
- }
+ dstGcOwnerThreadID = lastGcOwnerThreadID;
+ dstGcHWIN = lastGcHWIN;
+ dstGcHBITMAP = lastGcHBITMAP;
+ lastGcData = 0;
+#endif
+
+ dstDC = _getDC(dstGcData);
+ SetBkColor(dstDC, dst_fg);
+ SetTextColor(dstDC, dst_bg);
+ }
+
+ SetBkColor(srcDC, src_fg);
+ SetTextColor(srcDC, src_bg);
+
+ CPRINTF(("bitblt src f:%x b:%x",GetTextColor(srcDC),GetBkColor(srcDC)));
+ CPRINTF(("dst f:%x b:%x\n",GetTextColor(dstDC),GetBkColor(dstDC)));
+ if (BitBlt(dstDC,
+ __intVal(dstX), __intVal(dstY),
+ __intVal(w), __intVal(h),
+ srcDC,
+ __intVal(srcX), __intVal(srcY),
+ fun)
+ == 0
+ ) {
+ console_fprintf(stderr, "WinWorkstation [info]: ERROR in BitBlt: %d\n", GetLastError());
+ }
+
+ if (dstGcData != srcGcData) {
+ SetBkColor(dstDC, dstGcData->bgColor);
+ SetTextColor(dstDC, dstGcData->fgColor);
+ }
+ SetBkColor(srcDC, srcGcData->bgColor);
+ SetTextColor(srcDC, srcGcData->fgColor);
+
+ if (srcGcData != dstGcData) {
+ _releaseDC(srcGcData);
+ }
#ifdef CACHE_LAST_DC
- /*
- * kludge again - restore last-DC cache
- */
- lastGcData = dstGcData;
- lastGcOwnerThreadID = dstGcOwnerThreadID;
- lastGcHWIN = dstGcHWIN;
- lastGcHBITMAP = dstGcHBITMAP;
-#else
- _releaseDC(dstGcData);
-#endif
- RETURN ( self );
+ /*
+ * kludge again - restore last-DC cache
+ */
+ lastGcData = dstGcData;
+ lastGcOwnerThreadID = dstGcOwnerThreadID;
+ lastGcHWIN = dstGcHWIN;
+ lastGcHBITMAP = dstGcHBITMAP;
+#else
+ _releaseDC(dstGcData);
+#endif
+ RETURN ( self );
}
fail: ;
@@ -19329,11 +19329,11 @@
!WinWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.479 2014-01-24 14:51:26 ab Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.480 2014-03-25 12:14:50 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.479 2014-01-24 14:51:26 ab Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.480 2014-03-25 12:14:50 stefan Exp $'
! !