Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ Version 1.08.0
- optimize byref 'm += s' string concatenations to fb_StrConcatByref() which will check for same string descriptor at run-time which can't be determined at compile time for byref parameters.
- github #298: allow command line options passed to as, gcc, ld to be longer than 128 characters by using string types internally
- sf.net #923: implicitly emit the deleting destructor for extern "c++" mangling for better g++ ABI compatibility
- Add new gfxlib2 API's fb_GfxScreenInfo32() and fb_GfxScreenInfo64()
- Change overload to SCREENINFO( byref as long = 0, byref as long = 0, byref as long = 0, byref as long = 0, byref as long = 0, byref as long = 0, byref as string = "" )
- Add overload for SCREENINFO( byref as longint, byref as longint, byref as longint = 0, byref as longint = 0, byref as longint = 0, byref as longint = 0, byref as string = "" )
- Add new gflib2 API's fb_GfxImageInfo32() and fb_GfxImageInfo64()
- Change overload to IMAGEINFO( byval as const any ptr, byref as long = 0, byref as long = 0, byref as long = 0, byref as long = 0, byref as any ptr = 0, byref as longint = 0 ) as long
- Add overload for IMAGEINFO( byval as const any ptr, byref as longint, byref as longint, byref as longint = 0, byref as longint = 0, byref as any ptr = 0, byref as longint = 0 ) as long
- Add new gfxlib2 API's fb_GfxControl_i32() and fb_GfxControl_i64()
- Change overload for SCREENCONTROL( byval as const long, byref as long = -2147483648, byref as long = -2147483648, byref as long = -2147483648, byref as long = -2147483648 )
- Add overload for SCREENCONTROL( byval as const long, byref as longint, byref as longint = -2147483648, byref as longint = -2147483648, byref as longint = -2147483648 )

