New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 5 users
Status: Accepted
Last visit 16 days ago
Area: API
Priority: Low
Type: Feature

Sign in to add a comment
Add int <-> SkMScalar conversion routines
Reported by, Oct 20 2014 Back to list
There are a variety of routines to convert SkMScalars to/from SkScalar, float, and double, but none to convert to/from int.  At least a few places in Chromium could use such conversion routines; for now they chain together multiple conversion operators, or in many cases just don't explicitly convert at all since such code will often compile without warnings on our current compilers.
Project Member Comment 1 by, Oct 21 2014
Project Member Comment 2 by, Oct 21 2014
We have 6 variants today for SkScalar [floor, round, ceil] -> [scalar, int]
(7 if you count trunc)

Do you know which of these would be used by Chrome?
In the code review where these issues came up, the desired path was int -> SkMScalar.  This popped up because I'm trying to re-enable MSVC warnings about potential value truncation, and an implicit conversion of int -> float causes a warning for that case, so I needed to fix code that was doing this conversion implicitly to be explicit.  Right now the shortest technically-correct way to do that is

Project Member Comment 4 by, Oct 22 2014
Commit seems to be related to this.

It could have had a BUG=skia:3045 so it gets through here.
Project Member Comment 5 by, Oct 22 2014
Labels: Area-API
Project Member Comment 6 by, Oct 23 2014
Status: Accepted
Project Member Comment 7 by, Dec 7 2015
Labels: Hotlist-Fixit
Sign in to add a comment