Thu Jan 13 11:45:13 1994 John Richardson <jrichard@cs.uml.edu> * [window/win.c] Added functions EnableWindow, IsWindowEnabled, and helper WIN_SetSensitive. * [window/event.c] Added checks for WS_DISABLED windows in EVENT_key, EVENT_MotionNotify, EVENT_ButtonPress, EVENT_ButtonRelease, EVENT_ConfigureNotify, EVENT_FocusIn, EVENT_FocusOut, and EVENT_EnterNotify. Key and button presses beep for a disabled window. If anyone finds better places for these checks, please tell me. Jan 17, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [misc/message.c] Cleanup on buttons answer value returned. * [control/combo.c] Now use OBM_COMBO bitmap dropdown button. Mon Jan 17 21:56:45 1994 Erik Bos (erik@trashcan.hacktic.nl) * [misc/comm/c] A few bugfixes. Tue Jan 18 06:36:48 1994 julliard@di.epfl.ch (Alexandre Julliard) * [loader/cursor.c] Added X cursor for IDC_SIZENS and IDC_SIZEWE. * [include/options.h] [misc/main.c] (New files) Rewrote main() function to get rid of Xt application context, and added command-line option parsing. * [objects/color.c] Use of a private map now configurable with command-line option. * [windows/defwnd.c] Added WM_SYSCOMMAND handling, and better WM_SETCURSOR handling. * [windows/event.c] Removed ConfigureNotify event handler (no longer needed). * [windows/message.c] Send WM_SETCURSOR message on mouse events. * [windows/nonclient.c] Use OEM bitmaps for the drawing of the non-client area. Added caption bar buttons handling, and moving and resizing of the window via the window frame (bypassing the window manager). * [windows/painting.c] Bug fix in BeginPaint(). * [windows/win.c] Set the override_redirect flag for windows (to bypass window manager). * [windows/winpos.c] Implemented WindowFromPoint(), ChildWindowFromPoint(), BringWindowToTop(), Get/SetInternalWindowPos(), Get/SetWindowPlacement(). Mon Jan 17 20:48:24 1994 Bob Amstadt (bob@pooh) * [memory/heap.c] Added support for multiple local heaps.
186 lines
5.5 KiB
C
186 lines
5.5 KiB
C
/*
|
|
* GDI bit-blit operations
|
|
*
|
|
* Copyright 1993 Alexandre Julliard
|
|
*/
|
|
|
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <X11/Xlib.h>
|
|
|
|
#include "gdi.h"
|
|
|
|
extern const int DC_XROPfunction[];
|
|
|
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
|
|
|
|
|
/***********************************************************************
|
|
* PatBlt (GDI.29)
|
|
*/
|
|
BOOL PatBlt( HDC hdc, short left, short top,
|
|
short width, short height, DWORD rop)
|
|
{
|
|
int x1, x2, y1, y2;
|
|
|
|
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
|
|
if (!dc) return FALSE;
|
|
#ifdef DEBUG_GDI
|
|
printf( "PatBlt: %d %d,%d %dx%d %06x\n",
|
|
hdc, left, top, width, height, rop );
|
|
#endif
|
|
|
|
rop >>= 16;
|
|
if (!DC_SetupGCForBrush( dc )) rop &= 0x0f;
|
|
else rop = (rop & 0x03) | ((rop >> 4) & 0x0c);
|
|
XSetFunction( XT_display, dc->u.x.gc, DC_XROPfunction[rop] );
|
|
|
|
x1 = dc->w.DCOrgX + XLPTODP( dc, left );
|
|
x2 = dc->w.DCOrgX + XLPTODP( dc, left + width );
|
|
y1 = dc->w.DCOrgY + YLPTODP( dc, top );
|
|
y2 = dc->w.DCOrgY + YLPTODP( dc, top + height );
|
|
XFillRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc,
|
|
MIN(x1,x2), MIN(y1,y2), abs(x2-x1), abs(y2-y1) );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BitBlt (GDI.34)
|
|
*/
|
|
BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
|
|
HDC hdcSrc, short xSrc, short ySrc, DWORD rop )
|
|
{
|
|
int xs1, xs2, ys1, ys2;
|
|
int xd1, xd2, yd1, yd2;
|
|
DC *dcDest, *dcSrc;
|
|
|
|
#ifdef DEBUG_GDI
|
|
printf( "BitBlt: %d %d,%d %dx%d %d %d,%d %08x\n",
|
|
hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, rop );
|
|
#endif
|
|
|
|
if ((rop & 0xcc0000) == ((rop & 0x330000) << 2))
|
|
return PatBlt( hdcDest, xDest, yDest, width, height, rop );
|
|
|
|
rop >>= 16;
|
|
if ((rop & 0x0f) != (rop >> 4))
|
|
{
|
|
printf( "BitBlt: Unimplemented ROP %02x\n", rop );
|
|
return FALSE;
|
|
}
|
|
|
|
dcDest = (DC *) GDI_GetObjPtr( hdcDest, DC_MAGIC );
|
|
if (!dcDest) return FALSE;
|
|
dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC );
|
|
if (!dcSrc) return FALSE;
|
|
|
|
xs1 = dcSrc->w.DCOrgX + XLPTODP( dcSrc, xSrc );
|
|
xs2 = dcSrc->w.DCOrgX + XLPTODP( dcSrc, xSrc + width );
|
|
ys1 = dcSrc->w.DCOrgY + YLPTODP( dcSrc, ySrc );
|
|
ys2 = dcSrc->w.DCOrgY + YLPTODP( dcSrc, ySrc + height );
|
|
xd1 = dcDest->w.DCOrgX + XLPTODP( dcDest, xDest );
|
|
xd2 = dcDest->w.DCOrgX + XLPTODP( dcDest, xDest + width );
|
|
yd1 = dcDest->w.DCOrgY + YLPTODP( dcDest, yDest );
|
|
yd2 = dcDest->w.DCOrgY + YLPTODP( dcDest, yDest + height );
|
|
|
|
if ((abs(xs2-xs1) != abs(xd2-xd1)) || (abs(ys2-ys1) != abs(yd2-yd1)))
|
|
return FALSE; /* Should call StretchBlt here */
|
|
|
|
DC_SetupGCForText( dcDest );
|
|
XSetFunction( XT_display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f] );
|
|
if (dcSrc->w.bitsPerPixel == dcDest->w.bitsPerPixel)
|
|
{
|
|
XCopyArea( XT_display, dcSrc->u.x.drawable,
|
|
dcDest->u.x.drawable, dcDest->u.x.gc,
|
|
MIN(xs1,xs2), MIN(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1),
|
|
MIN(xd1,xd2), MIN(yd1,yd2) );
|
|
}
|
|
else
|
|
{
|
|
if (dcSrc->w.bitsPerPixel != 1) return FALSE;
|
|
XCopyPlane( XT_display, dcSrc->u.x.drawable,
|
|
dcDest->u.x.drawable, dcDest->u.x.gc,
|
|
MIN(xs1,xs2), MIN(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1),
|
|
MIN(xd1,xd2), MIN(yd1,yd2), 1 );
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
* StretchBlt (GDI.35)
|
|
*/
|
|
BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short heightDest,
|
|
HDC hdcSrc, short xSrc, short ySrc, short widthSrc, short heightSrc, DWORD rop )
|
|
{
|
|
int xs1, xs2, ys1, ys2;
|
|
int xd1, xd2, yd1, yd2;
|
|
DC *dcDest, *dcSrc;
|
|
|
|
/*#ifdef DEBUG_GDI */
|
|
|
|
printf( "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
|
|
hdcDest, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc,
|
|
ySrc, widthSrc, heightSrc, rop );
|
|
/*#endif */
|
|
|
|
|
|
|
|
if ((rop & 0xcc0000) == ((rop & 0x330000) << 2))
|
|
return PatBlt( hdcDest, xDest, yDest, widthDest, heightDest, rop );
|
|
|
|
printf("here\n");
|
|
|
|
rop >>= 16;
|
|
if ((rop & 0x0f) != (rop >> 4))
|
|
{
|
|
printf( "BitBlt: Unimplemented ROP %02x\n", rop );
|
|
return FALSE;
|
|
}
|
|
|
|
printf("here2\n");
|
|
|
|
dcDest = (DC *) GDI_GetObjPtr( hdcDest, DC_MAGIC );
|
|
if (!dcDest) return FALSE;
|
|
dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC );
|
|
if (!dcSrc) return FALSE;
|
|
|
|
xs1 = XLPTODP( dcSrc, xSrc );
|
|
xs2 = XLPTODP( dcSrc, xSrc + widthSrc );
|
|
ys1 = YLPTODP( dcSrc, ySrc );
|
|
ys2 = YLPTODP( dcSrc, ySrc + heightSrc );
|
|
xd1 = XLPTODP( dcDest, xDest );
|
|
xd2 = XLPTODP( dcDest, xDest + widthDest );
|
|
yd1 = YLPTODP( dcDest, yDest );
|
|
yd2 = YLPTODP( dcDest, yDest + heightDest );
|
|
|
|
DC_SetupGCForText( dcDest );
|
|
XSetFunction( XT_display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f] );
|
|
|
|
if (dcSrc->w.bitsPerPixel == dcDest->w.bitsPerPixel)
|
|
{
|
|
printf("XCopyArea\n");
|
|
XCopyArea( XT_display, dcSrc->u.x.drawable,
|
|
dcDest->u.x.drawable, dcDest->u.x.gc,
|
|
MIN(xs1,xs2), MIN(ys1,ys2), abs(xd2-xd1), abs(yd2-yd1),
|
|
MIN(xd1,xd2), MIN(yd1,yd2) );
|
|
}
|
|
else
|
|
{
|
|
printf("XCopyPlane\n");
|
|
if (dcSrc->w.bitsPerPixel != 1) return FALSE;
|
|
XCopyPlane( XT_display, dcSrc->u.x.drawable,
|
|
dcDest->u.x.drawable, dcDest->u.x.gc,
|
|
MIN(xs1,xs2), MIN(ys1,ys2), abs(xd2-xd1), abs(yd2-yd1),
|
|
MIN(xd1,xd2), MIN(yd1,yd2), 1 );
|
|
}
|
|
return TRUE;
|
|
|
|
|
|
}
|
|
|