-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logic to track rendering area of various PDF ops #19043
Draft
nicolo-ribaudo
wants to merge
6
commits into
mozilla:master
Choose a base branch
from
nicolo-ribaudo:compute-bounding-boxes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add logic to track rendering area of various PDF ops #19043
nicolo-ribaudo
wants to merge
6
commits into
mozilla:master
from
nicolo-ribaudo:compute-bounding-boxes
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nicolo-ribaudo
commented
Nov 14, 2024
nicolo-ribaudo
force-pushed
the
compute-bounding-boxes
branch
3 times, most recently
from
November 14, 2024 15:43
355758e
to
2475b16
Compare
This commit is a first step towards mozilla#6419, and it can also help with mozilla#13287. To support rendering _part_ of a page, we will need to first compute which ops can affect what is visible in that part of the page. This commit adds logic to track "group of ops" with their respective bounding boxes. Each group eather corresponds to a single op or to a range, and it can have dependencies earlier in the ops list that are not contiguous to the range. Consider the following example: ``` 0. setFillRGBColor 1. beginText 2. showText "Hello" 3. endText 4. constructPath [...] 5. eoFill ``` here we have two groups: the text (range 1-3) and the path (range 4-5). Each of them has a corresponding bounding box, and a dependency on the op at index 0. This tracking happens when first rendering a PDF: we wrap the canvas with a "canvas recorder" that has the same API, but with additional methods to mark the start/end of a group.
When using the pdf debugger, when hovering over a step now: - it highlights the steps in the same groups - it highlights the steps that they depend on - it highlights on the PDF itself the bounding box
nicolo-ribaudo
force-pushed
the
compute-bounding-boxes
branch
from
November 14, 2024 15:54
2475b16
to
5a6a877
Compare
change the various methods in canvas.js to receive the index as a param, rather than returning a function that takes the index
clean up the "dependencies tracking", since currently it's all over the place. Move most of the logic to CanvasRecorder, so that when not recording it doesn't have a performance impact.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I started working towards #6419. This PR introduces the logic to track where different elements of the PDF are rendered, and hooks it up to the debugger since @calixteman mentioned that it would be useful.
I'm marking this as draft because there are a few changes I need to make:
canvas.js
to receive the index as a param, rather than returning a function that takes the indexCanvasRecorder
, so that when not recording it doesn't have a performance impact.However, I'd love to receive feedback on the direction.
Commit 1:
Commit 2:
This is an example of what the debugger integration looks like (note: I couldn't figure out how to make my cursor show up in the recording 😅 I'm moving it over the steps list):
Screen.Recording.2024-11-14.at.16.35.58.mov
By default it doesn't show all the bounding boxes because on some PDFs it's too much noise, but if you click on the checkbox then it shows the boxes and you can click on a box to scroll into view the corresponding ops.