     }
 
 
-    ///
+    /// Draws the overlayImage at the precise center of the Attachment's bounds.
+    ///
+    /// - Returns: The actual size of the overlayImage, once displayed onscreen. This size might be actually smaller than the one defined
+    ///   by the actual asset, since we make sure not to render images bigger than the canvas.
     ///
     private func drawOverlayImage(in bounds: CGRect) -> CGSize {
         guard let overlayImage = overlayImage else {


        var padding = (textContainer?.lineFragmentPadding ?? 0) * 2
        if let storage = textContainer?.layoutManager?.textStorage,
            let paragraphStyle = storage.attribute(.paragraphStyle, at: charIndex, effectiveRange: nil) as? NSParagraphStyle {
            let attachmentString = storage.attributedSubstring(from: NSMakeRange(charIndex, 1)).string
            let headIndent = storage.string.isStartOfParagraph(at: attachmentString.startIndex) ? paragraphStyle.firstLineHeadIndent : paragraphStyle.headIndent



        drawOverlayBackground(in: mediaBounds)
        drawOverlayBorder(in: mediaBounds)

        let overlayImageSize = drawOverlayImage(in: mediaBounds)
        drawOverlayMessage(in: mediaBounds, paddingY: overlayImageSize.height)

        drawProgress(in: mediaBounds)

        let result = UIGraphicsGetImageFromCurrentImageContext()
