1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #17978 from Snuffleupagus/pr-17428-followup

Extend the globally cached image main-thread copying to "complex" images as well (PR 17428 follow-up)
This commit is contained in:
Jonas Jenwald 2024-04-22 16:46:23 +02:00 committed by GitHub
commit 9e80c6d228
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 71 additions and 6 deletions

View file

@ -734,9 +734,9 @@ class PartialEvaluator {
// Inlining small images into the queue as RGB data
if (
isInline &&
w + h < SMALL_IMAGE_DIMENSIONS &&
!dict.has("SMask") &&
!dict.has("Mask") &&
w + h < SMALL_IMAGE_DIMENSIONS
!dict.has("Mask")
) {
try {
const imageObj = new PDFImage({
@ -796,10 +796,13 @@ class PartialEvaluator {
args = [objId, w, h];
operatorList.addImageOps(OPS.paintImageXObject, args, optionalContent);
// For large images, at least 500x500 in size, that we'll cache globally
// check if the image is still cached locally on the main-thread to avoid
// having to re-parse the image (since that can be slow).
if (cacheGlobally && w * h > 250000) {
// For large (at least 500x500) or more complex images that we'll cache
// globally, check if the image is still cached locally on the main-thread
// to avoid having to re-parse the image (since that can be slow).
if (
cacheGlobally &&
(w * h > 250000 || dict.has("SMask") || dict.has("Mask"))
) {
const localLength = await this.handler.sendWithPromise("commonobj", [
objId,
"CopyLocalImage",