Page 1 of 1
struct DrawInfo dri_Depth contains wrong value
Posted: Mon Aug 06, 2012 6:15 pm
by chris
I'm trying to find out the depth of the screen I'm running on. To do this, I've got a DrawInfo structure through GetScreenDrawInfo(), and queried the dri_Depth value.
It always returns 8 on screens with a depth >= 8.
Unless this is some sort of compatiblity kludge (in which case I'd like to know (a) why, and (b) how to find out the *actual* screen depth), there seems to be a bug in that the DrawInfo structure, dri_Depth field does not report the correct screen depth.
I've attached example code. It's easy to test by switching Workbench's screenmode and re-running the executable.
Re: struct DrawInfo dri_Depth contains wrong value
Posted: Mon Aug 06, 2012 6:28 pm
by LyleHaze
This might help, from Picasso96API.doc:
In the original graphics.library, bitmaps were always planar and
could hold up to eight bitplanes. With the Picasso96 graphics
system, there is also support for chunky, hicolor and truecolor
bitmaps.
When using Picasso96 bitmaps, never look into the BitMap structure
directly, but use the GetBitMapAttr() and p96GetBitMapAttr() query
functions. Especially the plane pointer entries are no longer valid.
Under no circumstances try to use them in any way!
Re: struct DrawInfo dri_Depth contains wrong value
Posted: Mon Aug 06, 2012 8:28 pm
by chris
LyleHaze wrote:This might help, from Picasso96API.doc:
In the original graphics.library, bitmaps were always planar and
could hold up to eight bitplanes. With the Picasso96 graphics
system, there is also support for chunky, hicolor and truecolor
bitmaps.
When using Picasso96 bitmaps, never look into the BitMap structure
directly, but use the GetBitMapAttr() and p96GetBitMapAttr() query
functions. Especially the plane pointer entries are no longer valid.
Under no circumstances try to use them in any way!
Hmm, I'm not touching the BitMap structure, but I suppose I could.
I've changed it to:
Code: Select all
depth = GetBitMapAttr(screen->RastPort.BitMap, BMA_DEPTH);
And this returns the correct thing (except it sees a 32-bit screenmode as having a 24-bit BitMap).
That's solved my problem, anyway. Thanks.
Re: struct DrawInfo dri_Depth contains wrong value
Posted: Tue Aug 07, 2012 9:13 am
by salass00
And this returns the correct thing (except it sees a 32-bit screenmode as having a 24-bit BitMap).
Which it is, 24 bits of RGB data + 8 bits of padding.
If you need more detailed information about which RGB format is used you need to use p96GetBitMapAttr() (use it with P96BMA_ISP96 first to make sure it's a P96 bitmap). P96BMA_BITSPERPIXEL should return 32 for your 32-bit bitmap while P96BMA_DEPTH will return the actual depth of the bitmap same as BMA_DEPTH.