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:
mcmartin
2008-01-02 22:54:33 +00:00
parent 91e0374f9e
commit b66d240412
9 changed files with 27 additions and 42 deletions
+1 -2
View File
@@ -131,8 +131,7 @@ typedef struct
STAMP IntersectStamp;
} INTERSECT_CONTROL;
typedef DWORD DRAWABLE;
#define BUILD_DRAWABLE(h,i) ((DRAWABLE)MAKE_DWORD(h,i))
typedef MEM_HANDLE DRAWABLE;
typedef MEM_HANDLE FONT_REF;
+3 -5
View File
@@ -66,11 +66,9 @@ typedef struct drawable_desc
#define DRAWABLE_PRIORITY DEFAULT_MEM_PRIORITY
extern DRAWABLE AllocDrawable (COUNT num_frames);
#define LockDrawable(D) ((DRAWABLE_DESC*)mem_lock (GetDrawableHandle (D)))
#define UnlockDrawable(D) mem_unlock (GetDrawableHandle (D))
#define FreeDrawable(D) _ReleaseCelData (GetDrawableHandle (D))
#define GetDrawableHandle(D) ((MEM_HANDLE)LOWORD (D))
#define GetDrawableIndex(D) ((COUNT)HIWORD (D))
#define LockDrawable(D) ((DRAWABLE_DESC*)mem_lock (D))
#define UnlockDrawable(D) mem_unlock (D)
#define FreeDrawable(D) _ReleaseCelData (D)
#define GetFrameParentDrawable(F) (F)->parent
#define TYPE_GET(f) ((f) & FTYPE_MASK)
+3 -6
View File
@@ -36,12 +36,9 @@
DRAWABLE
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 (
WANT_PIXMAP | MAPPED_TO_DISPLAY,
area->extent.width,
@@ -49,7 +46,7 @@ LoadDisplayPixmap (RECT *area, FRAME frame)
1))
)
{
frame = CaptureDrawable (buffer);
frame = SetAbsFrameIndex (CaptureDrawable (buffer), index);
ReadDisplay (area, frame);
ReleaseDrawable (frame);
}
+3 -6
View File
@@ -27,10 +27,7 @@ CaptureDrawable (DRAWABLE Drawable)
DrawablePtr = LockDrawable (Drawable);
if (DrawablePtr)
{
COUNT FrameIndex;
FrameIndex = GetDrawableIndex (Drawable);
return &DrawablePtr->Frame[FrameIndex];
return &DrawablePtr->Frame[0];
}
return (0);
@@ -45,13 +42,13 @@ ReleaseDrawable (FRAME FramePtr)
DRAWABLE_DESC *DrawablePtr;
DrawablePtr = GetFrameParentDrawable (FramePtr);
Drawable = BUILD_DRAWABLE (DrawablePtr->hDrawable, FramePtr->Index);
Drawable = DrawablePtr->hDrawable;
UnlockDrawable (Drawable);
return (Drawable);
}
return (0);
return NULL_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);
/* This isn't a very good way to return failure, but
* it seems to be how it is normally done in this
* routine. */
return (GetDrawableHandle (0));
return NULL_HANDLE;
}
ani = HMalloc (sizeof (AniData) * cel_total);
@@ -421,10 +418,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
HFree (img);
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
* it seems to be how it is normally done in this
* routine. */
return (GetDrawableHandle (0));
return NULL_HANDLE;
}
cel_index = 0;
@@ -461,7 +455,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
break;
}
Drawable = 0;
Drawable = NULL_HANDLE;
if (cel_index && (Drawable = AllocDrawable (cel_index)))
{
DRAWABLE_DESC *DrawablePtr;
@@ -472,13 +466,13 @@ _GetCelData (uio_Stream *fp, DWORD length)
SDL_FreeSurface (img[cel_index]);
mem_release ((MEM_HANDLE)Drawable);
Drawable = 0;
Drawable = NULL_HANDLE;
}
else
{
FRAME FramePtr;
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
DrawablePtr->hDrawable = Drawable;
DrawablePtr->Flags = WANT_PIXMAP;
DrawablePtr->MaxIndex = cel_index - 1;
@@ -496,7 +490,7 @@ _GetCelData (uio_Stream *fp, DWORD length)
HFree (img);
HFree (ani);
return (GetDrawableHandle (Drawable));
return Drawable;
}
BOOLEAN
@@ -773,14 +767,14 @@ _request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType,
if ((DrawablePtr = LockDrawable (Drawable)) == 0)
{
FreeDrawable (Drawable);
Drawable = 0;
Drawable = NULL_HANDLE;
}
else
{
int imgw, imgh;
FRAME FramePtr;
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
DrawablePtr->hDrawable = Drawable;
DrawablePtr->Flags = flags;
DrawablePtr->MaxIndex = NumFrames - 1;
+1 -1
View File
@@ -42,7 +42,7 @@ LoadStringTableFile (uio_DirHandle *dir, const char *fileName)
_cur_resfile_name = 0;
res_CloseResFile (fp);
return (BUILD_STRING_TABLE (hData));
return hData;
}
return (0);
+1 -1
View File
@@ -36,6 +36,6 @@ LoadStringTableInstance (DWORD res)
res_DetachResource (res);
}
return (BUILD_STRING_TABLE (hData));
return hData;
}
+4 -5
View File
@@ -38,13 +38,12 @@ typedef STRING_TABLE_DESC *PSTRING_TABLE_DESC;
#define STRING_TABLEPTR PSTRING_TABLE_DESC
#define AllocStringTable(s) AllocResourceData((s),MEM_SOUND)
#define LockStringTable(h,ps) LockResourceData((MEM_HANDLE)LOWORD(h),ps)
#define UnlockStringTable(h) UnlockResourceData ((MEM_HANDLE)LOWORD(h))
#define FreeStringTable(h) FreeResourceData ((MEM_HANDLE)LOWORD(h))
#define LockStringTable LockResourceData
#define UnlockStringTable UnlockResourceData
#define FreeStringTable FreeResourceData
#define STRING_INDEX(S) ((COUNT)HIWORD (S))
#define BUILD_STRING(h,i) ((STRING_TABLE)MAKE_DWORD(h,i))
#define BUILD_STRING_TABLE(h) (STRING_TABLE)(h)
#define BUILD_STRING(h,i) ((STRING)MAKE_DWORD(h,i))
extern MEM_HANDLE _GetStringData (uio_Stream *fp, DWORD length);
+2 -1
View File
@@ -21,11 +21,12 @@
#include "compiler.h"
#include "port.h"
#include "libs/memlib.h"
#include "libs/uio.h"
#include <stddef.h>
typedef DWORD STRING_TABLE;
typedef MEM_HANDLE STRING_TABLE;
typedef DWORD STRING;
typedef BYTE* STRINGPTR;