[added]
- extern "rtlib": respects the parent namespace, uses default fb calling convention and C style name mangling
Expand Down
145 changes: 108 additions & 37 deletions src/compiler/rtl-gfx.bas
Original file line number Diff line number Diff line change
Expand Up @@ -830,28 +830,53 @@ declare function hPorts_cb _
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ) _
} _
), _
/' sub screeninfo _
/' sub screeninfo overload _
( _
byref width as integer = 0, _
byref height as integer = 0, _
byref depth as integer = 0, _
byref bpp as integer = 0, _
byref pitch as integer = 0, _
byref refresh_rate as integer = 0, _
byref width as long = 0, _
byref height as long = 0, _
byref depth as long = 0, _
byref bpp as long = 0, _
byref pitch as long = 0, _
byref refresh_rate as long = 0, _
byref driver as string = byval NULL _
) '/ _
( _
@"screeninfo", @"fb_GfxScreenInfo", _
@"screeninfo", @"fb_GfxScreenInfo32", _
FB_DATATYPE_VOID, FB_FUNCMODE_FBCALL, _
@hGfxlib_cb, FB_RTL_OPT_NOQB, _
@hGfxlib_cb, FB_RTL_OPT_OVER or FB_RTL_OPT_NOQB, _
7, _
{ _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, TRUE, NULL ) _
} _
), _
/' sub screeninfo overload _
( _
byref width as longint, _
byref height as longint, _
byref depth as longint = 0, _
byref bpp as longint = 0, _
byref pitch as longint = 0, _
byref refresh_rate as longint = 0, _
byref driver as string = byval NULL _
) '/ _
( _
@"screeninfo", @"fb_GfxScreenInfo64", _
FB_DATATYPE_VOID, FB_FUNCMODE_FBCALL, _
@hGfxlib_cb, FB_RTL_OPT_OVER or FB_RTL_OPT_NOQB, _
7, _
{ _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, FALSE ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, FALSE ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, TRUE, NULL ) _
} _
), _
Expand Down Expand Up @@ -917,29 +942,54 @@ declare function hPorts_cb _
( typeAddrOf( typeSetIsConst( FB_DATATYPE_VOID ) ), FB_PARAMMODE_BYVAL, FALSE ) _
} _
), _
/' function imageinfo _
/' function imageinfo overload _
( _
byval img as const any ptr, _
byref width as integer = 0, _
byref height as integer = 0, _
byref bpp as integer = 0, _
byref pitch as integer = 0, _
byref width as long = 0, _
byref height as long = 0, _
byref bpp as long = 0, _
byref pitch as long = 0, _
byref imgdata as any ptr = 0, _
byref size as integer = 0 _
byref size as long = 0 _
) as long '/ _
( _
@"imageinfo", @"fb_GfxImageInfo", _
@"imageinfo", @"fb_GfxImageInfo32", _
FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
@hGfxlib_cb, FB_RTL_OPT_NOQB, _
@hGfxlib_cb, FB_RTL_OPT_OVER or FB_RTL_OPT_NOQB, _
7, _
{ _
( typeAddrOf( typeSetIsConst( FB_DATATYPE_VOID ) ), FB_PARAMMODE_BYVAL, FALSE ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, 0 ) _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, 0 ) _
} _
), _
/' function imageinfo overload _
( _
byval img as const any ptr, _
byref width as longint, _
byref height as longint, _
byref bpp as longint = 0, _
byref pitch as longint = 0, _
byref imgdata as any ptr = 0, _
byref size as longint = 0 _
) as long '/ _
( _
@"imageinfo", @"fb_GfxImageInfo64", _
FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
@hGfxlib_cb, FB_RTL_OPT_OVER or FB_RTL_OPT_NOQB, _
7, _
{ _
( typeAddrOf( typeSetIsConst( FB_DATATYPE_VOID ) ), FB_PARAMMODE_BYVAL, FALSE ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, FALSE ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, FALSE ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ), _
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYREF, TRUE, 0 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, 0 ) _
} _
), _
/' sub imageconvertrow _
Expand Down Expand Up @@ -993,22 +1043,43 @@ declare function hPorts_cb _
/' sub screencontrol overload _
( _
byval what as const long, _
byref param1 as integer = &h80000000, _
byref param2 as integer = &h80000000, _
byref param3 as integer = &h80000000, _
byref param4 as integer = &h80000000 _
byref param1 as long = &h80000000, _
byref param2 as long = &h80000000, _
byref param3 as long = &h80000000, _
byref param4 as long = &h80000000 _
) '/ _
( _
@"screencontrol", @"fb_GfxControl_i32", _
FB_DATATYPE_VOID, FB_FUNCMODE_FBCALL, _
@hGfxlib_cb, FB_RTL_OPT_OVER or FB_RTL_OPT_NOQB, _
5, _
{ _
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, TRUE, &h80000000 ) _
} _
), _
/' sub screencontrol overload _
( _
byval what as const long, _
byref param1 as longint, _
byref param2 as longint = &h80000000, _
byref param3 as longint = &h80000000, _
byref param4 as longint = &h80000000 _
) '/ _
( _
@"screencontrol", @"fb_GfxControl_i", _
@"screencontrol", @"fb_GfxControl_i64", _
FB_DATATYPE_VOID, FB_FUNCMODE_FBCALL, _
@hGfxlib_cb, FB_RTL_OPT_OVER or FB_RTL_OPT_NOQB, _
5, _
{ _
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYREF, TRUE, &h80000000 ) _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, FALSE ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, &h80000000 ), _
( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, TRUE, &h80000000 ) _
} _
), _
/' function screenglproc( byval proc as const zstring ptr ) as any ptr '/ _
Expand Down
6 changes: 6 additions & 0 deletions src/gfxlib2/fb_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,15 @@ extern FBCALL int fb_GfxScreen(int mode, int depth, int num_pages, int flags, in
extern FBCALL int fb_GfxScreenQB(int mode, int visible, int active);
extern FBCALL int fb_GfxScreenRes(int width, int height, int depth, int num_pages, int flags, int refresh_rate);
extern FBCALL void fb_GfxScreenInfo(ssize_t *width, ssize_t *height, ssize_t *depth, ssize_t *bpp, ssize_t *pitch, ssize_t *refresh_rate, FBSTRING *driver);
extern FBCALL void fb_GfxScreenInfo32(int *width, int *height, int *depth, int *bpp, int *pitch, int *refresh_rate, FBSTRING *driver);
extern FBCALL void fb_GfxScreenInfo64(long long *width, long long *height, long long *depth, long long *bpp, long long *pitch, long long *refresh_rate, FBSTRING *driver);
extern FBCALL int fb_GfxScreenList(int depth);
extern FBCALL void *fb_GfxImageCreate(int width, int height, unsigned int color, int depth, int flags);
extern FBCALL void *fb_GfxImageCreateQB(int width, int height, unsigned int color, int depth, int flags);
extern FBCALL void fb_GfxImageDestroy(void *image);
extern FBCALL int fb_GfxImageInfo(void *img, ssize_t *width, ssize_t *height, ssize_t *bpp, ssize_t *pitch, void **imgdata, ssize_t *size);
extern FBCALL int fb_GfxImageInfo32(void *img, int *width, int *height, int *bpp, int *pitch, void **imgdata, int *size);
extern FBCALL int fb_GfxImageInfo64(void *img, long long *width, long long *height, long long *bpp, long long *pitch, void **imgdata, long long *size);
extern FBCALL void fb_GfxPalette(int index, int r, int g, int b);
extern FBCALL void fb_GfxPaletteUsing(int *data);
extern FBCALL void fb_GfxPaletteUsing64(long long *data);
Expand Down Expand Up @@ -470,6 +474,8 @@ extern FBCALL int fb_GfxGetJoystick(int id, ssize_t *buttons, float *a1, float *
extern FBCALL int fb_GfxEvent(EVENT *event);
extern FBCALL void fb_GfxControl_s(int what, FBSTRING *param);
extern FBCALL void fb_GfxControl_i(int what, ssize_t *param1, ssize_t *param2, ssize_t *param3, ssize_t *param4);
extern FBCALL void fb_GfxControl_i32(int what, int *param1, int *param2, int *param3, int *param4);
extern FBCALL void fb_GfxControl_i64(int what, long long *param1, long long *param2, long long *param3, long long *param4);
extern FBCALL int fb_GfxBload(FBSTRING *filename, void *dest, void *pal);
extern FBCALL int fb_GfxBloadQB(FBSTRING *filename, void *dest, void *pal);
extern FBCALL int fb_GfxBsave(FBSTRING *filename, void *src, unsigned int size, void *pal);
Expand Down
20 changes: 20 additions & 0 deletions src/gfxlib2/gfx_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,23 @@ FBCALL void fb_GfxControl_i( int what, ssize_t *param1, ssize_t *param2, ssize_t
*param4 = res4;
}
}

FBCALL void fb_GfxControl_i32( int what, int *param1, int *param2, int *param3, int *param4 )
{
ssize_t p1, p2, p3, p4;
fb_GfxControl_i( what, &p1, &p2, &p3, &p4 );
*param1 = (int)p1;
*param2 = (int)p2;
*param3 = (int)p3;
*param4 = (int)p4;
}

FBCALL void fb_GfxControl_i64( int what, long long *param1, long long *param2, long long *param3, long long *param4 )
{
ssize_t p1, p2, p3, p4;
fb_GfxControl_i( what, &p1, &p2, &p3, &p4 );
*param1 = (long long)p1;
*param2 = (long long)p2;
*param3 = (long long)p3;
*param4 = (long long)p4;
}
42 changes: 42 additions & 0 deletions src/gfxlib2/gfx_image_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,45 @@ FBCALL int fb_GfxImageInfo

return fb_ErrorSetNum( FB_RTERROR_OK );
}

