Skip to content

Commit

Permalink
use LINEAR magFilter when dpr !== 1
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Mar 4, 2025
1 parent 57be773 commit d054646
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/maptalks/src/renderer/layer/ImageGLRenderable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
* @param image
*/
loadTexture(image: TileImageType, resized = false): TileImageTexture {
const map = (this as any).getMap();
const gl = this.gl;
let texture = image.texture; // Create a texture object
if (!texture) {
Expand All @@ -428,12 +427,14 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
gl.bindTexture(gl.TEXTURE_2D, texture);
const genMipmap = this.layer.options['mipmapTexture'];
if (genMipmap) {
const map = (this as any).getMap();
const dpr = map.getDevicePixelRatio();
if (map.isMoving() && map.getRenderer().isViewChanged()) {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
} else {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
}
if (resized) {
if (dpr !== 1 || resized) {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
} else {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
Expand Down

0 comments on commit d054646

Please sign in to comment.