[Bug 421] Implement a DIB engine
wine-bugs at winehq.org
wine-bugs at winehq.org
Wed May 26 10:17:11 CDT 2010
http://bugs.winehq.org/show_bug.cgi?id=421
--- Comment #373 from Ed Kolis <edkolis at gmail.com> 2010-05-26 10:17:09 ---
(In reply to comment #372)
> (In reply to comment #370)
> > Ok, I have take a look at your screen shots.
> > The 1pixel error must come from center/radius calculation but I simply do :
> > LONG a = (right - left) / 2.0;
> > LONG b = (bottom - top) / 2.0;
> > LONG cx = (right + left) / 2.0;
> > LONG cy = (bottom + top) / 2.0;
> >
> > So maybe, I have to use a cast somewhere because right, left, bottom and top
> > are integer...
>
> Pardon me if I'm wrong but wouldn't 2.0 be a float? That would cause two
> implicit casts which could cause the rounding issue.
Assuming type conversion and order of operations work similarly in C/C++ as it
does in C#, then if right and left are ints,
long a = (right - left) / 2.0;
would be equivalent to
long a = (long)((double)(right - left) / 2.0);
So first you subtract left from right, then cast that to a double, divide by
2.0, and finally cast THAT to a long. There would be two implicit casts
(int=>double and double=>long), but only the latter would potentially cause
rounding error.
Actually, it would not cause rounding error; it would cause truncation error,
unless your LONG type's implicit cast operator from double is set up to call a
rounding function, since IIRC the default behavior of downcasting like that is
to truncate... perhaps the issue is actually the fact that you're not calling a
rounding function?
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the wine-bugs
mailing list