Skip to content

Commit d60e240

Browse files
authored
TheShovel/CanvasEffects: don't scale render size block by DPI (#2489)
1 parent d0d7ba6 commit d60e240

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

extensions/TheShovel/CanvasEffects.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,12 @@
503503
updateStyle();
504504
}
505505
renderscale({ X, Y }) {
506-
Scratch.vm.renderer.resize(X, Y);
506+
// The function normally expects a stage size and therefore scales by DPI.
507+
// However, this block is meant for a fixed pixel size
508+
// (usually used in conjunction with the pixelated resize rendering mode).
509+
// Therefore, scale it back according to the devicePixelRatio.
510+
const pixelRatio = window.devicePixelRatio || 1;
511+
Scratch.vm.renderer.resize(X / pixelRatio, Y / pixelRatio);
507512
}
508513
setBorder(args) {
509514
borderWidth = Scratch.Cast.toNumber(args.WIDTH);

0 commit comments

Comments
 (0)