This is mostly because I am curious, but is there any particular reason video::IImage::getDimension returns core::dimension2d<s32> instead of core::dimension2d<u32>? It seems uneccesary to use signed values since the image can't have a negitive size. (Also, considering video::IImage::getPixel uses u32 for its x & y arguments.)
Maybe I'm wrong, but wouldn't this break support for images larger than 2,147,483,647 * 2,147,483,647 pixels? Of course, nobody would ever use that size (That's about a 1844 TB RAW ARGB image if I did my math right XD)
~DtD
PS> Remember, this is just curiosity
video::IImage::getDimention returns signed dimension2d...why
So who cares?
If we ever come near to this 1844 TB it is just a small change. But until then (I guess at least 10 years) this is no problem.
If it would be u32 one could ask why it isn't u64 because u32 only allows 4,300,000,000 * 4,300,000,000 pixels...
If we ever come near to this 1844 TB it is just a small change. But until then (I guess at least 10 years) this is no problem.
If it would be u32 one could ask why it isn't u64 because u32 only allows 4,300,000,000 * 4,300,000,000 pixels...
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
It is an excellent point. A variable type does not only contain what it can and cannot do, it also contains information about how it SHOULD be used, what SHOULD be expected. There is no gain for the s32 but a small gain for the u32 (clarity) thus I think it should be changed. While minor, I see this as a valid concern. Maybe add it to the tracker since you're the one who found it? Getting the credit and all
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I will killlllllllllllllll you.
I mean: *Wow, thanks!* Once I got to thinking about it, there are relatively few cases where a negative dimension actually makes much sense.
I'm working on this now. For those who want to follow along, I started by adding dimension2du and then did a global find/replace on dimension2di / dimension2d<s32>, then restored s32 as necessary.
There are still some signed dimensions used in GUI sizes, and in 2D clip methods, that require some (explicit) casting of dimension2du to dimension2di. We'll have to have a think about whether those can be unsigned as well.
I'm now looking into some issues in the GUI. Actually, now I'm going to the bathroom, then I'll get a can of Irn Bru on the way back. Can I get you anything while I'm up?
I mean: *Wow, thanks!* Once I got to thinking about it, there are relatively few cases where a negative dimension actually makes much sense.
I'm working on this now. For those who want to follow along, I started by adding dimension2du and then did a global find/replace on dimension2di / dimension2d<s32>, then restored s32 as necessary.
There are still some signed dimensions used in GUI sizes, and in 2D clip methods, that require some (explicit) casting of dimension2du to dimension2di. We'll have to have a think about whether those can be unsigned as well.
I'm now looking into some issues in the GUI. Actually, now I'm going to the bathroom, then I'll get a can of Irn Bru on the way back. Can I get you anything while I'm up?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
OK, I've done a first tranche on the trunk in SVN 2092.
There's been considerable knock-on effects through the code base. We should consider this to be Work In Progress; in fact, we may even end up reverting some of it.
Please do sing out if this creates any problems.
There's been considerable knock-on effects through the code base. We should consider this to be Work In Progress; in fact, we may even end up reverting some of it.
Please do sing out if this creates any problems.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way