Improve the image quality of thumbnails rendered by `PDFThumbnailView.draw` (issue 8233)
Improve the image quality of thumbnails rendered by `PDFThumbnailView.draw` (issue 8233)

The reason for the fairly large discrepancy, in the thumbnail quality, between the `draw`/`setImage`-methods is that in the former case we *directly* render the thumbnails at the final size that they'll appear at in the sidebar. In the latter case, we instead downsize the (generally) much larger "regular" pages.

To address this, I'm thus proposing that we let `PDFThumbnailView.draw` render thumbnails at *twice* their intended size and then downsize them to the final size.
Obviously this will increase *peak* memory usage during thumbnail rendering in `PDFThumbnailView.draw`, since doubling the width/height of a `canvas` will lead to its pixel-count increasing by a factor of `4`. Furthermore, since you need four components per pixel (given that it's RGBA-data), this will thus lead to the *temporary* thumbnail `canvas`-sizes increasing by a factor of `16` during rendering. Hence why rendering thumbnails at their "original" scale, i.e. using something like `PDFPageProxy.getViewport({ scale: 1 });`, would be an absolutely terrible idea!

To reduce the size and scope of these changes, I've tried to re-factor and re-use as much of the existing downsizing-implementation already present in `PDFThumbnailView` as possible.

While this will generally *not* make thumbnails rendered by `PDFThumbnailView.draw` look *identical* to those based on the rendered pages (via `PDFThumbnailView.setImage`), it's a considerable improvement as far as I'm concerned and enough to call the issue fixed.

*Please note:* This patch will not lead to *any* additional overhead, in either memory usage or parsing, for thumbnails which are based on the rendered pages.

macroplant/pdf.js,showpad/mozilla-pdf.js,Shoobx/pdf.js,Shoobx/pdf.js,showpad/mozilla-pdf.js,macroplant/pdf.js,Snuffleupagus/pdf.js,Snuffleupagus/pdf.js,mozilla/pdf.js,timvandermeij/pdf.js,mozilla/pdf.js,Snuffleupagus/pdf.js,Shoobx/pdf.js,nawawi/pdf.js,nawawi/pdf.js,timvandermeij/pdf.js,xavier114fch/pdf.js,mozilla/pdf.js,macroplant/pdf.js,showpad/mozilla-pdf.js,timvandermeij/pdf.js,xavier114fch/pdf.js,nawawi/pdf.js