DRAWABLE and STRING_TABLE turned into flat memory references.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2891 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -131,8 +131,7 @@ typedef struct
|
|||||||
STAMP IntersectStamp;
|
STAMP IntersectStamp;
|
||||||
} INTERSECT_CONTROL;
|
} INTERSECT_CONTROL;
|
||||||
|
|
||||||
typedef DWORD DRAWABLE;
|
typedef MEM_HANDLE DRAWABLE;
|
||||||
#define BUILD_DRAWABLE(h,i) ((DRAWABLE)MAKE_DWORD(h,i))
|
|
||||||
|
|
||||||
typedef MEM_HANDLE FONT_REF;
|
typedef MEM_HANDLE FONT_REF;
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,9 @@ typedef struct drawable_desc
|
|||||||
#define DRAWABLE_PRIORITY DEFAULT_MEM_PRIORITY
|
#define DRAWABLE_PRIORITY DEFAULT_MEM_PRIORITY
|
||||||
|
|
||||||
extern DRAWABLE AllocDrawable (COUNT num_frames);
|
extern DRAWABLE AllocDrawable (COUNT num_frames);
|
||||||
#define LockDrawable(D) ((DRAWABLE_DESC*)mem_lock (GetDrawableHandle (D)))
|
#define LockDrawable(D) ((DRAWABLE_DESC*)mem_lock (D))
|
||||||
#define UnlockDrawable(D) mem_unlock (GetDrawableHandle (D))
|
#define UnlockDrawable(D) mem_unlock (D)
|
||||||
#define FreeDrawable(D) _ReleaseCelData (GetDrawableHandle (D))
|
#define FreeDrawable(D) _ReleaseCelData (D)
|
||||||
#define GetDrawableHandle(D) ((MEM_HANDLE)LOWORD (D))
|
|
||||||
#define GetDrawableIndex(D) ((COUNT)HIWORD (D))
|
|
||||||
#define GetFrameParentDrawable(F) (F)->parent
|
#define GetFrameParentDrawable(F) (F)->parent
|
||||||
|
|
||||||
#define TYPE_GET(f) ((f) & FTYPE_MASK)
|
#define TYPE_GET(f) ((f) & FTYPE_MASK)
|
||||||
|
|||||||
@@ -36,12 +36,9 @@
|
|||||||
DRAWABLE
|
DRAWABLE
|
||||||
LoadDisplayPixmap (RECT *area, FRAME frame)
|
LoadDisplayPixmap (RECT *area, FRAME frame)
|
||||||
{
|
{
|
||||||
DRAWABLE buffer;
|
MEM_HANDLE buffer = GetFrameHandle (frame);
|
||||||
|
COUNT index = GetFrameIndex (frame);
|
||||||
|
|
||||||
buffer = BUILD_DRAWABLE (
|
|
||||||
GetFrameHandle (frame),
|
|
||||||
GetFrameIndex (frame)
|
|
||||||
);
|
|
||||||
if (buffer || (buffer = CreateDrawable (
|
if (buffer || (buffer = CreateDrawable (
|
||||||
WANT_PIXMAP | MAPPED_TO_DISPLAY,
|
WANT_PIXMAP | MAPPED_TO_DISPLAY,
|
||||||
area->extent.width,
|
area->extent.width,
|
||||||
@@ -49,7 +46,7 @@ LoadDisplayPixmap (RECT *area, FRAME frame)
|
|||||||
1))
|
1))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
frame = CaptureDrawable (buffer);
|
frame = SetAbsFrameIndex (CaptureDrawable (buffer), index);
|
||||||
ReadDisplay (area, frame);
|
ReadDisplay (area, frame);
|
||||||
ReleaseDrawable (frame);
|
ReleaseDrawable (frame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ CaptureDrawable (DRAWABLE Drawable)
|
|||||||
DrawablePtr = LockDrawable (Drawable);
|
DrawablePtr = LockDrawable (Drawable);
|
||||||
if (DrawablePtr)
|
if (DrawablePtr)
|
||||||
{
|
{
|
||||||
COUNT FrameIndex;
|
return &DrawablePtr->Frame[0];
|
||||||
|
|
||||||
FrameIndex = GetDrawableIndex (Drawable);
|
|
||||||
return &DrawablePtr->Frame[FrameIndex];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
@@ -45,13 +42,13 @@ ReleaseDrawable (FRAME FramePtr)
|
|||||||
DRAWABLE_DESC *DrawablePtr;
|
DRAWABLE_DESC *DrawablePtr;
|
||||||
|
|
||||||
DrawablePtr = GetFrameParentDrawable (FramePtr);
|
DrawablePtr = GetFrameParentDrawable (FramePtr);
|
||||||
Drawable = BUILD_DRAWABLE (DrawablePtr->hDrawable, FramePtr->Index);
|
Drawable = DrawablePtr->hDrawable;
|
||||||
UnlockDrawable (Drawable);
|
UnlockDrawable (Drawable);
|
||||||
|
|
||||||
return (Drawable);
|
return (Drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_HANDLE
|
MEM_HANDLE
|
||||||
|
|||||||
@@ -409,10 +409,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
|
|||||||
{
|
{
|
||||||
log_add (log_Warning, "Couldn't allocate space for '%s' images", _cur_resfile_name);
|
log_add (log_Warning, "Couldn't allocate space for '%s' images", _cur_resfile_name);
|
||||||
|
|
||||||
/* This isn't a very good way to return failure, but
|
return NULL_HANDLE;
|
||||||
* it seems to be how it is normally done in this
|
|
||||||
* routine. */
|
|
||||||
return (GetDrawableHandle (0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ani = HMalloc (sizeof (AniData) * cel_total);
|
ani = HMalloc (sizeof (AniData) * cel_total);
|
||||||
@@ -421,10 +418,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
|
|||||||
HFree (img);
|
HFree (img);
|
||||||
log_add (log_Warning, "Couldn't allocate space for '%s' anidata", _cur_resfile_name);
|
log_add (log_Warning, "Couldn't allocate space for '%s' anidata", _cur_resfile_name);
|
||||||
|
|
||||||
/* This isn't a very good way to return failure, but
|
return NULL_HANDLE;
|
||||||
* it seems to be how it is normally done in this
|
|
||||||
* routine. */
|
|
||||||
return (GetDrawableHandle (0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cel_index = 0;
|
cel_index = 0;
|
||||||
@@ -461,7 +455,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawable = 0;
|
Drawable = NULL_HANDLE;
|
||||||
if (cel_index && (Drawable = AllocDrawable (cel_index)))
|
if (cel_index && (Drawable = AllocDrawable (cel_index)))
|
||||||
{
|
{
|
||||||
DRAWABLE_DESC *DrawablePtr;
|
DRAWABLE_DESC *DrawablePtr;
|
||||||
@@ -472,13 +466,13 @@ _GetCelData (uio_Stream *fp, DWORD length)
|
|||||||
SDL_FreeSurface (img[cel_index]);
|
SDL_FreeSurface (img[cel_index]);
|
||||||
|
|
||||||
mem_release ((MEM_HANDLE)Drawable);
|
mem_release ((MEM_HANDLE)Drawable);
|
||||||
Drawable = 0;
|
Drawable = NULL_HANDLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FRAME FramePtr;
|
FRAME FramePtr;
|
||||||
|
|
||||||
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
|
DrawablePtr->hDrawable = Drawable;
|
||||||
DrawablePtr->Flags = WANT_PIXMAP;
|
DrawablePtr->Flags = WANT_PIXMAP;
|
||||||
DrawablePtr->MaxIndex = cel_index - 1;
|
DrawablePtr->MaxIndex = cel_index - 1;
|
||||||
|
|
||||||
@@ -496,7 +490,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
|
|||||||
|
|
||||||
HFree (img);
|
HFree (img);
|
||||||
HFree (ani);
|
HFree (ani);
|
||||||
return (GetDrawableHandle (Drawable));
|
return Drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -773,14 +767,14 @@ _request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType,
|
|||||||
if ((DrawablePtr = LockDrawable (Drawable)) == 0)
|
if ((DrawablePtr = LockDrawable (Drawable)) == 0)
|
||||||
{
|
{
|
||||||
FreeDrawable (Drawable);
|
FreeDrawable (Drawable);
|
||||||
Drawable = 0;
|
Drawable = NULL_HANDLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int imgw, imgh;
|
int imgw, imgh;
|
||||||
FRAME FramePtr;
|
FRAME FramePtr;
|
||||||
|
|
||||||
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
|
DrawablePtr->hDrawable = Drawable;
|
||||||
DrawablePtr->Flags = flags;
|
DrawablePtr->Flags = flags;
|
||||||
DrawablePtr->MaxIndex = NumFrames - 1;
|
DrawablePtr->MaxIndex = NumFrames - 1;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ LoadStringTableFile (uio_DirHandle *dir, const char *fileName)
|
|||||||
_cur_resfile_name = 0;
|
_cur_resfile_name = 0;
|
||||||
res_CloseResFile (fp);
|
res_CloseResFile (fp);
|
||||||
|
|
||||||
return (BUILD_STRING_TABLE (hData));
|
return hData;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ LoadStringTableInstance (DWORD res)
|
|||||||
res_DetachResource (res);
|
res_DetachResource (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (BUILD_STRING_TABLE (hData));
|
return hData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,14 +37,13 @@ typedef STRING_TABLE_DESC *PSTRING_TABLE_DESC;
|
|||||||
#define HAS_TIMESTAMP (1 << 1)
|
#define HAS_TIMESTAMP (1 << 1)
|
||||||
#define STRING_TABLEPTR PSTRING_TABLE_DESC
|
#define STRING_TABLEPTR PSTRING_TABLE_DESC
|
||||||
|
|
||||||
#define AllocStringTable(s) AllocResourceData((s),MEM_SOUND)
|
#define AllocStringTable(s) AllocResourceData((s),MEM_SOUND)
|
||||||
#define LockStringTable(h,ps) LockResourceData((MEM_HANDLE)LOWORD(h),ps)
|
#define LockStringTable LockResourceData
|
||||||
#define UnlockStringTable(h) UnlockResourceData ((MEM_HANDLE)LOWORD(h))
|
#define UnlockStringTable UnlockResourceData
|
||||||
#define FreeStringTable(h) FreeResourceData ((MEM_HANDLE)LOWORD(h))
|
#define FreeStringTable FreeResourceData
|
||||||
|
|
||||||
#define STRING_INDEX(S) ((COUNT)HIWORD (S))
|
#define STRING_INDEX(S) ((COUNT)HIWORD (S))
|
||||||
#define BUILD_STRING(h,i) ((STRING_TABLE)MAKE_DWORD(h,i))
|
#define BUILD_STRING(h,i) ((STRING)MAKE_DWORD(h,i))
|
||||||
#define BUILD_STRING_TABLE(h) (STRING_TABLE)(h)
|
|
||||||
|
|
||||||
extern MEM_HANDLE _GetStringData (uio_Stream *fp, DWORD length);
|
extern MEM_HANDLE _GetStringData (uio_Stream *fp, DWORD length);
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,12 @@
|
|||||||
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
|
#include "libs/memlib.h"
|
||||||
#include "libs/uio.h"
|
#include "libs/uio.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
typedef DWORD STRING_TABLE;
|
typedef MEM_HANDLE STRING_TABLE;
|
||||||
typedef DWORD STRING;
|
typedef DWORD STRING;
|
||||||
typedef BYTE* STRINGPTR;
|
typedef BYTE* STRINGPTR;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user