1,295
edits
| Line 32: | Line 32: | ||
* Compute the transformation from image space to device space: compute the device pixel initial rectangle by snapping the initial rectangle to device pixels, preserving device pixel centers. Then the transformation from image space to device space is the transformation that maps the image bounds to the device pixel initial rectangle. | * Compute the transformation from image space to device space: compute the device pixel initial rectangle by snapping the initial rectangle to device pixels, preserving device pixel centers. Then the transformation from image space to device space is the transformation that maps the image bounds to the device pixel initial rectangle. | ||
Requirements 3 and 4 are satisfied by construction. Proof that requirement 5 is always satisfied: | Requirement 2 is obviously satisfied since the dirty rect is only used to constrain the filled area and does not affect the mapping from image space to device space. Requirements 3 and 4 are satisfied by construction. Proof that requirement 5 is always satisfied: | ||
Assume the initial rectangle size in device pixels equals the image size in CSS pixels. Then the initial rectangle size is integral numbers of device pixels, so the device pixel initial rectangle has the same size. So the scale factors of the transform are 1. Now, the translation from image space to device context space in the ideal rendering is just the top-left of the initial rectangle | Assume the initial rectangle size in device pixels equals the image size in CSS pixels. Then the initial rectangle size is integral numbers of device pixels, so the device pixel initial rectangle has the same size. So the scale factors of the transform are 1. Now, the translation from image space to device context space in the ideal rendering is just the top-left of the initial rectangle | ||
in device pixels. The translation in our rendering is the top-left of the device pixel initial rectangle, which is the top-left of the initial rectangle snapped to the nearest pixel edges --- a translation of at most half a pixel in each direction. QED. | in device pixels. The translation in our rendering is the top-left of the device pixel initial rectangle, which is the top-left of the initial rectangle snapped to the nearest pixel edges --- a translation of at most half a pixel in each direction. QED. | ||
edits