@@ -90,7 +90,7 @@ function pixelsToRenderCommands (palette, { width, height, data }) {
9090 const c = ( r << 16 ) + ( g << 8 ) + b
9191 const index = palette [ c ]
9292 if ( ! index ) {
93- throw new Error ( `[${ r } ${ g } ${ b } ] is not in palette` )
93+ throw new Error ( `Missing color: [${ r } ${ g } ${ b } ] is not in palette` )
9494 }
9595 if ( prevCommand === RENDER_FILL && index === prevArg . color ) {
9696 prevArg . pxCount ++
@@ -187,7 +187,12 @@ function renderCommandsToSlpFrame ({ width, height, commands, baseOffset }) {
187187 return buffer . slice ( 0 , offset )
188188}
189189
190- SLPEncoder . prototype . addFrame = function ( { width, height, data, hotspot } ) {
190+ SLPEncoder . prototype . addFrame = function ( {
191+ width,
192+ height,
193+ data,
194+ hotspot = { x : 0 , y : 0 }
195+ } ) {
191196 const commands = pixelsToRenderCommands ( this . colorIndices , { width, height, data } )
192197
193198 this . frames . push ( {
@@ -197,7 +202,7 @@ SLPEncoder.prototype.addFrame = function ({ width, height, data, hotspot }) {
197202 properties : 0 ,
198203 width,
199204 height,
200- hotspot : hotspot || { x : 0 , y : 0 } ,
205+ hotspot,
201206 data,
202207 commands
203208 } )
@@ -213,7 +218,7 @@ SLPEncoder.prototype.encode = function () {
213218 frames : this . frames
214219 }
215220
216- let offset = headerStruct . size ( header )
221+ let offset = headerStruct . encodingLength ( header )
217222 const frameBuffers = this . frames . map ( ( frame ) => {
218223 frame . outlineTableOffset = offset
219224 frame . cmdTableOffset = offset + frame . height * 4
0 commit comments