@@ -168,7 +168,9 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
168
168
< a name ='L109 '> </ a > < a href ='#L109 '> 109</ a >
169
169
< a name ='L110 '> </ a > < a href ='#L110 '> 110</ a >
170
170
< a name ='L111 '> </ a > < a href ='#L111 '> 111</ a >
171
- < a name ='L112 '> </ a > < a href ='#L112 '> 112</ a > </ td > < td class ="line-coverage quiet "> < span class ="cline-any cline-neutral "> </ span >
171
+ < a name ='L112 '> </ a > < a href ='#L112 '> 112</ a >
172
+ < a name ='L113 '> </ a > < a href ='#L113 '> 113</ a >
173
+ < a name ='L114 '> </ a > < a href ='#L114 '> 114</ a > </ td > < td class ="line-coverage quiet "> < span class ="cline-any cline-neutral "> </ span >
172
174
< span class ="cline-any cline-neutral "> </ span >
173
175
< span class ="cline-any cline-neutral "> </ span >
174
176
< span class ="cline-any cline-neutral "> </ span >
@@ -236,6 +238,8 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
236
238
< span class ="cline-any cline-yes "> 6x</ span >
237
239
< span class ="cline-any cline-neutral "> </ span >
238
240
< span class ="cline-any cline-neutral "> </ span >
241
+ < span class ="cline-any cline-neutral "> </ span >
242
+ < span class ="cline-any cline-neutral "> </ span >
239
243
< span class ="cline-any cline-yes "> 6x</ span >
240
244
< span class ="cline-any cline-neutral "> </ span >
241
245
< span class ="cline-any cline-yes "> 4x</ span >
@@ -251,6 +255,8 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
251
255
< span class ="cline-any cline-yes "> 2x</ span >
252
256
< span class ="cline-any cline-yes "> 9x</ span >
253
257
< span class ="cline-any cline-yes "> 9x</ span >
258
+ < span class ="cline-any cline-neutral "> </ span >
259
+ < span class ="cline-any cline-neutral "> </ span >
254
260
< span class ="cline-any cline-yes "> 9x</ span >
255
261
< span class ="cline-any cline-neutral "> </ span >
256
262
< span class ="cline-any cline-yes "> 9x</ span >
@@ -268,8 +274,6 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
268
274
< span class ="cline-any cline-yes "> 9x</ span >
269
275
< span class ="cline-any cline-neutral "> </ span >
270
276
< span class ="cline-any cline-neutral "> </ span >
271
- < span class ="cline-any cline-neutral "> </ span >
272
- < span class ="cline-any cline-neutral "> </ span >
273
277
< span class ="cline-any cline-yes "> 2x</ span >
274
278
< span class ="cline-any cline-yes "> 2x</ span >
275
279
< span class ="cline-any cline-yes "> 2x</ span >
@@ -333,9 +337,9 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
333
337
incProgress()
334
338
335
339
// exifOrientation
336
- options. exifOrientation = options.exifOrientation || < span class ="branch-1 cbranch-no " title ="branch not covered " > await getExifOrientation(file)</ span >
340
+ const exifOrientation = options.exifOrientation || < span class ="branch-1 cbranch-no " title ="branch not covered " > await getExifOrientation(file)</ span >
337
341
incProgress()
338
- const orientationFixedCanvas = (await isAutoOrientationInBrowser) ? < span class ="branch-0 cbranch-no " title ="branch not covered " > maxWidthOrHeightFixedCanvas </ span > : followExifOrientation(maxWidthOrHeightFixedCanvas, options. exifOrientation)
342
+ const orientationFixedCanvas = (await isAutoOrientationInBrowser) ? < span class ="branch-0 cbranch-no " title ="branch not covered " > maxWidthOrHeightFixedCanvas </ span > : followExifOrientation(maxWidthOrHeightFixedCanvas, exifOrientation)
339
343
incProgress()
340
344
341
345
let quality = 1
@@ -345,6 +349,8 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
345
349
346
350
const origExceedMaxSize = tempFile.size > maxSizeByte
347
351
const sizeBecomeLarger = tempFile.size > file.size
352
+ // console.log('original file size', file.size)
353
+ // console.log('current file size', tempFile.size)
348
354
349
355
// check if we need to compress or resize
350
356
if (!origExceedMaxSize && !sizeBecomeLarger) {
@@ -362,6 +368,8 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
362
368
while (remainingTrials-- && (currentSize > maxSizeByte || currentSize > sourceSize)) {
363
369
const newWidth = origExceedMaxSize ? canvas.width * 0.95 : < span class ="branch-1 cbranch-no " title ="branch not covered " > canvas.width</ span >
364
370
const newHeight = origExceedMaxSize ? canvas.height * 0.95 : < span class ="branch-1 cbranch-no " title ="branch not covered " > canvas.height;</ span >
371
+ // console.log('current width', newWidth);
372
+ // console.log('current height', newHeight);
365
373
[newCanvas, ctx] = getNewCanvasAndCtx(newWidth, newHeight)
366
374
367
375
ctx.drawImage(canvas, 0, 0, newWidth, newHeight)
@@ -379,8 +387,6 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
379
387
setProgress(Math.min(99, Math.floor((renderedSize - currentSize) / (renderedSize - maxSizeByte) * 100)))
380
388
}
381
389
382
- // garbage clean canvas for safari
383
- // ref: https://bugs.webkit.org/show_bug.cgi?id=195325
384
390
cleanupCanvasMemory(canvas)
385
391
cleanupCanvasMemory(newCanvas)
386
392
cleanupCanvasMemory(maxWidthOrHeightFixedCanvas)
@@ -397,7 +403,7 @@ <h1><a href="index.html">All files</a> image-compression.js</h1>
397
403
< div class ='footer quiet pad2 space-top1 center small '>
398
404
Code coverage generated by
399
405
< a href ="https://istanbul.js.org/ " target ="_blank "> istanbul</ a >
400
- at Fri May 08 2020 00:21:28 GMT+0800 (香港標準時間 )
406
+ at Tue Jun 16 2020 19:18:40 GMT+0300 (Moscow Standard Time )
401
407
</ div >
402
408
</ div >
403
409
< script src ="prettify.js "> </ script >
0 commit comments