source: trunk/src/gdi32/oslibgdi.cpp@ 2551

Last change on this file since 2551 was 2551, checked in by sandervl, 26 years ago

Wrong return values for GetDIBits & SetDIBitsToDevice

File size: 2.3 KB
Line 
1/* $Id: oslibgdi.cpp,v 1.3 2000-01-28 22:24:58 sandervl Exp $ */
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
13#include <os2wrap.h> //Odin32 OS/2 api wrappers
14#include <stdlib.h>
15#include <string.h>
16#include <win32type.h>
17#include <misc.h>
18#define OS2_ONLY
19#include "dibsect.h"
20#include "oslibgdi.h"
21
22//******************************************************************************
23//******************************************************************************
24INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy,
25 INT xSrc, INT ySrc, UINT startscan, UINT lines,
26 LPCVOID bits, WINBITMAPINFOHEADER *info,
27 UINT coloruse)
28{
29 INT result, rc;
30 POINTL points[4];
31 BITMAPINFO2 os2bmpinfo;
32
33 // This is a quick hack. Only tested with winmine. Need much more testing.
34 // TODO: check parameter and info structure
35 lines = (int)lines >= 0 ? (int)lines : (int)-lines;
36
37 points[0].x = xDest;
38 points[0].y = yDest + cy - 1; // Y-inverted
39 points[1].x = xDest + cx - 1;
40 points[1].y = yDest; // Y-inverted
41 points[2].x = xSrc;
42 points[2].y = ySrc + startscan;
43 points[3].x = xSrc + cx;
44 points[3].y = ySrc + lines;
45
46 memset(&os2bmpinfo, 0, sizeof(os2bmpinfo));
47 os2bmpinfo.cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2);
48 os2bmpinfo.cx = info->biWidth;
49 os2bmpinfo.cy = info->biHeight;
50 os2bmpinfo.cPlanes = info->biPlanes;
51 os2bmpinfo.cBitCount = info->biBitCount;
52 os2bmpinfo.ulCompression = info->biCompression;
53 os2bmpinfo.cbImage = info->biSizeImage;
54 os2bmpinfo.cxResolution = info->biXPelsPerMeter;
55 os2bmpinfo.cyResolution = info->biYPelsPerMeter;
56 os2bmpinfo.cclrUsed = info->biClrUsed;
57 os2bmpinfo.cclrImportant = info->biClrImportant;
58
59// rc = GpiDrawBits((HPS)hdc, (VOID *)bits, &os2bmpinfo, 4,
60// points, ROP_SRCCOPY, BBO_IGNORE);
61
62// if(rc != GPI_OK) {
63// dprintf(("GpiDrawBits returned %d", rc));
64// }
65 return lines;
66}
67//******************************************************************************
68//******************************************************************************
Note: See TracBrowser for help on using the repository browser.