Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Jan 3, 2025
1 parent 4cf86ba commit 28bba0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion source/3_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


#include "ui_win.hpp"
#include <windowsx.h>
//#include <windowsx.h>

// --------------------------------------------------------------------------
// ----- UIW_IMAGE ----------------------------------------------------------
Expand Down Expand Up @@ -203,6 +203,8 @@ int UIW_IMAGE::LoadImageFromFile(void)
// Load the bitmap.
ZIL_UINT32 dibSize = bitmapFileHeader.bfSize - sizeof(BITMAPFILEHEADER);
ZIL_UINT32 tdibSize = dibSize;
#define GlobalAllocPtr(flags, cb) \
(GlobalLock(GlobalAlloc((flags), (cb))))
ZIL_UINT8 *dib = (ZIL_UINT8 *)GlobalAllocPtr(GMEM_MOVEABLE, dibSize);
ZIL_UINT8 *tdib = dib;
for ( ; dibSize; dibSize -= tdibSize, tdib += tdibSize)
Expand All @@ -222,6 +224,8 @@ int UIW_IMAGE::LoadImageFromFile(void)
ReleaseDC(NULL, hDC);

// Clean up.
#define GlobalFreePtr(lp) \
(GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
GlobalFreePtr(dib);
delete bitmapInfo;
woStatus &= ~WOS_READ_ERROR;
Expand Down
6 changes: 5 additions & 1 deletion source/9_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


#include "ui_win.hpp"
#include <windowsx.h>
//#include <windowsx.h>

// --------------------------------------------------------------------------
// ----- UIW_IMAGE ----------------------------------------------------------
Expand Down Expand Up @@ -202,6 +202,8 @@ int UIW_IMAGE::LoadImageFromFile(void)
// Load the bitmap.
ZIL_UINT32 dibSize = bitmapFileHeader.bfSize - sizeof(BITMAPFILEHEADER);
ZIL_UINT32 tdibSize = dibSize;
#define GlobalAllocPtr(flags, cb) \
(GlobalLock(GlobalAlloc((flags), (cb))))
ZIL_UINT8 *dib = (ZIL_UINT8 *)GlobalAllocPtr(GMEM_MOVEABLE, dibSize);
ZIL_UINT8 *tdib = dib;
for ( ; dibSize; dibSize -= tdibSize, tdib += tdibSize)
Expand All @@ -221,6 +223,8 @@ int UIW_IMAGE::LoadImageFromFile(void)
ReleaseDC(NULL, hDC);

// Clean up.
#define GlobalFreePtr(lp) \
(GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
GlobalFreePtr(dib);
delete bitmapInfo;
woStatus &= ~WOS_READ_ERROR;
Expand Down
8 changes: 7 additions & 1 deletion source/w_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
// Zinc Software Incorporated. Pleasant Grove, Utah USA

#include "ui_win.hpp"
#include <windowsx.h>
//#include <windowsx.h>

#if defined(__WATCOMC__)
#undef GlobalFreePtr
#define GlobalPtrHandle(lp) \
((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp))))
#define GlobalUnlockPtr(lp) \
GlobalUnlock(GlobalPtrHandle(lp))
#define GlobalFreePtr(lp) (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
#endif

Expand Down Expand Up @@ -195,6 +199,8 @@ int UIW_IMAGE::LoadImageFromFile(void)
// Load the bitmap.
ZIL_UINT32 dibSize = bitmapFileHeader.bfSize - sizeof(BITMAPFILEHEADER);
ZIL_UINT32 tdibSize = dibSize;
#define GlobalAllocPtr(flags, cb) \
(GlobalLock(GlobalAlloc((flags), (cb))))
ZIL_UINT8 huge *dib = (ZIL_UINT8 huge *)GlobalAllocPtr(GMEM_MOVEABLE, dibSize);
ZIL_UINT8 huge *tdib = dib;
for ( ; dibSize; dibSize -= tdibSize, tdib += tdibSize)
Expand Down

0 comments on commit 28bba0b

Please sign in to comment.