Skip to content
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

Group 'rectangle' operator into constructPath #4993

Merged
merged 1 commit into from
Jun 24, 2014

Conversation

pramodhkp
Copy link
Contributor

This groups the 'rectangle' operator into the constructPath operations (moveto, lineto, etc.), eliminating the same.

@yurydelendik
Copy link
Contributor

Can you change it to add to add rectange as is, and expand it to path on the other side. See you are removing logic that prevents rectangle from disappearing in the canvas.js, I would like to see this logic in the constructPath.

@yurydelendik
Copy link
Contributor

Also, change svg.js to not process rectangle operator.

self.buildPath(operatorList, OPS.lineTo, [x, y + height]);
self.buildPath(operatorList, OPS.lineTo, [x, y]);
self.buildPath(operatorList, OPS.closePath, []);
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall be continue; to not add that to the operator list

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @yurydelendik received. Current queue size: 1

Live output at: http://107.21.233.14:8877/251775e49b179a0/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/251775e49b179a0/output.txt

Total script time: 3.34 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/251775e49b179a0/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/e5941861c979c15/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/e5941861c979c15/output.txt

Total script time: 3.33 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/e5941861c979c15/reftest-analyzer.html#web=eq.log

@yurydelendik
Copy link
Contributor

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/35f9a06a7acefa6/output.txt

@timvandermeij
Copy link
Contributor

I can confirm Yury's observation. Page 13 of the Tracemonkey paper stops rendering: TypeError: graphics.rectangle is not a function.

var width = args[j++];
var height = args[j++];
var xw = x + width;
var yh = y + height;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move these two lines after if (height === 0) check

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/09974790dba8432/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/ee240ddda454488/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/09974790dba8432/output.txt

Total script time: 21.24 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/ee240ddda454488/output.txt

Total script time: 23.79 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

yurydelendik added a commit that referenced this pull request Jun 24, 2014
Combine re element into constructPath
@yurydelendik yurydelendik merged commit 6d5a041 into mozilla:master Jun 24, 2014
@yurydelendik
Copy link
Contributor

Thank you

@nnethercote
Copy link
Contributor

What was the motivation for this change? As far as I can tell it's a net pessimization. I'm looking at the operator lists for two large map PDFs and OPS.rectangle never appears in a sequence with any of the other path-building ops.

@pramodhkp
Copy link
Contributor Author

@nnethercote, If I understand correctly, this was made so that there wouldn't be a need for extra element, as it can be done within the element itself. Also, the PDF spec, explains rect as a series of movetos and linetos.

This might be an optimization for SVG. Not sure for canvas.

@nnethercote
Copy link
Contributor

The constructPath operation optimizes contiguous sequences of path operations. It's worthwhile because these sequences are often long, and so storing them together can save space, and they can be processed more quickly in a group. But for path operations that occur in isolation, it's a pessimization -- they take up slightly more space and are slightly slower to process. In practice, they occur in clusters so it's worthwhile overall. However, rectangle is an exception, because it appears to always occur in isolation, at least in the examples I've looked at.

The <path> and <rect> element stuff is orthogonal. You could do rectangles within a element without having to involve constructPath.

To be frank, this pull request is terrible. The description is empty, the commit message is absurdly short (and even uses "re" instead of "rect" or "rectangle"), there is no explanation of why the change is beneficial. It's not clear if it's an optimization or a functionality improvement, and if it is the former, there are no measurements. IMO it should not have been merged in this state.

@pramodhkp
Copy link
Contributor Author

Hmm, I guess @yurydelendik can explain the motivation behind this in a better manner, since it was his suggestion.

As for the PR, my bad. I will edit the name and description in a better way.

@pramodhkp pramodhkp changed the title Combine re element into constructPath Group 're' operator into constructPath Jul 3, 2014
@pramodhkp pramodhkp changed the title Group 're' operator into constructPath Group 'rectangle' operator into constructPath Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants