Bug 245664 - [CG] A large PDFDocumentImage may be displayed pixelated
Summary: [CG] A large PDFDocumentImage may be displayed pixelated
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on: 251641
Blocks:
  Show dependency treegraph
 
Reported: 2022-09-26 01:30 PDT by Said Abou-Hallawa
Modified: 2023-04-18 11:06 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2022-09-26 01:30:17 PDT
Drawing a sub-rectangle of PDFDocumentImage can be expensive because the whole image has to be displayed. PDFDocumentImage tries to cache a viewport of the last source displayed rectangle. The viewport is a bigger rectangle which includes the source rectangle. The goal of caching the viewport is to reuse it as many times as possible and not to draw the image itself. The calculations and the transformation to create, draw and reuse the viewport is very complex and fragile.

The solution is to clean up this code by introducing a new class called ImageViewport. This class will be responsible of creating a viewport ImageBuffer, drawing the source rectangle of the image to the viewport ImageBuffer and drawing this buffer to the destination GraphicsContext. The calculations can be simplified such that the resolution of the viewport ImageBuffer matches the effective resolution of the destination GraphicsContext.
Comment 1 Said Abou-Hallawa 2022-09-26 01:30:44 PDT
rdar://97254192
Comment 2 Said Abou-Hallawa 2022-09-26 02:07:40 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4700
Comment 3 EWS 2023-02-06 17:17:55 PST
Committed 259928@main (8382d4d3c6e3): <https://commits.webkit.org/259928@main>

Reviewed commits have been landed. Closing PR #4700 and removing active labels.