File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,10 @@ class SVGMIP {
4545 }
4646 }
4747
48+ dispose ( ) {
49+ this . _renderer . gl . deleteTexture ( this . getTexture ( ) ) ;
50+ }
51+
4852 getTexture ( ) {
4953 if ( this . dirty ) {
5054 this . draw ( ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ const SvgRenderer = require('scratch-svg-renderer').SVGRenderer;
44
55const MAX_TEXTURE_DIMENSION = 2048 ;
66const MIN_TEXTURE_SCALE = 1 / 256 ;
7+ /**
8+ * All scaled renderings of the SVG are stored in an array. The 1.0 scale of
9+ * the SVG is stored at the 8th index. The smallest possible 1 / 256 scale
10+ * rendering is stored at the 0th index.
11+ * @const {number}
12+ */
713const INDEX_OFFSET = 8 ;
814
915class SVGSkin extends Skin {
@@ -43,7 +49,7 @@ class SVGSkin extends Skin {
4349 if ( this . _texture ) {
4450 for ( const mip of this . _scaledMIPs ) {
4551 if ( mip ) {
46- this . _renderer . gl . deleteTexture ( mip . getTexture ( ) ) ;
52+ mip . dispose ( ) ;
4753 }
4854 }
4955 this . _texture = null ;
You can’t perform that action at this time.
0 commit comments