diff --git a/res/app/components/stf/screen/fast-image-render/canvas-render.js b/res/app/components/stf/screen/fast-image-render/canvas-render.js index cd1e5b5d..6e8628ed 100644 --- a/res/app/components/stf/screen/fast-image-render/canvas-render.js +++ b/res/app/components/stf/screen/fast-image-render/canvas-render.js @@ -1,6 +1,29 @@ function CanvasRender(canvasElement, options) { this.options = options this.context = canvasElement.getContext('2d') + + var devicePixelRatio = window.devicePixelRatio || 1 + + var backingStoreRatio = this.context.webkitBackingStorePixelRatio || + this.context.mozBackingStorePixelRatio || + this.context.msBackingStorePixelRatio || + this.context.oBackingStorePixelRatio || + this.context.backingStorePixelRatio || 1 + + this.frontBackRatio = devicePixelRatio / backingStoreRatio + + if (options.autoScaleForRetina && devicePixelRatio !== backingStoreRatio) { + var oldWidth = canvas.width; + var oldHeight = canvas.height; + + canvasElement.width = oldWidth * this.frontBackRatio + canvasElement.height = oldHeight * this.frontBackRatio + + canvasElement.style.width = oldWidth + 'px' + canvasElement.style.height = oldHeight + 'px' + + this.context.scale(this.frontBackRatio, this.frontBackRatio) + } } CanvasRender.prototype.draw = function (image) { diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js index 7eb1d913..56ddfec2 100644 --- a/res/app/components/stf/screen/screen-directive.js +++ b/res/app/components/stf/screen/screen-directive.js @@ -38,6 +38,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, , w: 0 , h: 0 } + , autoScaleForRetina: true } var cachedScreen = { @@ -59,7 +60,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, function setDisplayDensity(forRetina) { // FORCE - forRetina = 1.2 + forRetina = 1.5 guestDisplayDensity = BrowserInfo.retina ? forRetina : 1 return guestDisplayDensity @@ -199,6 +200,11 @@ module.exports = function DeviceScreenDirective($document, ScalingService, if (scope.$parent.showScreen) { screen.rotation = device.display.rotation + + + + + // Check to set the size only if updated if (cachedScreen.bounds.w !== screen.bounds.w || cachedScreen.bounds.h !== screen.bounds.h ||