openlayers/ol3 — pull request #338 by twpayne (2013-03-10 15:15:04+00:00)
Title: Snap center to pixel

This PR is also short, but gives a significant image quality improvement.

ol3 supports rendering layers at arbitrary resolutions. With tile layers, if the center of the map does not coincide exactly with the center of a pixel in the tile layer then the resulting image is a blurry as the screen pixels are interpolated between the tile layer pixels.

This PR snaps the center of each tile layer the nearest pixel. This is only done if the view resolution exactly matches a resolution supported exactly by the tile layer.

The result of this is that the map, across all renderers, is much sharper. The canvas tiles example best demonstrates this. I've attached before and after screenshots (hint: you'll need to view the screenshots at their original resolution to see the image quality improvement).

Before:
![before](http://i.imgur.com/u23f9xP.png)

After:
![after](http://i.imgur.com/tHj0YYH.png)

This also has a very positive effect on the Swisstopo wms-custom-proj example which uses a hatching effect that does not respond well to subpixel positioning errors.