source: trunk/src/gdi32/dibsect.cpp@ 3371

Last change on this file since 3371 was 3371, checked in by sandervl, 25 years ago

dibsection change

File size: 18.8 KB
Line 
1/* $Id: dibsect.cpp,v 1.27 2000-04-13 18:47:16 sandervl Exp $ */
2
3/*
4 * GDI32 DIB sections
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 * Copyright 1998 Patrick Haller
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 * NOTE:
12 * This is not a complete solution for CreateDIBSection, but enough for Quake 2!
13 *
14 */
15#define INCL_GPI
16#define INCL_WIN
17#include <os2wrap.h> //Odin32 OS/2 api wrappers
18#include <stdlib.h>
19#include <string.h>
20#include <win32type.h>
21#include <misc.h>
22#define OS2_ONLY
23#include "dibsect.h"
24#include <vmutex.h>
25#include <win32api.h>
26#include <winconst.h>
27#include <win32wnd.h>
28#include <cpuhlp.h>
29#include "oslibgpi.h"
30#include "rgbcvt.h"
31
32#define DBG_LOCALLOG DBG_dibsect
33#include "dbglocal.h"
34
35static VMutex dibMutex;
36
37//******************************************************************************
38//******************************************************************************
39DIBSection::DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip)
40 : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsRGB565(NULL)
41{
42 bmpsize = pbmi->biWidth;
43 /* @@@PH 98/06/07 -- high-color bitmaps don't have palette */
44
45 this->fFlip = fFlip;
46 os2bmphdrsize = sizeof(BITMAPINFO2);
47
48 switch(pbmi->biBitCount)
49 {
50 case 1:
51 bmpsize = ((bmpsize + 31) & ~31) / 8;
52 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2);
53 break;
54 case 4:
55 bmpsize = ((bmpsize + 7) & ~7) / 2;
56 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2);
57 break;
58 case 8:
59 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2);
60 bmpsize = (bmpsize + 3) & ~3;
61 break;
62 case 16:
63 bmpsize *= 2;
64 bmpsize = (bmpsize + 3) & ~3;
65 break;
66 case 24:
67 bmpsize *= 3;
68 bmpsize = (bmpsize + 3) & ~3;
69 break;
70 case 32:
71 bmpsize *= 4;
72 break;
73 default:
74 dprintf(("Unsupported nr of bits %d", pbmi->biBitCount));
75 DebugInt3();
76 break;
77 }
78
79 this->hSection = hSection;
80 if(hSection) {
81 bmpBits = (char *)MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS_W, 0, dwOffset, bmpsize*pbmi->biHeight);
82 if(!bmpBits) {
83 dprintf(("Dibsection: mapViewOfFile %x failed!", hSection));
84 DebugInt3();
85 }
86 }
87 if(!bmpBits) {
88 DosAllocMem((PPVOID)&bmpBits, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT);
89 }
90 memset(bmpBits, 0, bmpsize*pbmi->biHeight);
91
92 pOS2bmp = (BITMAPINFO2 *)malloc(os2bmphdrsize);
93
94 memset(pOS2bmp, /* set header + palette entries to zero */
95 0,
96 os2bmphdrsize);
97
98 pOS2bmp->cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2);
99 pOS2bmp->cx = pbmi->biWidth;
100 pOS2bmp->cy = pbmi->biHeight;
101 pOS2bmp->cPlanes = pbmi->biPlanes;
102 pOS2bmp->cBitCount = pbmi->biBitCount;
103 pOS2bmp->ulCompression = pbmi->biCompression;
104 //SvL: Ignore BI_BITFIELDS type (GpiDrawBits fails otherwise)
105 if(pOS2bmp->ulCompression == BI_BITFIELDS) {
106 pOS2bmp->ulCompression = 0;
107 }
108 pOS2bmp->cbImage = pbmi->biSizeImage;
109 dprintf(("handle %x", handle));
110 dprintf(("pOS2bmp->cx %d\n", pOS2bmp->cx));
111 dprintf(("pOS2bmp->cy %d\n", pOS2bmp->cy));
112 dprintf(("pOS2bmp->cPlanes %d\n", pOS2bmp->cPlanes));
113 dprintf(("pOS2bmp->cBitCount %d\n", pOS2bmp->cBitCount));
114 dprintf(("pOS2bmp->ulCompression %d\n", pOS2bmp->ulCompression));
115 dprintf(("pOS2bmp->cbImage %d\n", pOS2bmp->cbImage));
116 dprintf(("Bits at %x, size %d",bmpBits, bmpsize*pbmi->biHeight));
117
118 // clear DIBSECTION structure
119 memset(&dibinfo, 0, sizeof(dibinfo));
120
121 // copy BITMAPINFOHEADER data into DIBSECTION structure
122 memcpy(&dibinfo.dsBmih, pbmi, sizeof(*pbmi));
123 dibinfo.dsBm.bmType = 0;
124 dibinfo.dsBm.bmWidth = pbmi->biWidth;
125 dibinfo.dsBm.bmHeight = pbmi->biHeight;
126 dibinfo.dsBm.bmWidthBytes= bmpsize;
127 dibinfo.dsBm.bmPlanes = pbmi->biPlanes;
128 dibinfo.dsBm.bmBitsPixel = pbmi->biBitCount;
129 dibinfo.dsBm.bmBits = bmpBits;
130
131 dibinfo.dshSection = handle;
132 dibinfo.dsOffset = 0; // TODO: put the correct value here (if createdibsection with file handle)
133
134 if(iUsage == DIB_PAL_COLORS || pbmi->biBitCount <= 8)
135 {
136 dibinfo.dsBitfields[0] = dibinfo.dsBitfields[1] = dibinfo.dsBitfields[2] = 0;
137 }
138 else {
139 switch(pbmi->biBitCount)
140 {
141 case 16:
142 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS) ? *(DWORD *)pColors : 0x7c00;
143 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0x03e0;
144 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0x001f;
145
146 //double buffer for rgb 555 dib sections (for conversion)
147 if(dibinfo.dsBitfields[1] == 0x03e0) {
148 DosAllocMem((PPVOID)&bmpBitsRGB565, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT);
149 }
150 break;
151
152 case 24:
153 dibinfo.dsBitfields[0] = 0xff;
154 dibinfo.dsBitfields[1] = 0xff00;
155 dibinfo.dsBitfields[2] = 0xff0000;
156 break;
157
158 case 32:
159 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS) ? *(DWORD *)pColors : 0xff;
160 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0xff00;
161 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0xff0000;
162 if(dibinfo.dsBitfields[0] != 0xff && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff0000) {
163 dprintf(("DIBSection: unsupported bitfields for 32 bits bitmap!!"));
164 }
165 break;
166 }
167 dprintf(("BI_BITFIELDS %x %x %x", dibinfo.dsBitfields[0], dibinfo.dsBitfields[1], dibinfo.dsBitfields[2]));
168 }
169
170 this->handle = handle;
171 this->iUsage = iUsage;
172
173 dibMutex.enter();
174 if(section == NULL)
175 {
176 dprintf(("section was NULL\n"));
177 section = this;
178 }
179 else
180 {
181 DIBSection *dsect = section;
182 dprintf2(("Increment section starting at %08X\n",dsect));
183
184 /* @@@PH 98/07/11 fix for dsect->next == NULL */
185 while ( (dsect->next != this) &&
186 (dsect->next != NULL) )
187 {
188 dprintf2(("Increment section to %08X\n",dsect->next));
189 dsect = dsect->next;
190 }
191 dsect->next = this;
192 }
193 dibMutex.leave();
194}
195//******************************************************************************
196//******************************************************************************
197DIBSection::~DIBSection()
198{
199 dprintf(("Delete DIBSection %x", handle));
200
201 if(hSection) {
202 UnmapViewOfFile(bmpBits);
203 }
204 else
205 if(bmpBits)
206 DosFreeMem(bmpBits);
207
208 if(bmpBitsRGB565)
209 DosFreeMem(bmpBitsRGB565);
210
211 if(pOS2bmp)
212 free(pOS2bmp);
213
214 dibMutex.enter();
215 if(section == this)
216 {
217 section = this->next;
218 }
219 else
220 {
221 DIBSection *dsect = section;
222
223 while(dsect->next != this)
224 {
225 dsect = dsect->next;
226 }
227 dsect->next = this->next;
228 }
229 dibMutex.leave();
230}
231//******************************************************************************
232//******************************************************************************
233int DIBSection::SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
234 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi,
235 UINT coloruse)
236{
237 lines = (int)lines >= 0 ? (int)lines : (int)-lines;
238 int palsize=0;
239
240 bmpsize = pbmi->biWidth;
241 os2bmphdrsize = sizeof(BITMAPINFO2);
242
243 switch(pbmi->biBitCount)
244 {
245 case 1:
246 bmpsize = ((bmpsize + 31) & ~31) / 8;
247 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
248 os2bmphdrsize += palsize;
249 break;
250 case 4:
251 bmpsize = ((bmpsize + 7) & ~7) / 2;
252 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
253 os2bmphdrsize += palsize;
254 break;
255 case 8:
256 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
257 os2bmphdrsize += palsize;
258 bmpsize = (bmpsize + 3) & ~3;
259 break;
260 case 16:
261 bmpsize *= 2;
262 bmpsize = (bmpsize + 3) & ~3;
263 break;
264 case 24:
265 bmpsize *= 3;
266 bmpsize = (bmpsize + 3) & ~3;
267 break;
268 case 32:
269 bmpsize *= 4;
270 break;
271 }
272
273 //SvL: TODO: Correct??
274 if(!hSection && pOS2bmp->cx != pbmi->biWidth && pOS2bmp->cy != pbmi->biHeight &&
275 pOS2bmp->cBitCount != pbmi->biBitCount)
276 {
277 char *oldbits = bmpBits;
278 int oldsize = dibinfo.dsBm.bmWidthBytes * dibinfo.dsBm.bmHeight;
279
280 DosAllocMem((PPVOID)&bmpBits, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT);
281 memcpy(bmpBits, oldbits, min(oldsize, bmpsize*pbmi->biHeight));
282 DosFreeMem(oldbits);
283 }
284 pOS2bmp = (BITMAPINFO2 *)realloc(pOS2bmp, os2bmphdrsize);
285 pOS2bmp->cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2);
286 pOS2bmp->cx = pbmi->biWidth;
287 pOS2bmp->cy = pbmi->biHeight;
288 pOS2bmp->cPlanes = pbmi->biPlanes;
289 pOS2bmp->cBitCount = pbmi->biBitCount;
290 pOS2bmp->ulCompression = pbmi->biCompression;
291 pOS2bmp->cbImage = pbmi->biSizeImage;
292
293 // clear DIBSECTION structure
294 memset(&dibinfo, 0, sizeof(dibinfo));
295
296 // copy BITMAPINFOHEADER data into DIBSECTION structure
297 memcpy(&dibinfo.dsBmih, pbmi, sizeof(*pbmi));
298 dibinfo.dsBm.bmType = 0;
299 dibinfo.dsBm.bmWidth = pbmi->biWidth;
300 dibinfo.dsBm.bmHeight = pbmi->biHeight;
301 dibinfo.dsBm.bmWidthBytes= bmpsize;
302 dibinfo.dsBm.bmPlanes = pbmi->biPlanes;
303 dibinfo.dsBm.bmBitsPixel = pbmi->biBitCount;
304 dibinfo.dsBm.bmBits = bmpBits;
305
306 dibinfo.dshSection = hSection;
307 dibinfo.dsOffset = 0; // TODO: put the correct value here (if createdibsection with file handle)
308
309 if(coloruse == DIB_PAL_COLORS || pbmi->biBitCount <= 8)
310 {
311 dibinfo.dsBitfields[0] = dibinfo.dsBitfields[1] = dibinfo.dsBitfields[2] = 0;
312 }
313 else {
314 char *pColors = (char *)pbmi + 1;
315
316 switch(pbmi->biBitCount)
317 {
318 case 16:
319 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS) ? *(DWORD *)pColors : 0x7c00;
320 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0x03e0;
321 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0x001f;
322 break;
323
324 case 24:
325 dibinfo.dsBitfields[0] = 0xff;
326 dibinfo.dsBitfields[1] = 0xff00;
327 dibinfo.dsBitfields[2] = 0xff0000;
328 break;
329
330 case 32:
331 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS) ? *(DWORD *)pColors : 0xff;
332 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0xff00;
333 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0xff0000;
334 if(dibinfo.dsBitfields[0] != 0xff && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff0000) {
335 dprintf(("DIBSection: unsupported bitfields for 32 bits bitmap!!"));
336 }
337 break;
338 }
339 dprintf(("BI_BITFIELDS %x %x %x", dibinfo.dsBitfields[0], dibinfo.dsBitfields[1], dibinfo.dsBitfields[2]));
340 }
341
342 dprintf(("DIBSection::SetDIBits (%d,%d), %d %d", pbmi->biWidth, pbmi->biHeight, pbmi->biBitCount, pbmi->biCompression));
343 if(palsize)
344 memcpy(pOS2bmp->argbColor, (char *)pbmi + 1 , palsize);
345
346 if(bits)
347 {
348 int size = bmpsize*lines;
349 memcpy(bmpBits+bmpsize*startscan, bits, size);
350 }
351 return(lines);
352}
353//******************************************************************************
354//******************************************************************************
355int DIBSection::SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb)
356{
357 int i;
358
359 if(startIdx + cEntries > (1 << pOS2bmp->cBitCount))
360 {
361 dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries));
362 return(0);
363 }
364
365 memcpy(&pOS2bmp->argbColor[startIdx], rgb, cEntries*sizeof(RGB2));
366
367 for(i=startIdx;i<cEntries;i++)
368 {
369 pOS2bmp->argbColor[i].fcOptions = 0;
370 dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&pOS2bmp->argbColor[i])) ));
371 }
372
373 return(cEntries);
374}
375//******************************************************************************
376//******************************************************************************
377BOOL DIBSection::BitBlt(HDC hdcDest, int nXdest, int nYdest, int nDestWidth,
378 int nDestHeight, int nXsrc, int nYsrc,
379 int nSrcWidth, int nSrcHeight, DWORD Rop)
380{
381 HPS hps = (HPS)hdcDest;
382 POINTL point[4];
383 LONG rc;
384 PVOID bitmapBits = NULL;
385 int oldyinversion = 0;
386 BOOL fRestoryYInversion = FALSE;
387
388#if 1
389 HWND hwndDest = WindowFromDC(hdcDest);
390 hwndDest = Win32ToOS2Handle(hwndDest);
391 if(hwndDest != 0)
392 {
393 hps = WinGetPS(hwndDest);
394 }
395 if(hps == 0)
396 {
397 dprintf(("ERROR: DIBSection::BitBlt, hps == 0 hwndDest = %X", hwndDest));
398 return(FALSE);
399 }
400#endif
401
402 if(nDestWidth == 160 && nDestHeight == 120) {
403 nSrcWidth = 160;
404 }
405
406 dprintf(("DIBSection::BitBlt %x %X (hps %x) %x to(%d,%d)(%d,%d) from (%d,%d)(%d,%d) rop %x flip %x",
407 handle, hdcDest, hps, hwndDest, nXdest, nYdest, nDestWidth, nDestHeight,
408// handle, hdcDest, hps, 0, nXdest, nYdest, nDestWidth, nDestHeight,
409 nXsrc, nYsrc, nSrcWidth, nSrcHeight, Rop, fFlip));
410
411 //win32 coordinates are of the left top, OS/2 expects left bottom
412 point[0].x = nXdest;
413 point[0].y = pOS2bmp->cy - nYdest - nDestHeight;
414 point[1].x = nXdest + nDestWidth - 1;
415 point[1].y = pOS2bmp->cy - nYdest - 1;
416 point[2].x = nXsrc;
417 point[2].y = pOS2bmp->cy - nYsrc - nSrcHeight;
418 if(nXsrc + nSrcWidth > pOS2bmp->cx)
419 {
420 point[3].x = pOS2bmp->cx;
421 nSrcWidth = pOS2bmp->cx - nXsrc;
422 }
423 else point[3].x = nXsrc + nSrcWidth;
424
425 if(nYsrc + nSrcHeight > pOS2bmp->cy)
426 {
427 point[3].y = pOS2bmp->cy;
428 nSrcHeight = pOS2bmp->cy - nYsrc;
429 }
430 else point[3].y = pOS2bmp->cy - nYsrc;
431
432 oldyinversion = GpiQueryYInversion(hps);
433 if(fFlip & FLIP_VERT)
434 {
435 if(oldyinversion != pOS2bmp->cy-1) {
436 GpiEnableYInversion(hps, pOS2bmp->cy-1);
437 fRestoryYInversion = TRUE;
438 }
439 }
440 else
441 if(oldyinversion != 0) {
442 GpiEnableYInversion(hps, 0);
443 fRestoryYInversion = TRUE;
444 }
445
446 if(fFlip & FLIP_HOR)
447 {
448 ULONG x;
449 x = point[0].x;
450 point[0].x = point[1].x;
451 point[1].x = x;
452 }
453
454 //SvL: Optimize this.. (don't convert entire bitmap if only a part will be blitted to the dc)
455 if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555?
456 dprintf(("DIBSection::BitBlt; convert rgb 555 to 565 (old y inv. = %d", oldyinversion));
457
458 if(bmpBitsRGB565 == NULL)
459 DebugInt3();
460
461 if(CPUFeatures & CPUID_MMX) {
462 RGB555to565MMX((WORD *)bmpBitsRGB565, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD));
463 }
464 else RGB555to565((WORD *)bmpBitsRGB565, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD));
465 rc = GpiDrawBits(hps, bmpBitsRGB565, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR);
466 }
467 else rc = GpiDrawBits(hps, bmpBits, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR);
468
469 if(rc == GPI_OK) {
470 DIBSection *destdib = DIBSection::findHDC(hdcDest);
471 if(destdib) {
472 dprintf(("Sync destination dibsection %x (%x) (%d)", destdib->handle, hdcDest, oldyinversion));
473
474 //todo: rgb 565 to 555 conversion if bpp == 16
475 BITMAPINFO2 *tmphdr = (BITMAPINFO2 *)malloc(destdib->os2bmphdrsize);
476 memcpy(tmphdr, destdib->pOS2bmp, destdib->os2bmphdrsize);
477 rc = GpiQueryBitmapBits(hps, nYdest, nDestHeight, destdib->GetDIBObject(),
478 tmphdr);
479 free(tmphdr);
480 if(rc != nDestHeight) {
481 DebugInt3();
482 }
483 }
484 //restore old y inversion height
485 if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion);
486#if 1
487 if(hwndDest != 0)
488 {
489 WinReleasePS(hps);
490 }
491#endif
492 return(TRUE);
493 }
494 if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion);
495#if 1
496 if(hwndDest != 0)
497 {
498 WinReleasePS(hps);
499 }
500#endif
501 dprintf(("DIBSection::BitBlt %X (%d,%d) (%d,%d) to (%d,%d) (%d,%d) returned %d\n", hps, point[0].x, point[0].y, point[1].x, point[1].y, point[2].x, point[2].y, point[3].x, point[3].y, rc));
502#if 1
503 dprintf(("WinGetLastError returned %X\n", WinGetLastError(WinQueryAnchorBlock(hwndDest)) & 0xFFFF));
504#endif
505 return(FALSE);
506}
507//******************************************************************************
508//******************************************************************************
509void DIBSection::SelectDIBObject(HDC hdc)
510{
511 this->hdc = hdc;
512 hwndParent = WinWindowFromDC(hdc);
513 dprintf(("SelectDIBObject %x into %x hwndParent = %x", handle, hdc, hwndParent));
514}
515//******************************************************************************
516//******************************************************************************
517DIBSection *DIBSection::find(DWORD handle)
518{
519 DIBSection *dsect = section;
520
521 dibMutex.enter();
522 while(dsect)
523 {
524 if(dsect->handle == handle)
525 {
526 dibMutex.leave();
527 return(dsect);
528 }
529 dsect = dsect->next;
530 }
531 dibMutex.leave();
532 return(NULL);
533}
534//******************************************************************************
535//A bitmap can only be selected into one DC, so this works.
536//******************************************************************************
537DIBSection *DIBSection::findHDC(HDC hdc)
538{
539 DIBSection *dsect = section;
540
541 while(dsect)
542 {
543 if(dsect->hdc == hdc)
544 {
545 return(dsect);
546 }
547 dsect = dsect->next;
548 }
549 return(NULL);
550}
551//******************************************************************************
552//******************************************************************************
553void DIBSection::deleteSection(DWORD handle)
554{
555 DIBSection *dsect = find(handle);
556
557 if(dsect)
558 delete dsect;
559
560}
561//******************************************************************************
562//******************************************************************************
563int DIBSection::GetDIBSection(int iSize, void *lpBuffer)
564{
565 DIBSECTION *pDIBSection = (DIBSECTION *)lpBuffer;
566 LPBITMAP_W dsBm = (LPBITMAP_W)lpBuffer;
567
568 dprintf2(("GetDIBSection %x %d %x", handle, iSize, lpBuffer));
569 if(iSize == sizeof(DIBSECTION))
570 {
571 memcpy(pDIBSection, &dibinfo, sizeof(dibinfo));
572 return sizeof(DIBSECTION);
573 }
574 else
575 if(iSize == sizeof(BITMAP_W))
576 {
577 memcpy(dsBm, &dibinfo.dsBm, sizeof(dibinfo.dsBm));
578 return sizeof(BITMAP_W);
579 }
580 return 0;
581
582}
583//******************************************************************************
584//******************************************************************************
585char DIBSection::GetBitCount()
586{
587 if(pOS2bmp == NULL)
588 return 0;
589 else
590 return pOS2bmp->cBitCount;
591}
592//******************************************************************************
593//******************************************************************************
594DIBSection *DIBSection::section = NULL;
Note: See TracBrowser for help on using the repository browser.