Skip to content

Conversation

@jayrm
Copy link
Member

@jayrm jayrm commented May 1, 2021

This change revisits 2 previous bug reports and proposes solving the overload ambiguity by requiring that certain LONGINT parameters must be given:

Most of the underlying data types for image and screen data are of the fb LONG type (32 bits). And over time since the fbc upgrades to 64-bit support the tendency for image size & colour information has tended towards using the LONG types.

However, because the datatypes are passed BYREF, passing 32-bit and 64-bit data types is not interchangeable and requires an overloaded function if both are to be permitted.

This change proposes the following:
For 64-bit data types

  • SCREENINFO must specify first 2 LONGINT parameters
  • IMAGEINFO must specify first 2 LONGINT parameters
  • SCREENCONTROL must specify first LONGINT parameter
    For 32-bit data types:
  • SCREENINFO, SCREENCONTROL, IMAGEINFO parameters are optional as per current documentation and will unambiguously resolve LONG/INTEGER on 32-bit and LONG on 64-bit

LONG and LONGINT types can not be mixed as there is only 2 versions of the overloads.

In the case where SCREENCONTROL returns a pointer, a pointer sized data type will unambiguously resolve to the 32-bit or 64-bit API's.

Details of the API change:

  • 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 )

- 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 )
@jayrm jayrm merged commit 77d9a04 into freebasic:master May 16, 2021
@jayrm jayrm deleted the gfx-info-long branch May 17, 2021 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant