diff --git a/src/core/helpers/hidpi.js b/src/core/helpers/hidpi.js
index f7bd0f6e5694c2a69598a655969505be8fdf8b4d..0245c690d953fbe4e11e5e7790e6e457a9896675 100644
--- a/src/core/helpers/hidpi.js
+++ b/src/core/helpers/hidpi.js
@@ -1,12 +1,13 @@
export const pixelRatio = (function () {
const canvas = document.createElement('canvas')
+ canvas.height = canvas.width = 0
const context = canvas.getContext('2d')
const backingStore = context.backingStorePixelRatio ||
- context.webkitBackingStorePixelRatio ||
- context.mozBackingStorePixelRatio ||
- context.msBackingStorePixelRatio ||
- context.oBackingStorePixelRatio ||
- context.backingStorePixelRatio || 1
+ context.webkitBackingStorePixelRatio ||
+ context.mozBackingStorePixelRatio ||
+ context.msBackingStorePixelRatio ||
+ context.oBackingStorePixelRatio ||
+ context.backingStorePixelRatio || 1
return (window.devicePixelRatio || 1) / backingStore
})()
diff --git a/src/core/service/api/context/canvas.js b/src/core/service/api/context/canvas.js
index 6ebda3c2a133733a6026e01a1945adb602c07dc8..a4452805660e3ed6e5789c9aa1a85d1791c319aa 100644
--- a/src/core/service/api/context/canvas.js
+++ b/src/core/service/api/context/canvas.js
@@ -259,10 +259,12 @@ var methods3 = ['setFillStyle', 'setTextAlign', 'setStrokeStyle', 'setGlobalAlph
]
var tempCanvas
-function getTempCanvas () {
+function getTempCanvas (width = 0, height = 0) {
if (!tempCanvas) {
tempCanvas = document.createElement('canvas')
}
+ tempCanvas.width = width
+ tempCanvas.height = height
return tempCanvas
}
diff --git a/src/core/view/components/canvas/index.vue b/src/core/view/components/canvas/index.vue
index 7deaf205aff624aced31519a85f6844296766562..d476e3c76fd58611a7d1a44d20e51e3332f2d0cf 100644
--- a/src/core/view/components/canvas/index.vue
+++ b/src/core/view/components/canvas/index.vue
@@ -1,18 +1,18 @@
-
-
-
+