|
|
Chromium Code Reviews|
Created:
3 years, 10 months ago by Evan Stade Modified:
3 years, 10 months ago CC:
chromium-reviews, tfarina Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionImprove appearance of FocusableBorder at fractional scale factors by
sharing more code with MD/harmony version of FocusableBorder.
BUG=691816
Review-Url: https://codereview.chromium.org/2693943003
Cr-Commit-Position: refs/heads/master@{#450583}
Committed: https://chromium.googlesource.com/chromium/src/+/a137561d0d58aa4003e3aa97acfaf749c0b62196
Patch Set 1 #
Total comments: 3
Patch Set 2 : flooredint #Messages
Total messages: 21 (10 generated)
estade@chromium.org changed reviewers: + pkasting@chromium.org
https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... File ui/views/controls/focusable_border.cc (right): https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... ui/views/controls/focusable_border.cc:50: ui::MaterialDesignController::IsSecondaryUiMaterial() ? 1 : dsf; It seems like the old pre-Harmony code was trying to draw a 2 DIP border, and the new code draws something like a 1 DIP border. Don't we want a 2* in here? I also wonder if this shouldn't be gfx::ToRoundedInt(). It looks like you're truncating-to-int, which seems a bit surprising. If that's really what we want, we probably want an explicit ToFlooredInt() + a comment about why flooring is correct.
https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... File ui/views/controls/focusable_border.cc (right): https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... ui/views/controls/focusable_border.cc:50: ui::MaterialDesignController::IsSecondaryUiMaterial() ? 1 : dsf; On 2017/02/14 00:30:32, Peter Kasting wrote: > It seems like the old pre-Harmony code was trying to draw a 2 DIP border, and > the new code draws something like a 1 DIP border. Don't we want a 2* in here? That was just a hacky way to get a 1dip border. 1dip was inside the rect, 1 outside (and therefore outside the view, i.e. not visible). Instead, we use the correct stroke width and inset the bounds by half the stroke. > > I also wonder if this shouldn't be gfx::ToRoundedInt(). It looks like you're > truncating-to-int, which seems a bit surprising. If that's really what we want, > we probably want an explicit ToFlooredInt() + a comment about why flooring is > correct. I've been assuming flooring is correct for dip-sized strokes, but I'll ping Sebastien.
https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... File ui/views/controls/focusable_border.cc (right): https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... ui/views/controls/focusable_border.cc:50: ui::MaterialDesignController::IsSecondaryUiMaterial() ? 1 : dsf; On 2017/02/14 00:37:47, Evan Stade wrote: > On 2017/02/14 00:30:32, Peter Kasting wrote: > > It seems like the old pre-Harmony code was trying to draw a 2 DIP border, and > > the new code draws something like a 1 DIP border. Don't we want a 2* in here? > > That was just a hacky way to get a 1dip border. 1dip was inside the rect, 1 > outside (and therefore outside the view, i.e. not visible). Instead, we use the > correct stroke width and inset the bounds by half the stroke. I see. Why was the old code producing poorer-looking output than the new code? Was it because we were drawing the path without AA but not rounding or flooring the path width, so on some edges the fractional pixel would result in filling the whole next pixel, and in some it wouldn't? In which case, the reason this is better is basically because of the use of "int" in this line.
On 2017/02/14 00:45:59, Peter Kasting wrote: > https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... > File ui/views/controls/focusable_border.cc (right): > > https://codereview.chromium.org/2693943003/diff/1/ui/views/controls/focusable... > ui/views/controls/focusable_border.cc:50: > ui::MaterialDesignController::IsSecondaryUiMaterial() ? 1 : dsf; > On 2017/02/14 00:37:47, Evan Stade wrote: > > On 2017/02/14 00:30:32, Peter Kasting wrote: > > > It seems like the old pre-Harmony code was trying to draw a 2 DIP border, > and > > > the new code draws something like a 1 DIP border. Don't we want a 2* in > here? > > > > That was just a hacky way to get a 1dip border. 1dip was inside the rect, 1 > > outside (and therefore outside the view, i.e. not visible). Instead, we use > the > > correct stroke width and inset the bounds by half the stroke. > > I see. > > Why was the old code producing poorer-looking output than the new code? Was it > because we were drawing the path without AA but not rounding or flooring the > path width, so on some edges the fractional pixel would result in filling the > whole next pixel, and in some it wouldn't? In which case, the reason this is > better is basically because of the use of "int" in this line. precisely. This technique was already applied in MD but I guess I didn't want to risk touching non-MD at the time. Sebastien thinks that we should round down (i.e. floor) on dip-defined strokes. I can apply the explicit flooring function you mentioned.
The CQ bit was checked by estade@chromium.org to run a CQ dry run
Description was changed from ========== Improve appearance of FocusableBorder at fractional scale factors by sharing more code with MD/harmony version of FocusableBorder. BUG=691816 ========== to ========== Improve appearance of FocusableBorder at fractional scale factors by sharing more code with MD/harmony version of FocusableBorder. BUG=691816 ==========
estade@chromium.org changed reviewers: + sky@chromium.org
added gfx::ToFlooredInt, +sky for OWNERS
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
LGTM
LGTM
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by estade@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 20001, "attempt_start_ts": 1487121842573740,
"parent_rev": "ab1a9331a441fa315edb669486ac1964788e47c7", "commit_rev":
"a137561d0d58aa4003e3aa97acfaf749c0b62196"}
Message was sent while issue was closed.
Description was changed from ========== Improve appearance of FocusableBorder at fractional scale factors by sharing more code with MD/harmony version of FocusableBorder. BUG=691816 ========== to ========== Improve appearance of FocusableBorder at fractional scale factors by sharing more code with MD/harmony version of FocusableBorder. BUG=691816 Review-Url: https://codereview.chromium.org/2693943003 Cr-Commit-Position: refs/heads/master@{#450583} Committed: https://chromium.googlesource.com/chromium/src/+/a137561d0d58aa4003e3aa97acfa... ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as https://chromium.googlesource.com/chromium/src/+/a137561d0d58aa4003e3aa97acfa... |
