Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Issue 7066010: Fixes rounding bug in transform. This is needed to avoid rounding (Closed)

Created:
9 years, 7 months ago by sky
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Paweł Hajdan Jr.
Visibility:
Public.

Description

Fixes rounding bug in transform. This is needed to avoid rounding something like -.9998 to 0 instead of -1. Without this a transformed views bounds would end up with an extra scale-1 pixels on the left edge. BUG=none TEST=covered by unit test R=ben@chromium.org,wjmaclean@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=86430

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -2 lines) Patch
M ui/gfx/transform.cc View 3 chunks +6 lines, -2 lines 2 comments Download
M views/view_unittest.cc View 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
sky
9 years, 7 months ago (2011-05-23 21:48:44 UTC) #1
wjmaclean
http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc File ui/gfx/transform.cc (right): http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc#newcode77 ui/gfx/transform.cc:77: static_cast<int>(std::floor(skp.fY))); Just curious ... for positive values, wouldn't this ...
9 years, 7 months ago (2011-05-24 12:11:40 UTC) #2
sky
http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc File ui/gfx/transform.cc (right): http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc#newcode77 ui/gfx/transform.cc:77: static_cast<int>(std::floor(skp.fY))); On 2011/05/24 12:11:40, wjmaclean wrote: > Just curious ...
9 years, 7 months ago (2011-05-24 15:51:48 UTC) #3
wjmaclean
Thanks, I didn't understand how it was being used. LGTM! On 2011/05/24 15:51:48, sky wrote: ...
9 years, 7 months ago (2011-05-24 15:58:29 UTC) #4
sadrul
On 2011/05/24 15:51:48, sky wrote: > http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc > File ui/gfx/transform.cc (right): > > http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc#newcode77 > ...
9 years, 7 months ago (2011-05-24 15:59:59 UTC) #5
sky
On Tue, May 24, 2011 at 9:00 AM, <sadrul@chromium.org> wrote: > On 2011/05/24 15:51:48, sky ...
9 years, 7 months ago (2011-05-24 16:07:46 UTC) #6
Ben Goodger (Google)
9 years, 7 months ago (2011-05-24 19:23:11 UTC) #7
LGTM also

On Tue, May 24, 2011 at 9:07 AM, Scott Violet <sky@chromium.org> wrote:

> On Tue, May 24, 2011 at 9:00 AM,  <sadrul@chromium.org> wrote:
> > On 2011/05/24 15:51:48, sky wrote:
> >>
> >> http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc
> >> File ui/gfx/transform.cc (right):
> >
> >>
> >>
> http://codereview.chromium.org/7066010/diff/1/ui/gfx/transform.cc#newcode77
> >> ui/gfx/transform.cc:77: static_cast<int>(std::floor(skp.fY)));
> >> On 2011/05/24 12:11:40, wjmaclean wrote:
> >> > Just curious ... for positive values, wouldn't this run the danger of
> >> converting
> >> > 0.998 to 0 instead of 1? Do we want rounding or floor/ceil here?
> >
> >> I'm sure we'll have rounding problems until we use doubles every where.
> >
> > I had a TODO to have gfx::Point etc. use float's instead of int's. Does
> it
> > make
> > sense to make that change now?
>
> We would have to convert to ints at some point anyway, so I think how
> we round would will always be an issue.
>
>  -Scott
>

Powered by Google App Engine
This is Rietveld 408576698