@@ -108,12 +108,12 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
108108 * @param debugInfo
109109 * @param baseColor
110110 */
111- drawGLImage ( image : TileImageType , x : number , y : number , w : number , h : number , scale : number , opacity : number , debugInfo ?: string , baseColor ?: number [ ] ) {
111+ drawGLImage ( image : TileImageType , x : number , y : number , w : number , h : number , scale : number , opacity : number , resized , debugInfo ?: string , baseColor ?: number [ ] ) {
112112 if ( ( this . gl as any ) . program !== this . program ) {
113113 this . useProgram ( this . program ) ;
114114 }
115115 const gl = this . gl ;
116- this . loadTexture ( image ) ;
116+ this . loadTexture ( image , resized ) ;
117117 const inGroup = this . canvas . gl && this . canvas . gl . wrap ;
118118 if ( inGroup ) {
119119 let layerOpacity = this . layer && this . layer . options [ 'opacity' ] ;
@@ -417,7 +417,7 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
417417 * Load image into a text and bind it with WebGLContext
418418 * @param image
419419 */
420- loadTexture ( image : TileImageType ) : TileImageTexture {
420+ loadTexture ( image : TileImageType , resized = false ) : TileImageTexture {
421421 const map = ( this as any ) . getMap ( ) ;
422422 const gl = this . gl ;
423423 let texture = image . texture ; // Create a texture object
@@ -433,6 +433,12 @@ const ImageGLRenderable = function <T extends MixinConstructor>(Base: T) {
433433 } else {
434434 gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_MIN_FILTER , gl . LINEAR ) ;
435435 }
436+ if ( resized ) {
437+ gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_MAG_FILTER , gl . LINEAR ) ;
438+ } else {
439+ gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_MAG_FILTER , gl . NEAREST ) ;
440+ }
441+
436442 }
437443 return texture ;
438444 }
0 commit comments