@@ -419,16 +419,18 @@ var webgl_quadFeature = function (arg) {
419419 return ;
420420 }
421421 quad . texture . bind ( renderState ) ;
422+ if ( quad . image ) {
423+ w = quad . image . width ;
424+ h = quad . image . height ;
425+ }
426+ if ( quad . imageTexture ) {
427+ w = quad . imageTexture . width ;
428+ h = quad . imageTexture . height ;
429+ }
422430 // only check if the context is out of memory when using modestly large
423431 // textures. The check is slow.
424- if ( quad . image && quad . image . width * quad . image . height > _memoryCheckLargestTested ) {
425- _memoryCheckLargestTested = quad . image . width * quad . image . height ;
426- if ( context . getError ( ) === context . OUT_OF_MEMORY ) {
427- console . log ( 'Insufficient GPU memory for texture' ) ;
428- }
429- }
430- if ( quad . imageTexture && quad . imageTexture . width * quad . imageTexture . height > _memoryCheckLargestTested ) {
431- _memoryCheckLargestTested = quad . imageTexture . width * quad . imageTexture . height ;
432+ if ( ( quad . image || quad . imageTexture ) && w * h > _memoryCheckLargestTested ) {
433+ _memoryCheckLargestTested = w * h ;
432434 if ( context . getError ( ) === context . OUT_OF_MEMORY ) {
433435 console . log ( 'Insufficient GPU memory for texture' ) ;
434436 }
@@ -450,14 +452,6 @@ var webgl_quadFeature = function (arg) {
450452 context . uniform2fv ( renderState . m_material . shaderProgram ( )
451453 . uniformLocation ( 'crop' ) , new Float32Array ( [ crop . x === undefined ? 1 : crop . x , crop . y === undefined ? 1 : crop . y ] ) ) ;
452454 }
453- if ( quad . image ) {
454- w = quad . image . width ;
455- h = quad . image . height ;
456- }
457- if ( quad . imageTexture ) {
458- w = quad . imageTexture . width ;
459- h = quad . imageTexture . height ;
460- }
461455 quadcropsrc = quad . crop || { left : 0 , top : 0 , right : w , bottom : h } ;
462456 if ( ! cropsrc || quadcropsrc . left !== cropsrc . left || quadcropsrc . top !== cropsrc . top || quadcropsrc . right !== cropsrc . right || quadcropsrc . bottom !== cropsrc . bottom || quadw !== w || quadh !== h ) {
463457 cropsrc = quadcropsrc ;
0 commit comments