4 ms·
> When pressing a key in, say, a text editor, the app would prepare and render a minimal damage region Is this similar to the "dirty rectangles" technique? [1]
by emmanueloga_ 6y ago
> When pressing a key in, say, a text editor, the app would prepare and render a minimal damage region
Is this similar to the "dirty rectangles" technique? [1]
It seems difficult to implement some sort of scene system (for either an app, game or general GUI) that given a single key press can determine a minimum bounding box of changes on the screen no matter what the scene is, and is able to render just that bounding box.
If the single key occurs on a text area, potentially the whole text area could be "damaged" right? Edit: I was looking at this with the "Rendering" tab of chrome dev tools, enabling "Paint flashing" and "Layout Shift Regions", it seems like the text area is its own layer and the space is partitioned pretty cleverly on things like paragraphs and lines, but from time to time the whole text area just flashes, which tells me the algorithm sometimes is not sure what is dirty and just repaints the whole thing, but not always.
1: https://wiki.c2.com/?DirtyRectangles https://wiki.c2.com/?DirtyRectangles
- munificent 6y ago> Is this similar to the "dirty rectangles" technique? Yes. > It seems difficult to implement some sort of scene system (for either an app, game or general GUI) that given a single key press can determine a minimum bounding box of changes on the screen no matter what the scene is, and is able to render just that bounding box. I don't think it's that bad. In the days before hardware graphics, basically every 2D sprite engine used in every computer game you liked had to do this logic. Text editors are a harder case in some ways because of line wrapping, but the editor does need to figure out where everything goes spatially in order to render, so extending that to tell which things have not moved is, I think, not that difficult.