openlayers/ol3 — pull request #333 by twpayne (2013-03-09 20:31:14+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 the map to the nearest pixel of the first tile layer found. This is only done if (a) there is a tile layer present (b) it is ready and (c) the view resolution exactly matches a resolution supported exactly by the first 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/5y0k2qT.png)

After:
![after](http://i.imgur.com/FlkoMLi.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.