Skip to content

Commit

Permalink
remove write-only variable iSurface.flags
Browse files Browse the repository at this point in the history
Remove the write only member variable `flags` from struct iSurface.

Additionally remove the macros REND_SURFACE_(UNDEFINED|SCREEN|USR) which
were only used to assign to the `flags` variable.

Signed-off-by: Giel van Schijndel <giel@wz2100.net>
  • Loading branch information
Giel van Schijndel committed Oct 13, 2010
1 parent 569fb99 commit e278f01
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
1 change: 0 additions & 1 deletion lib/ivis_common/ivisdef.h
Expand Up @@ -40,7 +40,6 @@
typedef struct { int32_t left, top, right, bottom; } iClip;

typedef struct _iSurface {
int32_t flags;
int xcentre;
int ycentre;
iClip clip;
Expand Down
8 changes: 1 addition & 7 deletions lib/ivis_common/rendmode.h
Expand Up @@ -42,19 +42,13 @@

//*************************************************************************

#define REND_SURFACE_UNDEFINED 0
#define REND_SURFACE_SCREEN 1
#define REND_SURFACE_USR 2

//*************************************************************************

extern iSurface rendSurface;
extern iSurface *psRendSurface;

//*************************************************************************

extern void iV_RenderAssign(iSurface *s);
extern void iV_SurfaceDestroy(iSurface *s);
extern iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, uint8_t *buffer);
extern iSurface *iV_SurfaceCreate(int width, int height, uint8_t *buffer);

#endif
3 changes: 0 additions & 3 deletions lib/ivis_opengl/piemode.c
Expand Up @@ -52,7 +52,6 @@ BOOL pie_Initialise(void)
{
pie_TexInit();

rendSurface.flags = REND_SURFACE_UNDEFINED;
rendSurface.buffer = NULL;
rendSurface.size = 0;

Expand All @@ -72,7 +71,6 @@ BOOL pie_Initialise(void)
_TEX_INDEX = 0;

rendSurface.buffer = 0;
rendSurface.flags = REND_SURFACE_SCREEN;
rendSurface.width = pie_GetVideoBufferWidth();
rendSurface.height = pie_GetVideoBufferHeight();
rendSurface.xcentre = pie_GetVideoBufferWidth()/2;
Expand All @@ -91,7 +89,6 @@ BOOL pie_Initialise(void)

void pie_ShutDown(void) {
rendSurface.buffer = NULL;
rendSurface.flags = REND_SURFACE_UNDEFINED;
rendSurface.size = 0;

pie_CleanUp();
Expand Down
9 changes: 4 additions & 5 deletions lib/ivis_opengl/rendmode.c
Expand Up @@ -34,19 +34,18 @@ iSurface *psRendSurface;
//*
//******

iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, UBYTE *buffer)
iSurface *iV_SurfaceCreate(int width, int height, UBYTE *buffer)
{
iSurface *s = malloc(sizeof(iSurface));

assert(buffer!=NULL); // on playstation this MUST be null

if (!s)
{
debug(LOG_ERROR, "iV_SurfaceCreate: out of memory");
debug(LOG_ERROR, "of memory");
return NULL;
}

s->flags = flags;
s->xcentre = width>>1;
s->ycentre = height>>1;
s->width = width;
Expand Down Expand Up @@ -89,6 +88,6 @@ void iV_RenderAssign(iSurface *s)
/* Need to look into this - won't the unwanted called still set render surface? */
psRendSurface = s;

debug(LOG_3D, "iV_RenderAssign: flags %x; xcentre %d; ycentre %d; buffer %p",
s->flags, s->xcentre, s->ycentre, s->buffer);
debug(LOG_3D, "iV_RenderAssign: xcentre %d; ycentre %d; buffer %p",
s->xcentre, s->ycentre, s->buffer);
}
8 changes: 4 additions & 4 deletions src/intdisplay.c
Expand Up @@ -1858,7 +1858,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_OBJECTSURFACES; i++) {
ObjectSurfaces[i].Buffer = (UBYTE*)malloc(Width*Height);
ASSERT( ObjectSurfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate Object surface" );
ObjectSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,ObjectSurfaces[i].Buffer);
ObjectSurfaces[i].Surface = iV_SurfaceCreate(Width,Height,ObjectSurfaces[i].Buffer);
ASSERT( ObjectSurfaces[i].Surface!=NULL,"intInitialise : Failed to create Object surface" );
}

Expand All @@ -1870,7 +1870,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_SYSTEM0SURFACES; i++) {
System0Surfaces[i].Buffer = (UBYTE*)malloc(Width*Height);
ASSERT( System0Surfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate System0 surface" );
System0Surfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,System0Surfaces[i].Buffer);
System0Surfaces[i].Surface = iV_SurfaceCreate(Width,Height,System0Surfaces[i].Buffer);
ASSERT( System0Surfaces[i].Surface!=NULL,"intInitialise : Failed to create System0 surface" );
}

Expand All @@ -1882,7 +1882,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_TOPICSURFACES; i++) {
TopicSurfaces[i].Buffer = (UBYTE*)malloc(WidthTopic*HeightTopic);
ASSERT( TopicSurfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate Topic surface" );
TopicSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,WidthTopic,HeightTopic,TopicSurfaces[i].Buffer);
TopicSurfaces[i].Surface = iV_SurfaceCreate(WidthTopic,HeightTopic,TopicSurfaces[i].Buffer);
ASSERT( TopicSurfaces[i].Surface!=NULL,"intInitialise : Failed to create Topic surface" );
}

Expand All @@ -1894,7 +1894,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_STATSURFACES; i++) {
StatSurfaces[i].Buffer = (UBYTE*)malloc(Width*Height);
ASSERT( StatSurfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate Stats surface" );
StatSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,StatSurfaces[i].Buffer);
StatSurfaces[i].Surface = iV_SurfaceCreate(Width,Height,StatSurfaces[i].Buffer);
ASSERT( StatSurfaces[i].Surface!=NULL,"intInitialise : Failed to create Stat surface" );
}

Expand Down

0 comments on commit e278f01

Please sign in to comment.