toolkit: a dot that says live - #435
Merged
Merged
Conversation
A status light is the smallest thing a picture can say -- "this is on", "this is recording", "this is connected" -- and every caller that wanted one so far had to reach past the toolkit and call the painter itself. That is exactly what the desk's own barrier test refuses, and rightly: the rule is that a capability the toolkit lacks gets ADDED to the toolkit, not hand-drawn at the call site. DrawIconDot fills the rectangle it is given, less the inset every icon here already leaves, with a round rectangle whose radius is half its shorter side -- which IS a disc, drawn with the same antialiasing as the rest of the package. Nothing rasterises a circle by hand. The test judges roundness by the CORNERS: a square inks all four, a disc none. Area does not say it as plainly -- an anti-aliased disc touches about 85% of its bounding box where the disc itself is pi/4 of it -- and a filled rectangle of the same size is drawn alongside as a negative control, so a DrawIconDot that quietly lost its radius fails rather than passes. Below ten pixels the corner check is skipped and said to be skipped: a disc four pixels across touches all sixteen of them, corners included, so nothing there separates it from a square.
The radius follows the SHORTER side, and no test passed a box where the two differ -- so the line that picks it was never taken. A wide box and a tall one, each asserted to give a dot the same way round as its box.
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.
A status light is the smallest thing a picture can say — "this is on", "this is recording", "this is connected". Every caller that wanted one had to reach past the toolkit and call the painter directly, which is precisely what a consumer's barrier test refuses: a capability the toolkit lacks gets added to the toolkit, not hand-drawn at the call site.
DrawIconDot(p, r, ink)fills the rectangle it is given, less the inset every icon here already leaves, with a round rectangle whose radius is half its shorter side — which is a disc, drawn with the same antialiasing as the rest of the package. Nothing rasterises a circle by hand. Round in a square box, an ellipse in any other: a caller asking for a wide box means a wide dot.How it is tested. Roundness is judged by the corners: a square inks all four, a disc none. Area does not say it as plainly — an anti-aliased disc touches about 85% of its bounding box where the disc itself is π/4 of it, about 79% — so the corner is the crisp statement. A filled rectangle of the same size is drawn alongside as a negative control, so a
DrawIconDotthat quietly lost its radius fails rather than passes. Below ten pixels the check is skipped, and the comment says why: a disc four pixels across touches all sixteen of them, corners included, so nothing there separates it from a square, and asserting otherwise would assert something untrue of a dot at a real size.Also covered: the ink stays inside its box at every size, it is square to the pixel in a square box, and a box with no room draws nothing rather than a stray pixel.
Coverage stays at 100.0%.