Skip to content

Splash: Fix blitImage in uncolored tiling patterns to respect pattern color space from outer scope

Roughly spoken, SplashOutputDev::tilingPatternFill first renders a pattern prototype into a temporary buffer, then draws multiple copies of that buffer over the current background, enough copies to fill a region.

To draw the copies, we use either blitImage or drawImage. blitImage is faster, but only works if the current transformation is simple enough (no rotation, no skew, no reflection). Else we have to fallback to drawImage.

drawImage would generate the final pattern so that it colorizes a greyscale prototype while fetching the prototype via tilingBitmapSrc buffer accessor. blitImage on the other hand has no such accessor and therefore no color to colorize. But we can get the same result if we colorize the pattern prototype up front.

This commit rearranges the code so that we can decide blitImage vs. drawImage early enough to make color mode of the prototype and copying pattern color from former Splash dependent on that decision.

To test blitImage for uncolored tiling patterns, render PDFJS-8741-p1-patternscaling.pdf from #983 (closed).

To test drawImage for uncolored tiling patterns, render 745th page, Figure L.9 – Uncoloured tiling pattern from PDF32000_2008.pdf.

Fixes #983 (closed).

Merge request reports