Scale output canvas by devicePixelRatio

This commit is contained in:
Frederic Junod
2013-12-12 14:46:39 +01:00
committed by Tom Payne
parent bd1107f785
commit 355c0a1017
4 changed files with 39 additions and 13 deletions
@@ -139,9 +139,12 @@ ol.renderer.canvas.Layer.prototype.getImageTransform = goog.abstractMethod;
*/
ol.renderer.canvas.Layer.prototype.getTransform = function(frameState) {
var view2DState = frameState.view2DState;
var devicePixelRatio = frameState.devicePixelRatio;
return ol.vec.Mat4.makeTransform2D(this.transform_,
frameState.size[0] / 2, frameState.size[1] / 2,
1 / view2DState.resolution, -1 / view2DState.resolution,
devicePixelRatio * frameState.size[0] / 2,
devicePixelRatio * frameState.size[1] / 2,
devicePixelRatio / view2DState.resolution,
-devicePixelRatio / view2DState.resolution,
-view2DState.rotation,
-view2DState.center[0], -view2DState.center[1]);
};