# display-scaling Specification ## Purpose Keeps the application rendering crisp on displays with integer or fractional scaling by converting between logical and physical coordinates. ## Requirements ### Requirement: Fractional scale is applied when available The system SHALL use the compositor-provided fractional preferred scale for rendering when the fractional scale protocol is available. #### Scenario: Fractional display - **WHEN** the compositor sends a preferred scale of 1.5 - **THEN** the render buffer is created at 1.5 times the logical size - **AND** the buffer is displayed at the logical size ### Requirement: Integer scale is used as fallback The system SHALL use the output's integer scale when fractional scale is unavailable. #### Scenario: No fractional protocol - **WHEN** the compositor does not support fractional scaling - **THEN** the render buffer uses the output integer scale - **AND** the buffer is displayed at the logical size ### Requirement: Input coordinates remain logical The system SHALL report mouse positions and grid cells in logical coordinates regardless of the active scale. #### Scenario: Scaled click - **WHEN** the user clicks on a scaled display - **THEN** the selected grid cell matches the visual location of the cursor ### Requirement: Rendering uses physical resolution The system SHALL render all content at physical resolution so that lines and cells stay sharp at the active scale. #### Scenario: Sharp cells - **WHEN** the application runs on a 2x scaled display - **THEN** cells are drawn with 2 physical pixels per logical pixel ### Requirement: Scale changes trigger re-render The system SHALL recreate buffers and re-render when the active scale changes. #### Scenario: Scale change - **WHEN** the compositor changes the preferred scale - **THEN** the application updates its buffers - **AND** subsequent frames use the new scale