AnalyticalGraphicsInc/cesium — pull request #343 by emackey (2012-11-24 19:23:47+00:00)
Title: Add support for canvases that are not scaled 1:1.

A prominent feature of GLSL Sandbox is the "quality" selector in the upper-left, which defaults to `2`, meaning each canvas pixel is 2x2 CSS pixels. I thought we might want a similar feature, sometimes it can help systems with less WebGL performance if they don't have to render as many pixels. I'm not certain if Cesium in particular could benefit from this, so I'm opening this pull request to solicit feedback and further testing, particularly on mobile (Nexus 10 perhaps?) where it might be able to help performance.

The main change is to `CesiumViewerWidget` and was simple to make. Unfortunately, there are lots of places throughout our code base where we make poor assumptions that canvas pixels === CSS pixels. I've gone on a search-and-replace spree trying to fix all this without breaking picking (which itself gets mouse coordinates in CSS pixels and must compute a frustum in canvas pixels).

[For reference, device-native pixels can differ from CSS pixels, and some control over that is offered by the `meta viewport` tag scaling factor. But that discussion is separate from the central issue of this pull, as it doesn't affect the relationship of CSS pixels to canvas pixels].

If this turns out to be useful performance-wise, we might consider adding a UI element to the widget to control the value. In the meantime it's just an API setting.