Canvas::DrawSolidFocusRect seems wrong (random +1 on one edge) |
||
Issue descriptionI was just looking at the code for Canvas::DrawSolidFocusRect and found this weird logic for drawing a rectangle: (x1, x2, y1, y2 are the left, right, top and bottom edges of the rectangle, respectively.) DrawLine(Point(x1, y1), Point(x2, y1), paint); DrawLine(Point(x1, y2), Point(x2, y2), paint); DrawLine(Point(x1, y1), Point(x1, y2), paint); DrawLine(Point(x2, y1), Point(x2, y2 + 1), paint); On that last line, why is it "y2 + 1". This would imply the right edge is going to extend 1px downwards past the bottom. Maybe there is a good reason for this (a hack around some drawing anomaly), but I couldn't find an explanation in the code, the CL that added it, or the bug. It should be documented or fixed. skuhne, you added this code in https://codereview.chromium.org/78803002. Can you please explain it?
,
May 12 2016
Yeah it was 2.5 years ago and was to get around bugs in hidpi displays. So maybe you did need to overshoot the corner in order to draw a pixel there. But wouldn't the same be true of the top-right and bottom-left corners? Anyway, I stepped into the code and I don't see anything to indicate that DrawLine *doesn't* draw the last point (that would be really broken if that's the case). So I think this +1 is incorrect but I'll dig into it.
,
May 12 2016
Well - back then the last pixel was not drawn. If it is now, you might shorten all lines by one pixel now.
,
Aug 14
Archiving old bugs that haven't been modified in over two years. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks! |
||
►
Sign in to add a comment |
||
Comment 1 by skuhne@chromium.org
, May 12 2016Owner: mgiuca@chromium.org