Last Comment Bug 685322 - Create implicit constructors on floating-point types taking integer types
: Create implicit constructors on floating-point types taking integer types
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: mozilla11
Assigned To: Joe Drew (not getting mail)
Depends on:
Blocks: 703028
  Show dependency treegraph
Reported: 2011-09-07 14:55 PDT by Joe Drew (not getting mail)
Modified: 2012-02-01 13:59 PST (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Implicitly convert (3.23 KB, patch)
2011-09-07 14:55 PDT, Joe Drew (not getting mail)
roc: review+
Details | Diff | Review
Explicitly convert (3.35 KB, patch)
2011-10-07 22:27 PDT, Joe Drew (not getting mail)
joe: review+
Details | Diff | Review

Description Joe Drew (not getting mail) 2011-09-07 14:55:04 PDT
Created attachment 558971 [details] [diff] [review]
Implicitly convert

This patch lets us implicitly convert from an Int{Point,Size,Rect} to a {Point,Size,Rect}, which is non-lossy and therefore should be supported!

It also corrects a typo in the template parameters for IntPoint:

-struct IntPoint :
-  public BasePoint<int32_t, Point> {
-  typedef BasePoint<int32_t, Point> Super;
Comment 1 Joe Drew (not getting mail) 2011-10-07 22:27:00 PDT
Created attachment 565709 [details] [diff] [review]
Explicitly convert

Bas rightfully points out that int -> float is lossy, since float can only represent 23 bits of fraction. (int->double would be non-lossy, though.) Therefore, I'm going to commit an explicit version of this patch. Carrying over r+ since this is strictly safer.
Comment 2 Ed Morley [:emorley] 2011-11-14 19:37:33 PST

Note You need to log in before you can comment on or make changes to this bug.