Repository navigation
Game Library: sharp canvases on 2x and 3x screens (190 games) - #115
Merged
Merged
Conversation
…s fixed-size 2D canvases a 2x backing store; added to the 190 games where a deterministic play-through drew the same picture and layout with and without it
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.
From the sharpness scan (Cairn decision mac-0015, handoff of 21 Nov): 252 games draw into a fixed-size canvas that CSS stretches, soft on 2x-3x screens.
web/hidpi.js(new, no dependencies): on-screen 2D canvases get a backing store of up to 2x;canvas.width, mouse maths,setTransform, shadows,isPointInPathanddrawImageof the canvas keep the game's own units. Off-screen buffers and WebGL are left alone;data-hidpi="off"opts a canvas out.<script src="hidpi.js"></script>, before the first script of 190 games.How the 190 were chosen (headless Chrome, 1280x800 at 2x): each candidate was played three times by a script with fixed random numbers and a virtual clock (same taps, keys and start button): plain, plain again, with the script. Kept only when the two plain runs were identical, the picture with the script matched at four moments, the canvas and page had the same position and size, the backing store was 2x, there was no new script error, and the play-through left the first screen.
Also checked after the edit: all 190 pages open at desktop 2x and iPhone 3x with a 2x canvas and no script error; canvas position and size on a phone, upright and sideways, identical to before (380 page views, 0 differ);
apps/gamelib/tests9 tests OK.Not included: 48 whose scripted play-through never left the first screen, 12 pixel-art, 4 that read pixels back. Not checked by a person playing or on a physical phone.