File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ class SVGSkin extends Skin {
8080 // updating Silhouette and is better handled by more browsers in
8181 // regards to memory.
8282 const canvas = this . _svgRenderer . canvas ;
83+ // If one of the canvas dimensions is 0, set this MIP to an empty image texture.
84+ // This avoids an IndexSizeError from attempting to getImageData when one of the dimensions is 0.
85+ if ( canvas . width === 0 || canvas . height === 0 ) return super . getTexture ( ) ;
86+
8387 const context = canvas . getContext ( '2d' ) ;
8488 const textureData = context . getImageData ( 0 , 0 , canvas . width , canvas . height ) ;
8589
@@ -105,10 +109,6 @@ class SVGSkin extends Skin {
105109 * @return {WebGLTexture } The GL texture representation of this skin when drawing at the given scale.
106110 */
107111 getTexture ( scale ) {
108- if ( ! this . _svgRenderer . canvas . width || ! this . _svgRenderer . canvas . height ) {
109- return super . getTexture ( ) ;
110- }
111-
112112 // The texture only ever gets uniform scale. Take the larger of the two axes.
113113 const scaleMax = scale ? Math . max ( Math . abs ( scale [ 0 ] ) , Math . abs ( scale [ 1 ] ) ) : 100 ;
114114 const requestedScale = Math . min ( scaleMax / 100 , this . _maxTextureScale ) ;
You can’t perform that action at this time.
0 commit comments