Changeset 816 for trunk/src/kernel32
- Timestamp:
- Sep 4, 1999, 2:42:10 PM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/cvtbitmap.cpp
r581 r816 1 /* $Id: cvtbitmap.cpp,v 1. 1 1999-08-19 14:19:14sandervl Exp $ */1 /* $Id: cvtbitmap.cpp,v 1.2 1999-09-04 12:41:45 sandervl Exp $ */ 2 2 3 3 /* … … 505 505 //****************************************************************************** 506 506 //****************************************************************************** 507 ULONG Query SizeBitmap(WINBITMAPINFOHEADER *pBHdr, ULONG ulSize)507 ULONG QueryConvertedBitmapSize(WINBITMAPINFOHEADER *pBHdr, ULONG ulSize) 508 508 { 509 509 ULONG retSize; … … 589 589 /**************************************/ 590 590 default: //fail 591 dprintf(("Query SizeBitmap- default - fail!"));591 dprintf(("QueryConvertedBitmapSize - default - fail!")); 592 592 return 0; 593 593 } -
trunk/src/kernel32/cvtcursor.cpp
r634 r816 1 /* $Id: cvtcursor.cpp,v 1. 2 1999-08-22 22:11:21sandervl Exp $ */1 /* $Id: cvtcursor.cpp,v 1.3 1999-09-04 12:41:45 sandervl Exp $ */ 2 2 3 3 /* … … 28 28 29 29 //****************************************************************************** 30 //****************************************************************************** 31 ULONG QueryConvertedCursorSize(CursorComponent *curHdr, int size) 32 { 33 WINBITMAPINFOHEADER *bhdr = (WINBITMAPINFOHEADER *)(curHdr+1); 34 int bmpsize, cursorsize; 35 36 bmpsize = size - sizeof(CursorComponent) - (1<<bhdr->biBitCount)*sizeof(RGBQUAD); 37 cursorsize = sizeof(BITMAPFILEHEADER2) + bmpsize + (1<<bhdr->biBitCount)*sizeof(RGB2); 38 39 return cursorsize; 40 } 41 //****************************************************************************** 30 42 //NOTE: offsetBits is the value added to the offBits bitmap structure members 31 43 // (handy for converting cursor groups) 32 44 //****************************************************************************** 33 void *ConvertCursor(CursorComponent *curHdr, int size, int offsetBits)45 void *ConvertCursor(CursorComponent *curHdr, int size, int *os2size, int offsetBits) 34 46 { 35 47 RGBQUAD *rgb; … … 106 118 memcpy((char *)os2rgb, (char *)rgb, bwsize); 107 119 120 *os2size = cursorsize; 108 121 return cursorhdr; 109 122 } -
trunk/src/kernel32/cvtcursorgrp.cpp
r589 r816 1 /* $Id: cvtcursorgrp.cpp,v 1. 1 1999-08-19 19:51:00sandervl Exp $ */1 /* $Id: cvtcursorgrp.cpp,v 1.2 1999-09-04 12:41:45 sandervl Exp $ */ 2 2 3 3 /* … … 35 35 { 36 36 CursorResDir *rdir = (CursorResDir *)(chdr + 1); 37 int i, groupsize = 0 ;37 int i, groupsize = 0, os2cursorsize; 38 38 BITMAPARRAYFILEHEADER *bafh, *orgbafh; 39 39 CursorComponent *cursorhdr; … … 50 50 dprintf(("Bits : %d", rdir->wBitCount)); 51 51 dprintf(("ResBytes: %d", rdir->lBytesInRes)); 52 groupsize += module->getResourceSizeA((LPSTR)rdir->wNameOrdinal, (LPSTR)NTRT_CURSOR); 52 winres = (Win32Resource *)FindResourceA(module->getInstanceHandle(), 53 (LPCSTR)rdir->wNameOrdinal, 54 (LPSTR)NTRT_CURSOR); 55 groupsize += winres->getOS2Size(); 53 56 rdir++; 54 57 } … … 77 80 78 81 cursorhdr = (CursorComponent *)winres->lockResource(); 79 os2cursor = ConvertCursor(cursorhdr, winres->getSize(), (int)bafh - (int)orgbafh + sizeof(BITMAPARRAYFILEHEADER)-sizeof(BITMAPFILEHEADER));82 os2cursor = ConvertCursor(cursorhdr, winres->getSize(), &os2cursorsize, (int)bafh - (int)orgbafh + sizeof(BITMAPARRAYFILEHEADER)-sizeof(BITMAPFILEHEADER)); 80 83 81 84 if(os2cursor == NULL) { … … 86 89 } 87 90 88 memcpy((char *)&bafh->bfh, os2cursor, winres->getSize());91 memcpy((char *)&bafh->bfh, os2cursor, os2cursorsize); 89 92 free(os2cursor); 90 93 91 bafh = (BITMAPARRAYFILEHEADER *)((int)&bafh->bfh + winres->getSize());94 bafh = (BITMAPARRAYFILEHEADER *)((int)&bafh->bfh + os2cursorsize); 92 95 delete winres; 93 96 -
trunk/src/kernel32/cvticon.cpp
r589 r816 1 /* $Id: cvticon.cpp,v 1. 2 1999-08-19 19:50:40sandervl Exp $ */1 /* $Id: cvticon.cpp,v 1.3 1999-09-04 12:41:46 sandervl Exp $ */ 2 2 3 3 /* … … 27 27 28 28 //****************************************************************************** 29 //****************************************************************************** 30 ULONG QueryConvertedIconSize(WINBITMAPINFOHEADER *bmpHdr, int size) 31 { 32 int bwsize, colorsize, rgbsize, iconsize; 33 34 bwsize = (bmpHdr->biWidth*(bmpHdr->biHeight/2))/8; 35 colorsize = bmpHdr->biWidth*(bmpHdr->biHeight/2); 36 //SvL: 28-09-'98: only for <= 8 37 if(bmpHdr->biBitCount <= 8) 38 rgbsize = (1<<bmpHdr->biBitCount)*sizeof(RGB2); 39 else rgbsize = 0; 40 41 switch(bmpHdr->biBitCount) { 42 case 1: 43 colorsize /= 8; 44 break; 45 case 4: 46 colorsize /= 2; 47 break; 48 case 8: 49 break; 50 case 16: 51 colorsize *= 2; 52 break; 53 case 24: 54 colorsize *= 3; 55 break; 56 case 32: 57 colorsize *= 4; 58 break; 59 } 60 if(bmpHdr->biSizeImage == 0 && bmpHdr->biCompression == 0) { 61 bmpHdr->biSizeImage = bwsize + colorsize; 62 } 63 64 //SvL: 28-09-'98: cllngenu.dll has an incorrect size in the header 65 if(bmpHdr->biSizeImage < colorsize) { 66 bmpHdr->biSizeImage = colorsize; 67 } 68 //bitmapfileheader for AndXor mask + 2 RGB structs + bitmapfileheader 69 //for color bitmap + RGB structs for all the colors 70 //SvL, 3-3-98: 2*bwsize 71 iconsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 72 rgbsize + 2*bwsize + bmpHdr->biSizeImage; 73 74 return iconsize; 75 } 76 //****************************************************************************** 29 77 //NOTE: offsetBits is the value added to the offBits bitmap structure members 30 78 // (handy for converting icon groups) 31 79 //****************************************************************************** 32 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int offsetBits)80 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int *os2size, int offsetBits) 33 81 { 34 82 RGBQUAD *rgb; … … 83 131 iconsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 84 132 rgbsize + 2*bwsize + bmpHdr->biSizeImage; 133 #if 0 134 //SvL: Not necessary anymore 85 135 //There are icons without an XOR mask, so check for it 86 136 if(bmpHdr->biSizeImage == colorsize) { 87 137 iconsize += bwsize; 88 138 } 139 #endif 89 140 iconhdr = (BITMAPFILEHEADER2 *)malloc(iconsize); 90 141 memset(iconhdr, 0, iconsize); … … 104 155 os2rgb = (RGB2 *)(iconhdr+1); 105 156 memset(os2rgb, 0, sizeof(RGB2)); 106 memset(os2rgb+1, 0xff, sizeof(RGB 2)); //not reserved byte157 memset(os2rgb+1, 0xff, sizeof(RGB)); //not reserved byte! 107 158 iconhdr2 = (BITMAPFILEHEADER2 *)(os2rgb+2); 108 159 iconhdr2->usType = BFT_COLORICON; … … 143 194 memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize); 144 195 } 196 *os2size = iconsize; 145 197 return (void *)iconhdr; 146 198 } -
trunk/src/kernel32/cvticongrp.cpp
r589 r816 1 /* $Id: cvticongrp.cpp,v 1. 1 1999-08-19 19:50:40sandervl Exp $ */1 /* $Id: cvticongrp.cpp,v 1.2 1999-09-04 12:41:46 sandervl Exp $ */ 2 2 3 3 /* … … 35 35 { 36 36 ResourceDirectory *rdir = (ResourceDirectory *)(ihdr + 1); 37 int i, groupsize = 0 ;37 int i, groupsize = 0, os2iconsize; 38 38 BITMAPARRAYFILEHEADER2 *bafh, *orgbafh; 39 39 WINBITMAPINFOHEADER *iconhdr; … … 50 50 dprintf(("Bits : %d", rdir->wBitCount)); 51 51 dprintf(("ResBytes: %d", rdir->lBytesInRes)); 52 groupsize += module->getResourceSizeA((LPSTR)rdir->wNameOrdinal, (LPSTR)NTRT_ICON); 52 winres = (Win32Resource *)FindResourceA(module->getInstanceHandle(), 53 (LPCSTR)rdir->wNameOrdinal, 54 (LPSTR)NTRT_ICON); 55 groupsize += winres->getOS2Size(); 53 56 rdir++; 54 57 } … … 76 79 77 80 iconhdr = (WINBITMAPINFOHEADER *)winres->lockResource(); 78 os2icon = ConvertIcon(iconhdr, winres->getSize(), (int)bafh - (int)orgbafh + sizeof(BITMAPARRAYFILEHEADER2)-sizeof(BITMAPFILEHEADER2));81 os2icon = ConvertIcon(iconhdr, winres->getSize(), &os2iconsize, (int)bafh - (int)orgbafh + sizeof(BITMAPARRAYFILEHEADER2)-sizeof(BITMAPFILEHEADER2)); 79 82 80 83 if(os2icon == NULL) { … … 85 88 } 86 89 87 memcpy((char *)&bafh->bfh2, os2icon, winres->getSize());90 memcpy((char *)&bafh->bfh2, os2icon, os2iconsize); 88 91 free(os2icon); 89 92 90 bafh = (BITMAPARRAYFILEHEADER2 *)((int)&bafh->bfh2 + winres->getSize());93 bafh = (BITMAPARRAYFILEHEADER2 *)((int)&bafh->bfh2 + os2iconsize); 91 94 delete winres; 92 95 -
trunk/src/kernel32/cvtresource.h
r589 r816 1 /* $Id: cvtresource.h,v 1. 2 1999-08-19 19:50:40sandervl Exp $ */1 /* $Id: cvtresource.h,v 1.3 1999-09-04 12:41:46 sandervl Exp $ */ 2 2 3 3 #ifndef _CVTRESOURCE_H_ … … 12 12 void *ConvertAccelerator(WINACCEL *accdata, int size, int cp = 0); 13 13 void *ConvertBitmap(WINBITMAPINFOHEADER *pBHdr, ULONG ulSize, PULONG pulSize); 14 void *ConvertCursor(CursorComponent *curHdr, int size, int offsetBits = 0);14 void *ConvertCursor(CursorComponent *curHdr, int size, int *os2size, int offsetBits = 0); 15 15 void *ConvertCursorGroup(CursorHeader *chdr, int size, Win32Image *module); 16 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int offsetBits = 0);16 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int *os2size, int offsetBits = 0); 17 17 void *ConvertIconGroup(IconHeader *ihdr, int size, Win32Image *module); 18 18 void *ConvertMenu(MenuHeader *menu, int size, int cp = 0); 19 19 20 ULONG QueryConvertedBitmapSize(WINBITMAPINFOHEADER *pBHdr, ULONG ulSize); 21 ULONG QueryConvertedCursorSize(CursorComponent *curHdr, int size); 22 ULONG QueryConvertedIconSize(WINBITMAPINFOHEADER *bmpHdr, int size); 20 23 21 24 #endif /* _CVTRESOURCE_H_ */ -
trunk/src/kernel32/makefile
r752 r816 1 # $Id: makefile,v 1.3 7 1999-08-31 14:36:45sandervl Exp $1 # $Id: makefile,v 1.38 1999-09-04 12:41:46 sandervl Exp $ 2 2 3 3 # … … 251 251 winres.OBJ: \ 252 252 .\winres.cpp \ 253 cvtresource.h \ 253 254 $(PDWIN32_INCLUDE)\winresmenu.h \ 254 255 $(PDWIN32_INCLUDE)\winres.h \ … … 349 350 350 351 clean: 351 $(RM) *.OBJ *.LIB *.dll * ~*.map *.pch352 $(RM) *.OBJ *.LIB *.dll *.lrf *.res *.map *.pch 352 353 $(RM) $(PDWIN32_LIB)\$(TARGET).LIB 353 354 $(RM) $(PDWIN32_BIN)\$(TARGET).dll -
trunk/src/kernel32/winres.cpp
r761 r816 1 /* $Id: winres.cpp,v 1.1 4 1999-08-31 17:15:30sandervl Exp $ */1 /* $Id: winres.cpp,v 1.15 1999-09-04 12:41:46 sandervl Exp $ */ 2 2 3 3 /* … … 331 331 } 332 332 //****************************************************************************** 333 //return size of converted win32 resource 334 //****************************************************************************** 335 ULONG Win32Resource::getOS2Size() 336 { 337 switch(type) { 338 case NTRT_NEWBITMAP: 339 case NTRT_BITMAP: 340 return QueryConvertedBitmapSize((WINBITMAPINFOHEADER *)winresdata, ressize); 341 342 case NTRT_CURSOR: 343 return QueryConvertedCursorSize((CursorComponent *)winresdata, ressize); 344 345 case NTRT_ICON: 346 return QueryConvertedIconSize((WINBITMAPINFOHEADER *)winresdata, ressize); 347 348 case NTRT_GROUP_ICON: 349 case NTRT_GROUP_CURSOR: 350 case NTRT_ACCELERATORS: 351 case NTRT_NEWMENU: 352 case NTRT_MENU: 353 case NTRT_NEWDIALOG: 354 case NTRT_DIALOG: 355 case NTRT_FONTDIR: 356 case NTRT_FONT: 357 case NTRT_MESSAGETABLE: 358 case NTRT_RCDATA: 359 case NTRT_VERSION: 360 case NTRT_STRING: 361 default: 362 dprintf(("Win32Resource::getOS2Size SHOULDN'T BE CALLED for this resource type (%d) (NOT IMPLEMENTED)!!", type)); 363 break; 364 } 365 return 0; 366 } 367 //****************************************************************************** 333 368 //****************************************************************************** 334 369 PVOID Win32Resource::convertResource(void *win32res) 335 370 { 336 ULONGcvtressize;371 int cvtressize; 337 372 338 373 switch(type) { … … 342 377 343 378 case NTRT_CURSOR: 344 return ConvertCursor((CursorComponent *)win32res, ressize );379 return ConvertCursor((CursorComponent *)win32res, ressize, &cvtressize); 345 380 346 381 case NTRT_GROUP_CURSOR: … … 351 386 352 387 case NTRT_ICON: 353 return ConvertIcon((WINBITMAPINFOHEADER *)win32res, ressize );388 return ConvertIcon((WINBITMAPINFOHEADER *)win32res, ressize, &cvtressize); 354 389 355 390 case NTRT_ACCELERATORS:
Note:
See TracChangeset
for help on using the changeset viewer.