FRAME no longer relies on deliberate buffer overflows.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@720 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.2:
|
Changes towards version 0.2:
|
||||||
|
- Lowered Drawable memory footprint, made Frame safer - Martin
|
||||||
- Support for running without voice .ogg files present -PBlue
|
- Support for running without voice .ogg files present -PBlue
|
||||||
- Slider should now work correctly everywhere -PhracturedBlue
|
- Slider should now work correctly everywhere -PhracturedBlue
|
||||||
- Added 'nosound' driver and --sound=openal|mixsdl|none
|
- Added 'nosound' driver and --sound=openal|mixsdl|none
|
||||||
|
|||||||
@@ -43,14 +43,12 @@ display.h: defines a DISPLAY_INTERFACE and PDISPLAY_INTERFACE type (as
|
|||||||
well as a global _pCurDisplay).
|
well as a global _pCurDisplay).
|
||||||
|
|
||||||
drawable.h: defines FRAME_DESC and DRAWABLE_DESC, and the pointer
|
drawable.h: defines FRAME_DESC and DRAWABLE_DESC, and the pointer
|
||||||
types PFRAME_DESC and PDRAWABLE_DESC. FRAME_DESC includes
|
types PFRAME_DESC and PDRAWABLE_DESC. FRAME_DESC has a
|
||||||
an element "DataOffs", which, horrifyingly, appears to be
|
TFB_Image pointer as a member. DRAWABLE_DESC currently
|
||||||
a deliberate index past the end of the struct. Given a
|
still uses a rather annoying technique where the last
|
||||||
PFRAME_DESC x, (void *)(x[x->DataOffs]) is a void pointer
|
member of a struct is a 1-element array, more memory than
|
||||||
castable to TFB_Image. Preliminary investigations into
|
that is actually allocated, and the array's bounds are
|
||||||
this code make a conversion of DataOffs into a void
|
deliberately overflowed to get at multiple frames.
|
||||||
pointer both feasible and more efficient on modern
|
|
||||||
architectures.)
|
|
||||||
|
|
||||||
font.h: defines FONT_DESC and PFONT_DESC.
|
font.h: defines FONT_DESC and PFONT_DESC.
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#define _DRAWABLE_H
|
#define _DRAWABLE_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "tfb_draw.h"
|
||||||
|
|
||||||
#define ValidPrimType(pt) ((pt)<NUM_PRIMS)
|
#define ValidPrimType(pt) ((pt)<NUM_PRIMS)
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ typedef struct
|
|||||||
DWORD TypeIndexAndFlags;
|
DWORD TypeIndexAndFlags;
|
||||||
HOT_SPOT HotSpot;
|
HOT_SPOT HotSpot;
|
||||||
DWORD Bounds;
|
DWORD Bounds;
|
||||||
long DataOffs;
|
TFB_Image *image;
|
||||||
} FRAME_DESC;
|
} FRAME_DESC;
|
||||||
typedef FRAME_DESC *PFRAME_DESC;
|
typedef FRAME_DESC *PFRAME_DESC;
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
PFRAME_DESC SrcFramePtr;
|
PFRAME_DESC SrcFramePtr;
|
||||||
|
|
||||||
SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame;
|
SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame;
|
||||||
if (SrcFramePtr->DataOffs == 0)
|
if (!SrcFramePtr->image)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Non-existent image to blt()\n");
|
fprintf (stderr, "Non-existent image to blt()\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
img = (TFB_Image *) ((BYTE *) SrcFramePtr + SrcFramePtr->DataOffs);
|
img = SrcFramePtr->image;
|
||||||
|
|
||||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||||
{
|
{
|
||||||
@@ -155,9 +155,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
{
|
{
|
||||||
TFB_Image *dst_img;
|
TFB_Image *dst_img;
|
||||||
|
|
||||||
dst_img = ((TFB_Image *) ((BYTE *) _CurFramePtr +
|
dst_img = _CurFramePtr->image;
|
||||||
_CurFramePtr->DataOffs));
|
|
||||||
|
|
||||||
|
|
||||||
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
||||||
{
|
{
|
||||||
@@ -218,8 +216,7 @@ fillrect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
SDL_Rect SDLRect;
|
SDL_Rect SDLRect;
|
||||||
TFB_Image *img;
|
TFB_Image *img;
|
||||||
|
|
||||||
img = ((TFB_Image *) ((BYTE *) _CurFramePtr +
|
img = _CurFramePtr->image;
|
||||||
_CurFramePtr->DataOffs));
|
|
||||||
|
|
||||||
LockMutex (img->mutex);
|
LockMutex (img->mutex);
|
||||||
|
|
||||||
@@ -282,8 +279,7 @@ read_screen (PRECT lpRect, FRAMEPTR DstFramePtr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TFB_Image *img = (TFB_Image *) ((BYTE *) DstFramePtr +
|
TFB_Image *img = DstFramePtr->image;
|
||||||
DstFramePtr->DataOffs);
|
|
||||||
TFB_DrawScreen_CopyToImage (img, lpRect, TFB_SCREEN_MAIN);
|
TFB_DrawScreen_CopyToImage (img, lpRect, TFB_SCREEN_MAIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,40 +288,7 @@ static DRAWABLE
|
|||||||
alloc_image (COUNT NumFrames, DRAWABLE_TYPE DrawableType, CREATE_FLAGS
|
alloc_image (COUNT NumFrames, DRAWABLE_TYPE DrawableType, CREATE_FLAGS
|
||||||
flags, SIZE width, SIZE height)
|
flags, SIZE width, SIZE height)
|
||||||
{
|
{
|
||||||
DWORD data_byte_count;
|
return AllocDrawable (NumFrames, 0);
|
||||||
DRAWABLE Drawable;
|
|
||||||
|
|
||||||
data_byte_count = 0;
|
|
||||||
if (flags & WANT_MASK)
|
|
||||||
data_byte_count += (DWORD) SCAN_WIDTH (width) * height;
|
|
||||||
if ((flags & WANT_PIXMAP) && DrawableType == RAM_DRAWABLE)
|
|
||||||
{
|
|
||||||
width = ((width << 1) + 3) & ~3;
|
|
||||||
data_byte_count += (DWORD) width * height;
|
|
||||||
}
|
|
||||||
|
|
||||||
Drawable = AllocDrawable (NumFrames, data_byte_count * NumFrames);
|
|
||||||
if (Drawable)
|
|
||||||
{
|
|
||||||
if (DrawableType == RAM_DRAWABLE)
|
|
||||||
{
|
|
||||||
COUNT i;
|
|
||||||
DWORD data_offs;
|
|
||||||
DRAWABLEPTR DrawablePtr;
|
|
||||||
FRAMEPTR F;
|
|
||||||
|
|
||||||
data_offs = sizeof (*F) * NumFrames;
|
|
||||||
DrawablePtr = LockDrawable (Drawable);
|
|
||||||
for (i = 0, F = &DrawablePtr->Frame[0]; i < NumFrames; ++i, ++F)
|
|
||||||
{
|
|
||||||
F->DataOffs = data_offs;
|
|
||||||
data_offs += data_byte_count - sizeof (*F);
|
|
||||||
}
|
|
||||||
UnlockDrawable (Drawable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Drawable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*func_array[]) (PRECT pClipRect, PRIMITIVEPTR PrimPtr) =
|
void (*func_array[]) (PRECT pClipRect, PRIMITIVEPTR PrimPtr) =
|
||||||
|
|||||||
@@ -227,9 +227,8 @@ _image_intersect (PIMAGE_BOX box1, PIMAGE_BOX box2, PRECT rect)
|
|||||||
Uint32 img1colourkey, img2colourkey;
|
Uint32 img1colourkey, img2colourkey;
|
||||||
GetPixelFn getpixel1, getpixel2;
|
GetPixelFn getpixel1, getpixel2;
|
||||||
|
|
||||||
/* Image is (TFB_IMAGE*)(box1->FramePtr + box1->FramePtr->DataOffs) */
|
img1 = (SDL_Surface *)box1->FramePtr->image->NormalImg;
|
||||||
img1 = ((TFB_Image*)((BYTE*)(box1->FramePtr) + box1->FramePtr->DataOffs))->NormalImg;
|
img2 = (SDL_Surface *)box2->FramePtr->image->NormalImg;
|
||||||
img2 = ((TFB_Image*)((BYTE*)(box2->FramePtr) + box2->FramePtr->DataOffs))->NormalImg;
|
|
||||||
|
|
||||||
getpixel1 = getpixel_for(img1);
|
getpixel1 = getpixel_for(img1);
|
||||||
getpixel2 = getpixel_for(img2);
|
getpixel2 = getpixel_for(img2);
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ process_image (FRAMEPTR FramePtr, SDL_Surface *img[], AniData *ani, int cel_ct)
|
|||||||
hx = ani[cel_ct].hotspot_x;
|
hx = ani[cel_ct].hotspot_x;
|
||||||
hy = ani[cel_ct].hotspot_y;
|
hy = ani[cel_ct].hotspot_y;
|
||||||
|
|
||||||
FramePtr->DataOffs = (BYTE *)TFB_DrawImage_New (img[cel_ct]) - (BYTE *)FramePtr;
|
FramePtr->image = TFB_DrawImage_New (img[cel_ct]);
|
||||||
|
|
||||||
tfbimg = (TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs);
|
tfbimg = FramePtr->image;
|
||||||
tfbimg->colormap_index = ani[cel_ct].colormap_index;
|
tfbimg->colormap_index = ani[cel_ct].colormap_index;
|
||||||
img[cel_ct] = tfbimg->NormalImg;
|
img[cel_ct] = (SDL_Surface *)tfbimg->NormalImg;
|
||||||
|
|
||||||
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
|
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
|
||||||
SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h);
|
SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h);
|
||||||
@@ -123,8 +123,8 @@ process_font (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct)
|
|||||||
|
|
||||||
img[cel_ct] = new_surf;
|
img[cel_ct] = new_surf;
|
||||||
|
|
||||||
FramePtr->DataOffs = (BYTE *)TFB_DrawImage_New (img[cel_ct]) - (BYTE *)FramePtr;
|
FramePtr->image = TFB_DrawImage_New (img[cel_ct]);
|
||||||
img[cel_ct] = ((TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs))->NormalImg;
|
img[cel_ct] = FramePtr->image->NormalImg;
|
||||||
|
|
||||||
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
|
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
|
||||||
SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h);
|
SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h);
|
||||||
@@ -144,10 +144,10 @@ FRAMEPTR stretch_frame (FRAMEPTR FramePtr, int neww, int newh, int destroy)
|
|||||||
NewFrame = CaptureDrawable (
|
NewFrame = CaptureDrawable (
|
||||||
CreateDrawable (type, (SIZE)neww, (SIZE)newh, 1)
|
CreateDrawable (type, (SIZE)neww, (SIZE)newh, 1)
|
||||||
);
|
);
|
||||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
tfbImg = FramePtr->image;
|
||||||
LockMutex (tfbImg->mutex);
|
LockMutex (tfbImg->mutex);
|
||||||
src = tfbImg->NormalImg;
|
src = (SDL_Surface *)tfbImg->NormalImg;
|
||||||
dst = ((TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs))->NormalImg;
|
dst = (SDL_Surface *)NewFrame->image->NormalImg;
|
||||||
SDL_LockSurface (src);
|
SDL_LockSurface (src);
|
||||||
SDL_LockSurface (dst);
|
SDL_LockSurface (dst);
|
||||||
|
|
||||||
@@ -172,9 +172,9 @@ void process_rgb_bmp (FRAMEPTR FramePtr, Uint32 *rgba, int maxx, int maxy)
|
|||||||
|
|
||||||
|
|
||||||
// convert 32-bit png font to indexed
|
// convert 32-bit png font to indexed
|
||||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
tfbImg = FramePtr->image;
|
||||||
LockMutex (tfbImg->mutex);
|
LockMutex (tfbImg->mutex);
|
||||||
img = tfbImg->NormalImg;
|
img = (SDL_Surface *)tfbImg->NormalImg;
|
||||||
SDL_LockSurface (img);
|
SDL_LockSurface (img);
|
||||||
|
|
||||||
putpix = putpixel_for (img);
|
putpix = putpixel_for (img);
|
||||||
@@ -192,9 +192,9 @@ void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int
|
|||||||
TFB_Image *tfbImg;
|
TFB_Image *tfbImg;
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
|
|
||||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
tfbImg = FramePtr->image;
|
||||||
LockMutex (tfbImg->mutex);
|
LockMutex (tfbImg->mutex);
|
||||||
img = tfbImg->NormalImg;
|
img = (SDL_Surface *)tfbImg->NormalImg;
|
||||||
SDL_LockSurface (img);
|
SDL_LockSurface (img);
|
||||||
if (x0 == 0 && y0 == 0 && x == 0 && y == 0)
|
if (x0 == 0 && y0 == 0 && x == 0 && y == 0)
|
||||||
SDL_FillRect(img, NULL, color);
|
SDL_FillRect(img, NULL, color);
|
||||||
@@ -216,12 +216,12 @@ void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *r
|
|||||||
TFB_Image *srcImg, *dstImg;
|
TFB_Image *srcImg, *dstImg;
|
||||||
SDL_Surface *src, *dst;
|
SDL_Surface *src, *dst;
|
||||||
SDL_Rect srcRect, dstRect, *srp = NULL, *drp = NULL;
|
SDL_Rect srcRect, dstRect, *srp = NULL, *drp = NULL;
|
||||||
srcImg = (TFB_Image *)((BYTE *)(srcFrame) + srcFrame->DataOffs);
|
srcImg = srcFrame->image;
|
||||||
dstImg = (TFB_Image *)((BYTE *)(dstFrame) + dstFrame->DataOffs);
|
dstImg = dstFrame->image;
|
||||||
LockMutex (srcImg->mutex);
|
LockMutex (srcImg->mutex);
|
||||||
LockMutex (dstImg->mutex);
|
LockMutex (dstImg->mutex);
|
||||||
src = srcImg->NormalImg;
|
src = (SDL_Surface *)srcImg->NormalImg;
|
||||||
dst = dstImg->NormalImg;
|
dst = (SDL_Surface *)dstImg->NormalImg;
|
||||||
if (rdst)
|
if (rdst)
|
||||||
{
|
{
|
||||||
dstRect.x = rdst->corner.x;
|
dstRect.x = rdst->corner.x;
|
||||||
@@ -275,9 +275,9 @@ Uint32 **getpixelarray(FRAMEPTR FramePtr, int width, int height)
|
|||||||
GetPixelFn getpix;
|
GetPixelFn getpix;
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
tfbImg = FramePtr->image;
|
||||||
LockMutex (tfbImg->mutex);
|
LockMutex (tfbImg->mutex);
|
||||||
img = tfbImg->NormalImg;
|
img = (SDL_Surface *)tfbImg->NormalImg;
|
||||||
SDL_LockSurface (img);
|
SDL_LockSurface (img);
|
||||||
getpix = getpixel_for (img);
|
getpix = getpixel_for (img);
|
||||||
map=(Uint32 **)HMalloc (sizeof(Uint32 *) * (height + 1));
|
map=(Uint32 **)HMalloc (sizeof(Uint32 *) * (height + 1));
|
||||||
@@ -320,12 +320,12 @@ FRAMEPTR Build_Font_Effect (FRAMEPTR FramePtr, Uint32 from, Uint32 to, BYTE type
|
|||||||
->FlagsAndIndex) >> FTYPE_SHIFT;
|
->FlagsAndIndex) >> FTYPE_SHIFT;
|
||||||
NewFrame = CaptureDrawable (
|
NewFrame = CaptureDrawable (
|
||||||
CreateDrawable (FrameType, (SIZE)width, (SIZE)height, 1));
|
CreateDrawable (FrameType, (SIZE)width, (SIZE)height, 1));
|
||||||
tfbOrigImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
tfbOrigImg = FramePtr->image;
|
||||||
OrigImg = tfbOrigImg->NormalImg;
|
OrigImg = (SDL_Surface *)tfbOrigImg->NormalImg;
|
||||||
SDL_LockSurface (OrigImg);
|
SDL_LockSurface (OrigImg);
|
||||||
|
|
||||||
tfbImg = (TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs);
|
tfbImg = NewFrame->image;
|
||||||
img = tfbImg->NormalImg;
|
img = (SDL_Surface *)tfbImg->NormalImg;
|
||||||
SDL_LockSurface (img);
|
SDL_LockSurface (img);
|
||||||
|
|
||||||
putpix = putpixel_for (img);
|
putpix = putpixel_for (img);
|
||||||
@@ -401,7 +401,7 @@ FRAMEPTR Build_Font_Effect (FRAMEPTR FramePtr, Uint32 from, Uint32 to, BYTE type
|
|||||||
// r,g,b,a values supplied
|
// r,g,b,a values supplied
|
||||||
Uint32 frame_mapRGBA (FRAMEPTR FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
Uint32 frame_mapRGBA (FRAMEPTR FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||||
{
|
{
|
||||||
SDL_Surface *img= ((TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs))->NormalImg;
|
SDL_Surface *img= (SDL_Surface *)FramePtr->image->NormalImg;
|
||||||
return (SDL_MapRGBA (img->format, r, g, b, a));
|
return (SDL_MapRGBA (img->format, r, g, b, a));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,13 +522,10 @@ _ReleaseCelData (MEM_HANDLE handle)
|
|||||||
{
|
{
|
||||||
while (--FramePtr, cel_ct--)
|
while (--FramePtr, cel_ct--)
|
||||||
{
|
{
|
||||||
if (FramePtr->DataOffs)
|
TFB_Image *img = FramePtr->image;
|
||||||
|
if (img)
|
||||||
{
|
{
|
||||||
TFB_Image *img;
|
FramePtr->image = NULL;
|
||||||
|
|
||||||
img = (TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs);
|
|
||||||
FramePtr->DataOffs = 0;
|
|
||||||
|
|
||||||
TFB_DrawScreen_DeleteImage (img);
|
TFB_DrawScreen_DeleteImage (img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -662,12 +659,10 @@ _ReleaseFontData (MEM_HANDLE handle)
|
|||||||
FramePtr = &FontPtr->CharDesc[cel_ct];
|
FramePtr = &FontPtr->CharDesc[cel_ct];
|
||||||
while (--FramePtr, cel_ct--)
|
while (--FramePtr, cel_ct--)
|
||||||
{
|
{
|
||||||
if (FramePtr->DataOffs)
|
TFB_Image *img = FramePtr->image;
|
||||||
|
if (img)
|
||||||
{
|
{
|
||||||
TFB_Image *img;
|
FramePtr->image = NULL;
|
||||||
|
|
||||||
img = (TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs);
|
|
||||||
FramePtr->DataOffs = 0;
|
|
||||||
|
|
||||||
TFB_DrawScreen_DeleteImage (img);
|
TFB_DrawScreen_DeleteImage (img);
|
||||||
}
|
}
|
||||||
@@ -712,10 +707,6 @@ _request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType,
|
|||||||
imgw = width;
|
imgw = width;
|
||||||
imgh = height;
|
imgh = height;
|
||||||
|
|
||||||
// commented out these when removing support for pre-scaling -Mika
|
|
||||||
// imgw = (flags & MAPPED_TO_DISPLAY) ? width * ScreenWidthActual / ScreenWidth : width;
|
|
||||||
// imgh = (flags & MAPPED_TO_DISPLAY) ? height * ScreenHeightActual / ScreenHeight : height;
|
|
||||||
|
|
||||||
FramePtr = &DrawablePtr->Frame[NumFrames - 1];
|
FramePtr = &DrawablePtr->Frame[NumFrames - 1];
|
||||||
while (NumFrames--)
|
while (NumFrames--)
|
||||||
{
|
{
|
||||||
@@ -724,7 +715,7 @@ _request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType,
|
|||||||
if (DrawableType == RAM_DRAWABLE
|
if (DrawableType == RAM_DRAWABLE
|
||||||
&& (Image = TFB_DrawImage_New (TFB_DrawCanvas_New_TrueColor (imgw, imgh, FALSE))))
|
&& (Image = TFB_DrawImage_New (TFB_DrawCanvas_New_TrueColor (imgw, imgh, FALSE))))
|
||||||
{
|
{
|
||||||
FramePtr->DataOffs = (BYTE *)Image - (BYTE *)FramePtr;
|
FramePtr->image = Image;
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_SET (FramePtr->TypeIndexAndFlags, DrawableType);
|
TYPE_SET (FramePtr->TypeIndexAndFlags, DrawableType);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ static UBYTE scope_data[RADAR_WIDTH];
|
|||||||
void
|
void
|
||||||
InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME_DESC *f)
|
InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME_DESC *f)
|
||||||
{
|
{
|
||||||
TFB_Image *img = (TFB_Image *)((BYTE *)f + f->DataOffs);
|
TFB_Image *img = f->image;
|
||||||
|
|
||||||
assert (((SDL_Surface *)img->NormalImg)->format->BytesPerPixel == 1);
|
assert (((SDL_Surface *)img->NormalImg)->format->BytesPerPixel == 1);
|
||||||
assert (((SDL_Surface *)img->NormalImg)->w == RADAR_WIDTH);
|
assert (((SDL_Surface *)img->NormalImg)->w == RADAR_WIDTH);
|
||||||
@@ -106,7 +106,7 @@ Oscilloscope (DWORD grab_data)
|
|||||||
SDL_UnlockSurface (scope_surf);
|
SDL_UnlockSurface (scope_surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
img = (TFB_Image *)((BYTE *)scope_frame + scope_frame->DataOffs);
|
img = scope_frame->image;
|
||||||
LockMutex (img->mutex);
|
LockMutex (img->mutex);
|
||||||
SDL_BlitSurface (scope_surf, NULL, img->NormalImg, NULL);
|
SDL_BlitSurface (scope_surf, NULL, img->NormalImg, NULL);
|
||||||
UnlockMutex (img->mutex);
|
UnlockMutex (img->mutex);
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ void scale16xRandomizeFrame (FRAMEPTR FramePtr)
|
|||||||
{
|
{
|
||||||
TFB_Image *tfbImg;
|
TFB_Image *tfbImg;
|
||||||
|
|
||||||
tfbImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
tfbImg = FramePtr->image;
|
||||||
LockMutex (tfbImg->mutex);
|
LockMutex (tfbImg->mutex);
|
||||||
tfbImg->ScaledImg = random16xZoomSurfaceRGBA (tfbImg->NormalImg);
|
tfbImg->ScaledImg = random16xZoomSurfaceRGBA (tfbImg->NormalImg);
|
||||||
tfbImg->scale = 4 << 8;
|
tfbImg->scale = 4 << 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user