From ef3ab009984534c308ca0ee94cd3fcbccdc63448 Mon Sep 17 00:00:00 2001 From: "Unknown (JL)" Date: Mon, 4 Oct 1999 11:40:50 +0000 Subject: [PATCH] Renameing funktions from DIB to prevent name clashes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/clipbrd.cpp | 2 +- src/msw/cursor.cpp | 2 +- src/msw/dib.cpp | 38 ++++++++++++++---------------- src/msw/dibutils.cpp | 56 ++++++++++++++++++++++---------------------- src/msw/pnghand.cpp | 10 ++++---- src/msw/tbarmsw.cpp | 2 +- 6 files changed, 54 insertions(+), 56 deletions(-) diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 5f8cc9d74d..33407bebc0 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -221,7 +221,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxBitmap *bitmap = (wxBitmap *)data; HBITMAP hBitmap = (HBITMAP)bitmap->GetHBITMAP(); // NULL palette means to use the system one - HANDLE hDIB = BitmapToDIB(hBitmap, (HPALETTE)NULL); + HANDLE hDIB = wxBitmapToDIB(hBitmap, (HPALETTE)NULL); handle = SetClipboardData(CF_DIB, hDIB); #endif break; diff --git a/src/msw/cursor.cpp b/src/msw/cursor.cpp index 4d2bdf322d..e88bb3d775 100644 --- a/src/msw/cursor.cpp +++ b/src/msw/cursor.cpp @@ -113,7 +113,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho #if wxUSE_RESOURCE_LOADING_IN_MSW HBITMAP hBitmap = 0; HPALETTE hPalette = 0; - bool success = ReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0; + bool success = wxReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0; if (!success) return; if (hPalette) diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index c488c6e19e..3d91a3250c 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -6,7 +6,7 @@ * * * FUNCTIONS : * * * - * ReadDIB() - Reads a DIB * + * wxReadDIB() - Reads a DIB * * * * WriteDIB() - Writes a global handle in CF_DIB format* * to a file. * @@ -91,8 +91,6 @@ WORD PaletteSize (VOID FAR * pv); WORD DibNumColors (VOID FAR * pv); // HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal); BOOL PASCAL MakeBitmapAndPalette(HDC,HANDLE,HPALETTE *,HBITMAP *); -HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER); -BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette); /**************************************************************************** * * @@ -105,7 +103,7 @@ BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette); * * ****************************************************************************/ -BOOL WriteDIB(LPTSTR szFile, HANDLE hdib) +static BOOL WriteDIB(LPTSTR szFile, HANDLE hdib) { BITMAPFILEHEADER hdr; LPBITMAPINFOHEADER lpbi; @@ -156,7 +154,7 @@ BOOL WriteDIB(LPTSTR szFile, HANDLE hdib) * * ****************************************************************************/ -WORD PaletteSize(VOID FAR * pv) +static WORD PaletteSize(VOID FAR * pv) { LPBITMAPINFOHEADER lpbi; WORD NumColors; @@ -181,7 +179,7 @@ WORD PaletteSize(VOID FAR * pv) * * ****************************************************************************/ -WORD DibNumColors(VOID FAR *pv) +static WORD DibNumColors(VOID FAR *pv) { int bits; BITMAPINFOHEADER *lpbi; @@ -228,7 +226,7 @@ WORD DibNumColors(VOID FAR *pv) ****************************************************************************/ #if NOTHING -HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) +static HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) { BITMAP bm; BITMAPINFOHEADER bi; @@ -356,7 +354,7 @@ HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) * * ****************************************************************************/ -DWORD PASCAL lread(int fh, void far *pv, DWORD ul) +static DWORD PASCAL lread(int fh, void far *pv, DWORD ul) { DWORD ulT = ul; #if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__) @@ -386,7 +384,7 @@ DWORD PASCAL lread(int fh, void far *pv, DWORD ul) * * ****************************************************************************/ -DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) +static DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) { DWORD ulT = ul; #if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__) @@ -420,7 +418,7 @@ DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) * FALSE - otherwise * ****************************************************************************/ -BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) +BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) { int fh; LPBITMAPINFOHEADER lpbi; @@ -588,7 +586,7 @@ ErrExit2: * not valid * ****************************************************************************/ -BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, +static BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, HPALETTE * phPal, HBITMAP * phBitmap) { LPBITMAPINFOHEADER lpInfo; @@ -603,7 +601,7 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, lpInfo = (LPBITMAPINFOHEADER) GlobalLock(hDIB); #endif - hPalette = MakeDIBPalette(lpInfo); + hPalette = wxMakeDIBPalette(lpInfo); if ( hPalette ) { // Need to realize palette for converting DIB to bitmap. @@ -632,7 +630,7 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, /**************************************************************************** * * - * FUNCTION : MakeDIBPalette(lpInfo) * + * FUNCTION : wxMakeDIBPalette(lpInfo) * * * * PURPOSE : Given a BITMAPINFOHEADER, create a palette based on * the color table. @@ -642,7 +640,7 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, * zero - unable to create palette * * ****************************************************************************/ -HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) +HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo) { #ifdef __WXWINE__ return (FALSE); @@ -703,7 +701,7 @@ bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal) HBITMAP hBitmap; HPALETTE hPalette; - bool success = (ReadDIB(filename, &hBitmap, &hPalette) != 0); + bool success = (wxReadDIB(filename, &hBitmap, &hPalette) != 0); if (!success) { @@ -782,7 +780,7 @@ wxBitmap *wxLoadBitmap(wxChar *filename, wxPalette **pal) // //--------------------------------------------------------------------- -void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr, +static void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr, DWORD dwWidth, DWORD dwHeight, int nBPP) @@ -815,7 +813,7 @@ void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr, -LPSTR FindDIBBits (LPSTR lpbi) +LPSTR wxFindDIBBits (LPSTR lpbi) { return (lpbi + *(LPDWORD)lpbi + PaletteSize (lpbi)); } @@ -840,7 +838,7 @@ LPSTR FindDIBBits (LPSTR lpbi) // //--------------------------------------------------------------------- -HANDLE BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal) +HANDLE wxBitmapToDIB (HBITMAP hBitmap, HPALETTE hPal) { BITMAP Bitmap; BITMAPINFOHEADER bmInfoHdr; @@ -882,7 +880,7 @@ HANDLE BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal) #endif *lpbmInfoHdr = bmInfoHdr; - lpBits = FindDIBBits ((LPSTR) lpbmInfoHdr); + lpBits = wxFindDIBBits ((LPSTR) lpbmInfoHdr); // Now, we need a DC to hold our bitmap. If the app passed us @@ -934,7 +932,7 @@ bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette *colourmap) if (colourmap) hPalette = (HPALETTE) colourmap->GetHPALETTE(); - HANDLE dibHandle = BitmapToDIB((HBITMAP) bitmap->GetHBITMAP(), hPalette); + HANDLE dibHandle = wxBitmapToDIB((HBITMAP) bitmap->GetHBITMAP(), hPalette); if (dibHandle) { bool success = (WriteDIB(filename, dibHandle) != 0); diff --git a/src/msw/dibutils.cpp b/src/msw/dibutils.cpp index 923135a2a4..6736a42d66 100644 --- a/src/msw/dibutils.cpp +++ b/src/msw/dibutils.cpp @@ -82,7 +82,7 @@ * mapping for fast performance. */ -void ClearSystemPalette(void) +void wxClearSystemPalette(void) { //*** A dummy palette setup struct @@ -146,7 +146,7 @@ void ClearSystemPalette(void) * bits.... */ -int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) +int wxDibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) { HFILE fh; OFSTRUCT of; @@ -158,7 +158,7 @@ int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) return 0; } - long size = DibSize(lpbi); + long size = wxDibSize(lpbi); // write file header BITMAPFILEHEADER bmf; @@ -166,7 +166,7 @@ int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) bmf.bfSize = sizeof(bmf) + size; bmf.bfReserved1 = 0; bmf.bfReserved2 = 0; - bmf.bfOffBits = sizeof(bmf) + (char FAR*)(DibPtr(lpbi)) - (char FAR*)lpbi; + bmf.bfOffBits = sizeof(bmf) + (char FAR*)(wxDibPtr(lpbi)) - (char FAR*)lpbi; #if defined( __WATCOMC__) || defined(__VISUALC__) || defined(__SC__) || defined(__SALFORDC__) || defined(__MWERKS__) || defined(wxUSE_NORLANDER_HEADERS) if (_hwrite(fh, (LPCSTR)(&bmf), sizeof(bmf))<0 || _hwrite(fh, (LPCSTR)lpbi, size)<0) { @@ -187,7 +187,7 @@ int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) return 1; } -PDIB DibOpenFile(LPTSTR szFile) +PDIB wxDibOpenFile(LPTSTR szFile) { HFILE fh; DWORD dwLen; @@ -231,7 +231,7 @@ PDIB DibOpenFile(LPTSTR szFile) if (fh == -1) return NULL; - pdib = DibReadBitmapInfo(fh); + pdib = wxDibReadBitmapInfo(fh); if (!pdib) return NULL; @@ -239,7 +239,7 @@ PDIB DibOpenFile(LPTSTR szFile) /* How much memory do we need to hold the DIB */ dwBits = pdib->biSizeImage; - dwLen = pdib->biSize + DibPaletteSize(pdib) + dwBits; + dwLen = pdib->biSize + wxDibPaletteSize(pdib) + dwBits; /* Can we get more memory? */ @@ -258,7 +258,7 @@ PDIB DibOpenFile(LPTSTR szFile) if (pdib) { /* read in the bits */ - _hread(fh, (LPBYTE)pdib + (UINT)pdib->biSize + DibPaletteSize(pdib), dwBits); + _hread(fh, (LPBYTE)pdib + (UINT)pdib->biSize + wxDibPaletteSize(pdib), dwBits); } _lclose(fh); @@ -275,7 +275,7 @@ PDIB DibOpenFile(LPTSTR szFile) * bitmap formats, but will always return a "new" BITMAPINFO. */ -PDIB DibReadBitmapInfo(HFILE fh) +PDIB wxDibReadBitmapInfo(HFILE fh) { DWORD off; int size; @@ -336,16 +336,16 @@ PDIB DibReadBitmapInfo(HFILE fh) break; } - nNumColors = DibNumColors(&bi); + nNumColors = wxDibNumColors(&bi); #if 0 if (bi.biSizeImage == 0) bi.biSizeImage = DibSizeImage(&bi); if (bi.biClrUsed == 0) - bi.biClrUsed = DibNumColors(&bi); + bi.biClrUsed = wxDibNumColors(&bi); #else - FixBitmapInfo(&bi); + wxFixBitmapInfo(&bi); #endif pdib = (PDIB)GlobalAllocPtr(GMEM_MOVEABLE,(LONG)bi.biSize + nNumColors * sizeof(RGBQUAD)); @@ -355,7 +355,7 @@ PDIB DibReadBitmapInfo(HFILE fh) *pdib = bi; - pRgb = DibColors(pdib); + pRgb = wxDibColors(pdib); if (nNumColors) { @@ -402,7 +402,7 @@ PDIB DibReadBitmapInfo(HFILE fh) * in the passed palette */ -BOOL DibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage) +BOOL wxDibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage) { PALETTEENTRY ape[256]; RGBQUAD FAR * pRgb; @@ -416,14 +416,14 @@ BOOL DibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage) if (!pdib) return FALSE; - nColors = DibNumColors(pdib); + nColors = wxDibNumColors(pdib); - if (nColors == 3 && DibCompression(pdib) == BI_BITFIELDS) + if (nColors == 3 && wxDibCompression(pdib) == BI_BITFIELDS) nColors = 0; if (nColors > 0) { - pRgb = DibColors(pdib); + pRgb = wxDibColors(pdib); switch (wUsage) { @@ -464,7 +464,7 @@ BOOL DibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage) * given number of bits per pixel */ -PDIB DibCreate(int bits, int dx, int dy) +PDIB wxDibCreate(int bits, int dx, int dy) { LPBITMAPINFOHEADER lpbi ; DWORD dwSizeImage; @@ -616,7 +616,7 @@ static void hmemmove(BYTE _huge *d, BYTE _huge *s, LONG len) * the colors of the given palette. */ -BOOL DibMapToPalette(PDIB pdib, HPALETTE hpal) +BOOL wxDibMapToPalette(PDIB pdib, HPALETTE hpal) { LPBITMAPINFOHEADER lpbi; PALETTEENTRY pe; @@ -632,13 +632,13 @@ BOOL DibMapToPalette(PDIB pdib, HPALETTE hpal) return FALSE; lpbi = (LPBITMAPINFOHEADER)pdib; - lpRgb = DibColors(pdib); + lpRgb = wxDibColors(pdib); GetObject(hpal,sizeof(int),(LPSTR)&nPalColors); - nDibColors = DibNumColors(pdib); + nDibColors = wxDibNumColors(pdib); if ((SizeImage = lpbi->biSizeImage) == 0) - SizeImage = DibSizeImage(lpbi); + SizeImage = wxDibSizeImage(lpbi); // // build a xlat table. from the current DIB colors to the given @@ -647,7 +647,7 @@ BOOL DibMapToPalette(PDIB pdib, HPALETTE hpal) for (n=0; nbiClrUsed = nPalColors; // @@ -656,14 +656,14 @@ BOOL DibMapToPalette(PDIB pdib, HPALETTE hpal) if (nPalColors > nDibColors) { GlobalReAllocPtr(lpbi, lpbi->biSize + nPalColors*sizeof(RGBQUAD) + SizeImage, 0); - hmemmove((BYTE _huge *)DibPtr(lpbi), (BYTE _huge *)lpBits, SizeImage); - lpBits = (LPBYTE)DibPtr(lpbi); + hmemmove((BYTE _huge *)wxDibPtr(lpbi), (BYTE _huge *)lpBits, SizeImage); + lpBits = (LPBYTE)wxDibPtr(lpbi); } else if (nPalColors < nDibColors) { - hmemcpy(DibPtr(lpbi), lpBits, SizeImage); + hmemcpy(wxDibPtr(lpbi), lpBits, SizeImage); GlobalReAllocPtr(lpbi, lpbi->biSize + nPalColors*sizeof(RGBQUAD) + SizeImage, 0); - lpBits = (LPBYTE)DibPtr(lpbi); + lpBits = (LPBYTE)wxDibPtr(lpbi); } // @@ -704,7 +704,7 @@ BOOL DibMapToPalette(PDIB pdib, HPALETTE hpal) } -HPALETTE MakePalette(const BITMAPINFO FAR* Info, UINT flags) +HPALETTE wxMakePalette(const BITMAPINFO FAR* Info, UINT flags) { HPALETTE hPalette; const RGBQUAD FAR* rgb = Info->bmiColors; diff --git a/src/msw/pnghand.cpp b/src/msw/pnghand.cpp index 691df4355b..7b83b89a4e 100644 --- a/src/msw/pnghand.cpp +++ b/src/msw/pnghand.cpp @@ -131,9 +131,9 @@ wxPNGReader::Create(int width, int height, int depth, int colortype) } RawImage = 0; Palette = 0; - lpbi = DibCreate(Depth, Width, Height); + lpbi = wxDibCreate(Depth, Width, Height); if (lpbi) { - RawImage = (ImagePointerType)DibPtr(lpbi); + RawImage = (ImagePointerType)wxDibPtr(lpbi); EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4; imageOK = TRUE; } @@ -217,7 +217,7 @@ bool wxPNGReader::SetPalette(wxPalette* colourmap) return FALSE; ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR); Palette = colourmap; - return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0); + return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0); } bool @@ -231,7 +231,7 @@ wxPNGReader::SetPalette(int n, byte *r, byte *g, byte *b) if (!b) b = g; Palette->Create(n, r, g, b); ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR); - return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0); + return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0); } bool @@ -257,7 +257,7 @@ wxPNGReader::SetPalette(int n, rgb_color_struct *rgb_struct) Palette->Create(n, r, g, b); ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR); - return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0); + return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0); } void wxPNGReader::NullData() diff --git a/src/msw/tbarmsw.cpp b/src/msw/tbarmsw.cpp index 3ca04af78b..92f59a5990 100644 --- a/src/msw/tbarmsw.cpp +++ b/src/msw/tbarmsw.cpp @@ -944,7 +944,7 @@ WXHBITMAP wxToolBarMSW::CreateMappedBitmap(WXHINSTANCE WXUNUSED(hInstance), void WXHBITMAP wxToolBarMSW::CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap) { - HANDLE hDIB = BitmapToDIB((HBITMAP) hBitmap, 0); + HANDLE hDIB = wxBitmapToDIB((HBITMAP) hBitmap, 0); if (hDIB) { #ifdef __WINDOWS_386__ -- 2.45.2