|
|
| version 1.1, 2003/10/23 07:20:43 | version 1.4, 2003/11/12 00:55:38 |
|---|---|
| Line 4 | Line 4 |
| typedef struct { | typedef struct { |
| int width; | |
| int height; | |
| BOOL exist; | BOOL exist; |
| WindowPtr hWnd; | WindowPtr hWnd; |
| GWorldPtr gw; | GWorldPtr gw; |
| PixMapHandle pm; | PixMapHandle pm; |
| Rect rect; | Rect rect; |
| GWorldPtr gwp; | |
| GDHandle hgd; | |
| } _QDRAW, *QDRAW; | } _QDRAW, *QDRAW; |
| static _QDRAW qdraw; | static _QDRAW qdraw; |
| static SCRNSURF scrnsurf; | static SCRNSURF scrnsurf; |
| static GWorldPtr gwp; | |
| static GDHandle hgd; | |
| static void changeclientsize(int width, int height) { | |
| QDRAW qd; | |
| qd = &qdraw; | |
| if (!qd->exist) { | |
| return; | |
| } | |
| SizeWindow(qd->hWnd, width, height, TRUE); | |
| } | |
| void scrnmng_initialize(void) { | void scrnmng_initialize(void) { |
| QDRAW qd; | |
| qd = &qdraw; | |
| qd->width = 640; | |
| qd->height = 400; | |
| } | } |
| BOOL scrnmng_create(BYTE scrnmode) { | BOOL scrnmng_create(BYTE scrnmode) { |
| Line 52 void scrnmng_destroy(void) { | Line 71 void scrnmng_destroy(void) { |
| void scrnmng_setwidth(int posx, int width) { | void scrnmng_setwidth(int posx, int width) { |
| QDRAW qd; | |
| qd = &qdraw; | |
| if (qd->width != width) { | |
| qd->width = width; | |
| changeclientsize(width, qd->height); | |
| } | |
| (void)posx; | (void)posx; |
| (void)width; | |
| } | } |
| void scrnmng_setextend(int extend) { | void scrnmng_setextend(int extend) { |
| Line 63 void scrnmng_setextend(int extend) { | Line 88 void scrnmng_setextend(int extend) { |
| void scrnmng_setheight(int posy, int height) { | void scrnmng_setheight(int posy, int height) { |
| QDRAW qd; | |
| qd = &qdraw; | |
| if (qd->height != height) { | |
| qd->height = height; | |
| changeclientsize(qd->width, height); | |
| } | |
| (void)posy; | (void)posy; |
| (void)height; | |
| } | } |
| const SCRNSURF *scrnmng_surflock(void) { | const SCRNSURF *scrnmng_surflock(void) { |
| Line 76 const SCRNSURF *scrnmng_surflock(void) { | Line 107 const SCRNSURF *scrnmng_surflock(void) { |
| return(NULL); | return(NULL); |
| } | } |
| GetGWorld(&gwp, &hgd); | GetGWorld(&qd->gwp, &qd->hgd); |
| LockPixels(qd->pm); | LockPixels(qd->pm); |
| SetGWorld(qd->gw, NULL); | SetGWorld(qd->gw, NULL); |
| Line 84 const SCRNSURF *scrnmng_surflock(void) { | Line 115 const SCRNSURF *scrnmng_surflock(void) { |
| scrnsurf.xalign = 4; | scrnsurf.xalign = 4; |
| scrnsurf.yalign = ((*qd->pm)->rowBytes) & 0x3fff; | scrnsurf.yalign = ((*qd->pm)->rowBytes) & 0x3fff; |
| scrnsurf.width = 640; | scrnsurf.width = qd->width; |
| scrnsurf.height = 400; | scrnsurf.height = qd->height; |
| scrnsurf.extend = 0; | scrnsurf.extend = 0; |
| scrnsurf.bpp = 32; | |
| return(&scrnsurf); | return(&scrnsurf); |
| } | } |
| Line 105 void scrnmng_surfunlock(const SCRNSURF * | Line 137 void scrnmng_surfunlock(const SCRNSURF * |
| if (!EmptyRgn(GetPortVisibleRegion(GetWindowPort(qd->hWnd), | if (!EmptyRgn(GetPortVisibleRegion(GetWindowPort(qd->hWnd), |
| theVisibleRgn))) { | theVisibleRgn))) { |
| LockPortBits(GetWindowPort(qd->hWnd)); | LockPortBits(GetWindowPort(qd->hWnd)); |
| LockPixels(qd->pm); | // LockPixels(qd->pm); |
| GetPort(&thePort); | GetPort(&thePort); |
| SetPortWindowPort(qd->hWnd); | SetPortWindowPort(qd->hWnd); |
| CopyBits((BitMap*)(*qd->pm), | CopyBits((BitMap*)(*qd->pm), |
| GetPortBitMapForCopyBits(GetWindowPort(qd->hWnd)), | GetPortBitMapForCopyBits(GetWindowPort(qd->hWnd)), |
| &qd->rect, &qd->rect, srcCopy, theVisibleRgn); | &qd->rect, &qd->rect, srcCopy, theVisibleRgn); |
| SetPort(thePort); | SetPort(thePort); |
| UnlockPixels(qd->pm); | // UnlockPixels(qd->pm); |
| UnlockPortBits(GetWindowPort(qd->hWnd)); | UnlockPortBits(GetWindowPort(qd->hWnd)); |
| } | } |
| DisposeRgn(theVisibleRgn); | DisposeRgn(theVisibleRgn); |
| Line 121 void scrnmng_surfunlock(const SCRNSURF * | Line 153 void scrnmng_surfunlock(const SCRNSURF * |
| &qd->rect, srcCopy, qd->hWnd->visRgn); | &qd->rect, srcCopy, qd->hWnd->visRgn); |
| #endif | #endif |
| UnlockPixels(qd->pm); | UnlockPixels(qd->pm); |
| SetGWorld(gwp, hgd); | SetGWorld(qd->gwp, qd->hgd); |
| } | } |
| } | } |