Skip to content

Commit d054646

Browse files
committed
use LINEAR magFilter when dpr !== 1
1 parent 57be773 commit d054646

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/maptalks/src/renderer/layer/ImageGLRenderable.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
418418
* @param image
419419
*/
420420
loadTexture(image: TileImageType, resized = false): TileImageTexture {
421-
const map = (this as any).getMap();
422421
const gl = this.gl;
423422
let texture = image.texture; // Create a texture object
424423
if (!texture) {
@@ -428,12 +427,14 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
428427
gl.bindTexture(gl.TEXTURE_2D, texture);
429428
const genMipmap = this.layer.options['mipmapTexture'];
430429
if (genMipmap) {
430+
const map = (this as any).getMap();
431+
const dpr = map.getDevicePixelRatio();
431432
if (map.isMoving() && map.getRenderer().isViewChanged()) {
432433
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
433434
} else {
434435
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
435436
}
436-
if (resized) {
437+
if (dpr !== 1 || resized) {
437438
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
438439
} else {
439440
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);

0 commit comments

Comments
 (0)