diff --git a/src/js/core/buffer_utils.js b/src/js/core/buffer_utils.js index 86114744..c21108a5 100644 --- a/src/js/core/buffer_utils.js +++ b/src/js/core/buffer_utils.js @@ -4,23 +4,6 @@ import { fastArrayDelete } from "./utils"; const logger = createLogger("buffer_utils"); -/** - * Enables images smoothing on a context - * @param {CanvasRenderingContext2D} context - */ -export function enableImageSmoothing(context) { - context.imageSmoothingEnabled = true; - context.imageSmoothingQuality = globalConfig.smoothing.quality; -} - -/** - * Disables image smoothing on a context - * @param {CanvasRenderingContext2D} context - */ -export function disableImageSmoothing(context) { - context.imageSmoothingEnabled = false; -} - /** * @typedef {{ * canvas: HTMLCanvasElement, @@ -175,11 +158,8 @@ export function makeOffscreenBuffer(w, h, { smooth = true, reusable = true, labe // @ts-ignore canvas.label = label; - if (smooth) { - enableImageSmoothing(context); - } else { - disableImageSmoothing(context); - } + context.imageSmoothingEnabled = smooth; + context.imageSmoothingQuality = globalConfig.smoothing.quality; if (reusable) { registerCanvas(canvas, context); diff --git a/src/js/game/core.js b/src/js/game/core.js index eb4ec008..9147778f 100644 --- a/src/js/game/core.js +++ b/src/js/game/core.js @@ -2,12 +2,7 @@ import { Application } from "../application"; /* typehints:end */ import { BufferMaintainer } from "../core/buffer_maintainer"; -import { - disableImageSmoothing, - enableImageSmoothing, - getBufferStats, - registerCanvas, -} from "../core/buffer_utils"; +import { getBufferStats, registerCanvas } from "../core/buffer_utils"; import { globalConfig } from "../core/config"; import { getDeviceDPI, resizeHighDPICanvas } from "../core/dpi_manager"; import { DrawParameters } from "../core/draw_parameters"; @@ -244,11 +239,8 @@ export class GameCore { // Oof, use :not() instead canvas.classList.toggle("unsmoothed", !globalConfig.smoothing.smoothMainCanvas); - if (globalConfig.smoothing.smoothMainCanvas) { - enableImageSmoothing(context); - } else { - disableImageSmoothing(context); - } + context.imageSmoothingEnabled = globalConfig.smoothing.smoothMainCanvas; + context.imageSmoothingQuality = globalConfig.smoothing.quality; this.root.canvas = canvas; this.root.context = context;