[7717] | 1 | /* $Id: oslibgdi.cpp,v 1.8 2001-12-31 12:08:23 sandervl Exp $ */
|
---|
[1095] | 2 |
|
---|
| 3 | /*
|
---|
| 4 | * GDI32 support code
|
---|
| 5 | *
|
---|
| 6 | * Copyright 1999 Edgar Buerkle (Edgar.Buerkle@gmx.net)
|
---|
| 7 | *
|
---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 9 | *
|
---|
| 10 | */
|
---|
| 11 | #define INCL_GPI
|
---|
| 12 | #define INCL_WIN
|
---|
[2049] | 13 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
[1095] | 14 | #include <stdlib.h>
|
---|
| 15 | #include <string.h>
|
---|
[7717] | 16 | #include <win32api.h>
|
---|
[1095] | 17 | #include <misc.h>
|
---|
| 18 | #include "dibsect.h"
|
---|
| 19 | #include "oslibgdi.h"
|
---|
| 20 |
|
---|
[2802] | 21 | #define DBG_LOCALLOG DBG_oslibgdi
|
---|
| 22 | #include "dbglocal.h"
|
---|
| 23 |
|
---|
[5931] | 24 | #if 0
|
---|
[1095] | 25 | //******************************************************************************
|
---|
| 26 | //******************************************************************************
|
---|
[2049] | 27 | INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy,
|
---|
| 28 | INT xSrc, INT ySrc, UINT startscan, UINT lines,
|
---|
[2600] | 29 | LPCVOID bits, BITMAPINFOHEADER_W *info,
|
---|
[1095] | 30 | UINT coloruse)
|
---|
| 31 | {
|
---|
[2551] | 32 | INT result, rc;
|
---|
[1095] | 33 | POINTL points[4];
|
---|
[2551] | 34 | BITMAPINFO2 os2bmpinfo;
|
---|
[1095] | 35 |
|
---|
| 36 | // This is a quick hack. Only tested with winmine. Need much more testing.
|
---|
| 37 | // TODO: check parameter and info structure
|
---|
| 38 | lines = (int)lines >= 0 ? (int)lines : (int)-lines;
|
---|
| 39 |
|
---|
| 40 | points[0].x = xDest;
|
---|
| 41 | points[0].y = yDest + cy - 1; // Y-inverted
|
---|
| 42 | points[1].x = xDest + cx - 1;
|
---|
| 43 | points[1].y = yDest; // Y-inverted
|
---|
| 44 | points[2].x = xSrc;
|
---|
| 45 | points[2].y = ySrc + startscan;
|
---|
| 46 | points[3].x = xSrc + cx;
|
---|
| 47 | points[3].y = ySrc + lines;
|
---|
| 48 |
|
---|
[2551] | 49 | memset(&os2bmpinfo, 0, sizeof(os2bmpinfo));
|
---|
| 50 | os2bmpinfo.cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2);
|
---|
| 51 | os2bmpinfo.cx = info->biWidth;
|
---|
| 52 | os2bmpinfo.cy = info->biHeight;
|
---|
| 53 | os2bmpinfo.cPlanes = info->biPlanes;
|
---|
| 54 | os2bmpinfo.cBitCount = info->biBitCount;
|
---|
| 55 | os2bmpinfo.ulCompression = info->biCompression;
|
---|
| 56 | os2bmpinfo.cbImage = info->biSizeImage;
|
---|
| 57 | os2bmpinfo.cxResolution = info->biXPelsPerMeter;
|
---|
| 58 | os2bmpinfo.cyResolution = info->biYPelsPerMeter;
|
---|
| 59 | os2bmpinfo.cclrUsed = info->biClrUsed;
|
---|
| 60 | os2bmpinfo.cclrImportant = info->biClrImportant;
|
---|
[2049] | 61 |
|
---|
[2592] | 62 | rc = GpiDrawBits((HPS)hdc, (VOID *)bits, &os2bmpinfo, 4,
|
---|
| 63 | points, ROP_SRCCOPY, BBO_IGNORE);
|
---|
[2551] | 64 |
|
---|
[2592] | 65 | if(rc != GPI_OK) {
|
---|
| 66 | dprintf(("GpiDrawBits returned %d", rc));
|
---|
| 67 | }
|
---|
[1095] | 68 | return lines;
|
---|
| 69 | }
|
---|
| 70 | //******************************************************************************
|
---|
| 71 | //******************************************************************************
|
---|
[5931] | 72 | #endif
|
---|