FBCALL int fb_GfxImageInfo32
(
void *img,
int *width,
int *height,
int *bpp,
int *pitch,
void **imgdata,
int *size
)
{
ssize_t w, h, b, p, s;
int ret = fb_GfxImageInfo( img, &w, &h, &b, &p, imgdata, &s );
*width = (int)w;
*height = (int)h;
*bpp = (int)b;
*pitch = (int)p;
*size = (int)s;
return ret;
}

FBCALL int fb_GfxImageInfo64
(
void *img,
long long *width,
long long *height,
long long *bpp,
long long *pitch,
void **imgdata,
long long *size
)
{
ssize_t w, h, b, p, s;
int ret = fb_GfxImageInfo( img, &w, &h, &b, &p, imgdata, &s );
*width = (long long)w;
*height = (long long)h;
*bpp = (long long)b;
*pitch = (long long)p;
*size = (long long)s;
return ret;
}
42 changes: 42 additions & 0 deletions src/gfxlib2/gfx_screeninfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,45 @@ FBCALL void fb_GfxScreenInfo

FB_GRAPHICS_UNLOCK( );
}

FBCALL void fb_GfxScreenInfo32
(
int *width,
int *height,
int *depth,
int *bpp,
int *pitch,
int *refresh,
FBSTRING *driver
)
{
ssize_t w, h, d, b, p, r;
fb_GfxScreenInfo( &w, &h, &d, &b, &p, &r, driver );
*width = (int)w;
*height = (int)h;
*depth = (int)d;
*bpp = (int)b;
*pitch = (int)p;
*refresh = (int)r;
}

FBCALL void fb_GfxScreenInfo64
(
long long *width,
long long *height,
long long *depth,
long long *bpp,
long long *pitch,
long long *refresh,
FBSTRING *driver
)
{
ssize_t w, h, d, b, p, r;
fb_GfxScreenInfo( &w, &h, &d, &b, &p, &r, driver );
*width = (long long)w;
*height = (long long)h;
*depth = (long long)d;
*bpp = (long long)b;
*pitch = (long long)p;
*refresh = (long long)r;
}
Loading