toolkit: a bar is not a dot, and DrawIconDot cannot draw one - #441
Merged
Conversation
DrawIconDot insets its box by at least two pixels on every side. That is right for a dot -- it keeps it off whatever it sits on -- and fatal for a bar: a four-pixel-tall box comes back EMPTY, silently, because the inset ate it. It cost a menu-bar icon that drew nothing where a light was meant to be, and looked like a colour problem for ten minutes. DrawIconBar fills the rectangle AS GIVEN, ends rounded to half the shorter side. A caller asking for a bar has already chosen its thickness, and taking two pixels off each side of that is taking away the decision. The test asserts the thickness that comes back is the thickness that was asked for, at two, three, four and eight pixels -- and then draws the same box through DrawIconDot and requires it to draw NOTHING, so the reason this exists cannot quietly stop being true.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DrawIconDotinsets its box by at least two pixels on every side. That is right for a dot — it keeps it off whatever it sits on — and fatal for a bar: a four-pixel-tall box comes back empty, silently, because the inset ate it.It cost a menu-bar icon that drew nothing where a light was meant to be, and looked like a colour problem for ten minutes.
DrawIconBarfills the rectangle as given, with ends rounded to half the shorter side. A caller asking for a bar has already chosen its thickness, and taking two pixels off each side of that is taking away the decision.The test asserts the thickness that comes back is the thickness that was asked for — at two, three, four and eight pixels — and then draws the same box through
DrawIconDotand requires it to draw nothing, so the reason this exists cannot quietly stop being true. Corners of the bounding box are checked empty: a lit line, not a filled box.Coverage stays at 100.0%.