From 20599bb46313df9f92153a4f3c798fd93791cd2e Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Fri, 3 Jan 2025 23:41:20 +0100 Subject: [PATCH] . --- source/3_image.cpp | 11 ++++++++++- source/9_image.cpp | 11 ++++++++++- source/w_image.cpp | 9 ++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/source/3_image.cpp b/source/3_image.cpp index ad2e043..6934fac 100644 --- a/source/3_image.cpp +++ b/source/3_image.cpp @@ -19,7 +19,7 @@ #include "ui_win.hpp" -#include +//#include // -------------------------------------------------------------------------- // ----- UIW_IMAGE ---------------------------------------------------------- @@ -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) @@ -222,6 +224,13 @@ int UIW_IMAGE::LoadImageFromFile(void) ReleaseDC(NULL, hDC); // Clean up. +#define SELECTOROF( lp ) HIWORD( lp ) +#define GlobalPtrHandle(lp) \ + ((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp)))) +#define GlobalUnlockPtr(lp) \ + GlobalUnlock(GlobalPtrHandle(lp)) +#define GlobalFreePtr(lp) \ + (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp))) GlobalFreePtr(dib); delete bitmapInfo; woStatus &= ~WOS_READ_ERROR; diff --git a/source/9_image.cpp b/source/9_image.cpp index f360e30..ad5c8b2 100644 --- a/source/9_image.cpp +++ b/source/9_image.cpp @@ -19,7 +19,7 @@ #include "ui_win.hpp" -#include +//#include // -------------------------------------------------------------------------- // ----- UIW_IMAGE ---------------------------------------------------------- @@ -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) @@ -221,6 +223,13 @@ int UIW_IMAGE::LoadImageFromFile(void) ReleaseDC(NULL, hDC); // Clean up. +#define SELECTOROF( lp ) HIWORD( lp ) +#define GlobalPtrHandle(lp) \ + ((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp)))) +#define GlobalUnlockPtr(lp) \ + GlobalUnlock(GlobalPtrHandle(lp)) +#define GlobalFreePtr(lp) \ + (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp))) GlobalFreePtr(dib); delete bitmapInfo; woStatus &= ~WOS_READ_ERROR; diff --git a/source/w_image.cpp b/source/w_image.cpp index a94909d..f12aad6 100644 --- a/source/w_image.cpp +++ b/source/w_image.cpp @@ -3,10 +3,15 @@ // Zinc Software Incorporated. Pleasant Grove, Utah USA #include "ui_win.hpp" -#include +//#include #if defined(__WATCOMC__) #undef GlobalFreePtr +#define SELECTOROF( lp ) HIWORD( lp ) +#define GlobalPtrHandle(lp) \ + ((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp)))) +#define GlobalUnlockPtr(lp) \ + GlobalUnlock(GlobalPtrHandle(lp)) #define GlobalFreePtr(lp) (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp))) #endif @@ -195,6 +200,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)