Subversion Repositories filter_foundry

Rev

Rev 301 | Rev 444 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 301 Rev 407
Line 26... Line 26...
26
#include "dbg.h"
26
#include "dbg.h"
27
 
27
 
28
/* see "DIBs and Their Use",
28
/* see "DIBs and Their Use",
29
   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngdi/html/msdn_dibs2.asp */
29
   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngdi/html/msdn_dibs2.asp */
30
 
30
 
-
 
31
typedef HBITMAP(__stdcall* f_CreateDIBSection)(HDC hdc, CONST BITMAPINFO* pbmi, UINT usage, VOID** ppvBits, HANDLE hSection, DWORD offset);
-
 
32
HBITMAP _CreateDIBSection(HDC hdc, CONST BITMAPINFO* pbmi, UINT usage, VOID** ppvBits, HANDLE hSection, DWORD offset) {
-
 
33
        // Calling dynamically, because Windows NT 3.1 does not support CreateDIBSection
-
 
34
        HMODULE hLib;
-
 
35
        f_CreateDIBSection fCreateDIBSection;
-
 
36
        HBITMAP res;
-
 
37
 
-
 
38
        hLib = LoadLibraryA("GDI32.DLL");
-
 
39
        if (!hLib) return 0;
-
 
40
        fCreateDIBSection = (f_CreateDIBSection)(void*)GetProcAddress(hLib, "CreateDIBSection");
-
 
41
        if (fCreateDIBSection != 0) {
-
 
42
                res = fCreateDIBSection(hdc, pbmi, usage, ppvBits, hSection, offset);
-
 
43
                FreeLibrary(hLib);
-
 
44
                return res;
-
 
45
        }
-
 
46
        else {
-
 
47
                return NULL;
-
 
48
        }
-
 
49
}
-
 
50
 
31
Boolean newbitmap(BITMAPREF *ppb,int depth,UIRECT *bounds){
51
Boolean newbitmap(BITMAPREF *ppb,int depth,UIRECT *bounds){
32
        //char s[0x100];
52
        //char s[0x100];
33
        if( (*ppb = (BITMAPREF)malloc(sizeof(**ppb))) ){
53
        if( (*ppb = (BITMAPREF)malloc(sizeof(**ppb))) ){
34
                BITMAPINFOHEADER *pbmih = &(*ppb)->bmi.bmiHeader;
54
                BITMAPINFOHEADER *pbmih = &(*ppb)->bmi.bmiHeader;
35
 
55
 
Line 43... Line 63...
43
                pbmih->biXPelsPerMeter =
63
                pbmih->biXPelsPerMeter =
44
                pbmih->biYPelsPerMeter = 0;
64
                pbmih->biYPelsPerMeter = 0;
45
                pbmih->biClrUsed =
65
                pbmih->biClrUsed =
46
                pbmih->biClrImportant = 0;
66
                pbmih->biClrImportant = 0;
47
 
67
 
48
                (*ppb)->hbmp = CreateDIBSection(NULL/*hDC*/,&(*ppb)->bmi,DIB_RGB_COLORS,(void**)&(*ppb)->pbits,NULL,0);
68
                (*ppb)->hbmp = _CreateDIBSection(NULL/*hDC*/,&(*ppb)->bmi,DIB_RGB_COLORS,(void**)&(*ppb)->pbits,NULL,0);
49
 
69
 
50
                (*ppb)->rowbytes = ((depth * pbmih->biWidth + 31) >> 3) & -4;
70
                (*ppb)->rowbytes = ((depth * pbmih->biWidth + 31) >> 3) & -4;
51
 
71
 
52
                if( (*ppb)->hbmp ){
72
                if( (*ppb)->hbmp ){
53
 
73