Unified · Split
| @@ -49,6 +49,12 @@ withImage = (url, action) -> · 48 unmodified lines | |||
| 49 | docIconPercentage = 65 | 49 | docIconPercentage = 65 |
| 50 | destinationCoords = size / 100 * (100 - docIconPercentage) | 50 | destinationCoords = size / 100 * (100 - docIconPercentage) |
| 51 | destinationSize = size / 100 * docIconPercentage | 51 | destinationSize = size / 100 * docIconPercentage |
| 52 | paddingSize = destinationSize + 1 | ||
| 53 | |||
| 54 | imageData = ctx.getImageData(destinationCoords, destinationCoords, paddingSize, paddingSize) | ||
| 55 | transparentImageData = new ImageData(new Uint8ClampedArray(imageData.data.length), paddingSize, paddingSize) | ||
| 56 | ctx.putImageData(transparentImageData, destinationCoords, destinationCoords) | ||
| 57 | |||
| 52 | ctx.drawImage(docImg, sourceX, sourceY, sourceSize, sourceSize, destinationCoords, destinationCoords, destinationSize, destinationSize) | 58 | ctx.drawImage(docImg, sourceX, sourceY, sourceSize, sourceSize, destinationCoords, destinationCoords, destinationSize, destinationSize) |
| 53 | 59 | ||
| 54 | urlCache[doc.slug] = canvas.toDataURL() | 60 | urlCache[doc.slug] = canvas.toDataURL() |