Add float version of gfx::Range
Adds gfx::RangeF, the float version of gfx::Range. Range unit tests are updated to test both classes.
BUG=
R=rsesek,msw
Committed: https://crrev.com/a7d4e2d9d479247c45d419095b2437144147a2a4
Cr-Commit-Position: refs/heads/master@{#316860}
5 years, 11 months ago
(2015-01-27 00:49:50 UTC)
#2
Robert Sesek
This looks good, but it needs tests. I'm also wondering if it'd be better to ...
5 years, 11 months ago
(2015-01-27 17:51:46 UTC)
#3
This looks good, but it needs tests.
I'm also wondering if it'd be better to implement this by turning Range into
TRange<ValueType> to support both int and float, since the implementations are
largely the same.
ckocagil
Templatified and updated unit tests. PTAL.
5 years, 10 months ago
(2015-01-30 18:21:46 UTC)
#4
Templatified and updated unit tests. PTAL.
Robert Sesek
https://codereview.chromium.org/876873003/diff/40001/ui/gfx/range/range.h File ui/gfx/range/range.h (left): https://codereview.chromium.org/876873003/diff/40001/ui/gfx/range/range.h#oldcode29 ui/gfx/range/range.h:29: // A Range contains two integer values that represent ...
5 years, 10 months ago
(2015-01-30 20:47:02 UTC)
#5
+msw: very simple RTHB review. On 2015/02/03 01:14:57, Robert Sesek wrote: > But please update ...
5 years, 10 months ago
(2015-02-03 01:27:36 UTC)
#14
+msw: very simple RTHB review.
On 2015/02/03 01:14:57, Robert Sesek wrote:
> But please update the CL description to be more accurate w.r.t this change now
> does.
Done.
Dana recently removed templatization of gfx::Rect[F] (and maybe other classes?) for inlining performance and binary ...
5 years, 10 months ago
(2015-02-03 20:30:18 UTC)
#16
Dana recently removed templatization of gfx::Rect[F] (and maybe other classes?)
for inlining performance and binary sizes. So you may want to follow that
pattern instead. See
https://chromium.googlesource.com/chromium/src/+/a5cc021b6ee19af6a931db1042ec...
Also, split the gfx::Range changes out from the RenderText changes.
ckocagil
Dana: Any thoughts regarding perf of our use of templates in range.h? We're exporting classes ...
5 years, 10 months ago
(2015-02-10 12:31:06 UTC)
#17
Dana: Any thoughts regarding perf of our use of templates in range.h? We're
exporting classes (Range and RangeF) that derive from a template instantiation.
danakj
On Tue, Feb 10, 2015 at 4:31 AM, <ckocagil@chromium.org> wrote: > Dana: Any thoughts regarding ...
5 years, 10 months ago
(2015-02-10 17:44:00 UTC)
#18
On Tue, Feb 10, 2015 at 4:31 AM, <ckocagil@chromium.org> wrote:
> Dana: Any thoughts regarding perf of our use of templates in range.h? We're
> exporting classes (Range and RangeF) that derive from a template
> instantiation.
>
Im not a fan of templating int/float for geometry classes. You'd have to
measure to see if there's any perf difference, but I think not templating
those classes was a large readability improvement too.
> https://codereview.chromium.org/876873003/
>
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.
ckocagil
Done. Reverted to the non-template implementation. On 2015/02/03 20:30:18, msw wrote: > Also, split the ...
5 years, 10 months ago
(2015-02-12 16:06:46 UTC)
#19
Done. Reverted to the non-template implementation.
On 2015/02/03 20:30:18, msw wrote:
> Also, split the gfx::Range changes out from the RenderText changes.
I don't understand. Which changes?
Robert Sesek
LGTM https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_f.cc File ui/gfx/range/range_f.cc (right): https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_f.cc#newcode37 ui/gfx/range/range_f.cc:37: return !base::IsNaN(start_) && !base::IsNaN(end_); Use start() and end() ...
5 years, 10 months ago
(2015-02-12 16:52:37 UTC)
#20
https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unittest.cc File ui/gfx/range/range_unittest.cc (left): https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unittest.cc#oldcode58 ui/gfx/range/range_unittest.cc:58: EXPECT_EQ(0U, r.length()); On 2015/02/13 18:47:47, ckocagil wrote: > On ...
5 years, 10 months ago
(2015-02-13 19:29:31 UTC)
#24
https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unit...
File ui/gfx/range/range_unittest.cc (left):
https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unit...
ui/gfx/range/range_unittest.cc:58: EXPECT_EQ(0U, r.length());
On 2015/02/13 18:47:47, ckocagil wrote:
> On 2015/02/12 21:01:04, msw wrote:
> > nit: please retain the length==0, start==end, reversed==false checks. The
> > semantics of an invalid RangeF should match those of an invalid Range.
>
> start==end isn't possible since NaN isn't equal to NaN. Others done.
Does this mean you can't test against an invalid range?
gfx::RangeF my_range = gfx::RangeF::InvalidRange();
if (my_range != gfx::RangeF::InvalidRange())
printf("I assume |my_range| is valid, but it's not!!!");
I think that's a common check that this class should support.
Modify operator==() and add test cases here for == and !=.
What other semantic differences are caused by using NaN?
(please check&test Max(), Min(), and EqualsIgnoringDirection())
Did you consider using std::numeric_limits<float>::max() to parallel Range's
std::numeric_limits<size_t>::max())?
ckocagil
https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unittest.cc File ui/gfx/range/range_unittest.cc (left): https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unittest.cc#oldcode58 ui/gfx/range/range_unittest.cc:58: EXPECT_EQ(0U, r.length()); On 2015/02/13 19:29:31, msw wrote: > Did ...
5 years, 10 months ago
(2015-02-13 20:05:50 UTC)
#25
https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unit...
File ui/gfx/range/range_unittest.cc (left):
https://codereview.chromium.org/876873003/diff/180001/ui/gfx/range/range_unit...
ui/gfx/range/range_unittest.cc:58: EXPECT_EQ(0U, r.length());
On 2015/02/13 19:29:31, msw wrote:
> Did you consider using std::numeric_limits<float>::max() to parallel Range's
> std::numeric_limits<size_t>::max())?
Good call. Done.
- Restored "start==end" case
- Added GetMax(), GetMin(), operator==, EqualsIgnoringDirection() cases.
- IsValid() uses "*this != InvalidRange()"
- Removed IsValid() special cases due to NaN's incomparability.
- Updated comments
msw
Nice! lgtm
5 years, 10 months ago
(2015-02-13 20:14:13 UTC)
#26
Nice! lgtm
ckocagil
rsesek: Can you take another look please?
5 years, 10 months ago
(2015-02-18 17:08:01 UTC)
#27
rsesek: Can you take another look please?
Robert Sesek
lgtm
5 years, 10 months ago
(2015-02-18 17:21:23 UTC)
#28
lgtm
ckocagil
The CQ bit was checked by ckocagil@chromium.org
5 years, 10 months ago
(2015-02-18 17:22:02 UTC)
#29
Issue 876873003: Add float version of gfx::Range
(Closed)
Created 5 years, 11 months ago by ckocagil
Modified 5 years, 10 months ago
Reviewers: Robert Sesek, msw, danakj
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 32