Remove IE image smoothing fallback

This commit is contained in:
Maximilian Krög
2022-07-30 22:36:32 +02:00
parent 37aaf8ed4b
commit 6a6d2cd612
5 changed files with 7 additions and 32 deletions

View File

@@ -5,7 +5,6 @@ import CanvasLayerRenderer from './Layer.js';
import ImageState from '../../ImageState.js'; import ImageState from '../../ImageState.js';
import ViewHint from '../../ViewHint.js'; import ViewHint from '../../ViewHint.js';
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js'; import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
import {IMAGE_SMOOTHING_DISABLED, IMAGE_SMOOTHING_ENABLED} from './common.js';
import { import {
apply as applyTransform, apply as applyTransform,
compose as composeTransform, compose as composeTransform,
@@ -238,7 +237,7 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
const dh = img.height * transform[3]; const dh = img.height * transform[3];
if (!this.getLayer().getSource().getInterpolate()) { if (!this.getLayer().getSource().getInterpolate()) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED); context.imageSmoothingEnabled = false;
} }
this.preRender(context, frameState); this.preRender(context, frameState);
@@ -261,7 +260,7 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
if (clipped) { if (clipped) {
context.restore(); context.restore();
} }
Object.assign(context, IMAGE_SMOOTHING_ENABLED); context.imageSmoothingEnabled = true;
if (canvasTransform !== canvas.style.transform) { if (canvasTransform !== canvas.style.transform) {
canvas.style.transform = canvasTransform; canvas.style.transform = canvasTransform;

View File

@@ -6,7 +6,6 @@ import ImageTile from '../../ImageTile.js';
import ReprojTile from '../../reproj/Tile.js'; import ReprojTile from '../../reproj/Tile.js';
import TileRange from '../../TileRange.js'; import TileRange from '../../TileRange.js';
import TileState from '../../TileState.js'; import TileState from '../../TileState.js';
import {IMAGE_SMOOTHING_DISABLED, IMAGE_SMOOTHING_ENABLED} from './common.js';
import { import {
apply as applyTransform, apply as applyTransform,
compose as composeTransform, compose as composeTransform,
@@ -410,7 +409,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
} }
if (!tileSource.getInterpolate()) { if (!tileSource.getInterpolate()) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED); context.imageSmoothingEnabled = false;
} }
this.preRender(context, frameState); this.preRender(context, frameState);
@@ -561,7 +560,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
if (layerState.extent) { if (layerState.extent) {
context.restore(); context.restore();
} }
Object.assign(context, IMAGE_SMOOTHING_ENABLED); context.imageSmoothingEnabled = true;
if (canvasTransform !== canvas.style.transform) { if (canvasTransform !== canvas.style.transform) {
canvas.style.transform = canvasTransform; canvas.style.transform = canvasTransform;

View File

@@ -1,21 +0,0 @@
/**
* @module ol/renderer/canvas/common
*/
/**
* Context options to disable image smoothing.
* @type {Object}
*/
export const IMAGE_SMOOTHING_DISABLED = {
imageSmoothingEnabled: false,
msImageSmoothingEnabled: false,
};
/**
* Context options to enable image smoothing.
* @type {Object}
*/
export const IMAGE_SMOOTHING_ENABLED = {
imageSmoothingEnabled: true,
msImageSmoothingEnabled: true,
};

View File

@@ -1,7 +1,6 @@
/** /**
* @module ol/reproj * @module ol/reproj
*/ */
import {IMAGE_SMOOTHING_DISABLED} from './renderer/canvas/common.js';
import { import {
containsCoordinate, containsCoordinate,
createEmpty, createEmpty,
@@ -226,7 +225,7 @@ export function render(
); );
if (!opt_interpolate) { if (!opt_interpolate) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED); context.imageSmoothingEnabled = false;
} }
if (sources.length === 0) { if (sources.length === 0) {
@@ -254,7 +253,7 @@ export function render(
); );
if (!opt_interpolate) { if (!opt_interpolate) {
Object.assign(stitchContext, IMAGE_SMOOTHING_DISABLED); stitchContext.imageSmoothingEnabled = false;
} }
const stitchScale = pixelRatio / sourceResolution; const stitchScale = pixelRatio / sourceResolution;

View File

@@ -6,7 +6,6 @@ import EventType from '../events/EventType.js';
import ImageSource, {defaultImageLoadFunction} from './Image.js'; import ImageSource, {defaultImageLoadFunction} from './Image.js';
import ImageState from '../ImageState.js'; import ImageState from '../ImageState.js';
import ImageWrapper from '../Image.js'; import ImageWrapper from '../Image.js';
import {IMAGE_SMOOTHING_DISABLED} from '../renderer/canvas/common.js';
import {createCanvasContext2D} from '../dom.js'; import {createCanvasContext2D} from '../dom.js';
import {getHeight, getWidth, intersects} from '../extent.js'; import {getHeight, getWidth, intersects} from '../extent.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
@@ -157,7 +156,7 @@ class Static extends ImageSource {
if (targetWidth !== imageWidth || targetHeight !== imageHeight) { if (targetWidth !== imageWidth || targetHeight !== imageHeight) {
const context = createCanvasContext2D(targetWidth, targetHeight); const context = createCanvasContext2D(targetWidth, targetHeight);
if (!this.getInterpolate()) { if (!this.getInterpolate()) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED); context.imageSmoothingEnabled = false;
} }
const canvas = context.canvas; const canvas = context.canvas;
context.drawImage( context.drawImage(