Deprecate the imageSmoothing option for sources

This commit is contained in:
Tim Schaub
2021-12-27 12:25:11 -07:00
parent 8d8632bff7
commit e2883fb658
48 changed files with 538 additions and 191 deletions
+5 -1
View File
@@ -4,6 +4,7 @@
import CanvasLayerRenderer from './Layer.js';
import ViewHint from '../../ViewHint.js';
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
import {IMAGE_SMOOTHING_DISABLED} from './common.js';
import {assign} from '../../obj.js';
import {compose as composeTransform, makeInverse} from '../../transform.js';
import {containsExtent, intersects as intersectsExtent} from '../../extent.js';
@@ -179,7 +180,10 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
const dw = img.width * transform[0];
const dh = img.height * transform[3];
assign(context, this.getLayer().getSource().getContextOptions());
if (!this.getLayer().getSource().getInterpolate()) {
assign(context, IMAGE_SMOOTHING_DISABLED);
}
this.preRender(context, frameState);
if (render && dw >= 0.5 && dh >= 0.5) {
const dx = transform[4];
+5 -1
View File
@@ -4,6 +4,7 @@
import CanvasLayerRenderer from './Layer.js';
import TileRange from '../../TileRange.js';
import TileState from '../../TileState.js';
import {IMAGE_SMOOTHING_DISABLED} from './common.js';
import {
apply as applyTransform,
compose as composeTransform,
@@ -317,7 +318,10 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
this.clipUnrotated(context, frameState, layerExtent);
}
assign(context, tileSource.getContextOptions());
if (!tileSource.getInterpolate()) {
assign(context, IMAGE_SMOOTHING_DISABLED);
}
this.preRender(context, frameState);
this.renderedTiles.length = 0;
+12
View File
@@ -0,0 +1,12 @@
/**
* @module ol/renderer/canvas/common
*/
/**
* Context options to disable image smoothing.
* @type {Object}
*/
export const IMAGE_SMOOTHING_DISABLED = {
imageSmoothingEnabled: false,
msImageSmoothingEnabled: false,
};