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

Ensure that the result of |constructStichedFromIRResult| is a number (issue 6113) #6114

Merged
merged 1 commit into from
Jun 15, 2015
Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Fixes #6113.

It appears that when we switched to using Float32Array (in PR #5134), we may now occasionally encounter rounding errors, which cause the result to become NaN thus leading to incorrect rendering.

tmpBuf[0] = rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
// Ensure that this is always a valid number, since rounding errors
// may cause it to become NaN (fixes issue6113.pdf).
tmpBuf[0] = (rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin)) || 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shall return value in range from rmin..rmax, can we use rmin + (((v - dmin) * (rmax - rmin) / (dmax - dmin)) || 0); here?

Also, it might be useful to check for 0 before div, e.g. dmax === dmin and return 0, e.g. dmax === dmin ? rmin : (rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Really good point, thanks! I'll update the patch to clamp the value to the range of the function.

@Snuffleupagus Snuffleupagus changed the title Ensure that the result of |constructStichedFromIRResult| is a number (issue 6113) Ensure that the result of |constructStichedFromIRResult| is within the range of the function (issue 6113) Jun 14, 2015
@Snuffleupagus Snuffleupagus changed the title Ensure that the result of |constructStichedFromIRResult| is within the range of the function (issue 6113) Ensure that the result of |constructStichedFromIRResult| is a number (issue 6113) Jun 14, 2015
@Snuffleupagus
Copy link
Collaborator Author

The one time that I don't bother testing locally before pushing a patch, since I figured it's probably fine anyway, I obviously break something. :-(
Unsurprisingly I should just have done what Yury suggested right away. Anyway, a new and locally tested patch has been pushed. Sorry about the wasted time/testing here!

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/88c7b0f6339cb78/output.txt

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/5ea1692f55feb48/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 18.13 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/5ea1692f55feb48/output.txt

Total script time: 18.18 mins

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

@timvandermeij
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 17.93 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

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

Total script time: 18.39 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

timvandermeij added a commit that referenced this pull request Jun 15, 2015
Ensure that the result of |constructStichedFromIRResult| is a number (issue 6113)
@timvandermeij timvandermeij merged commit d7e6490 into mozilla:master Jun 15, 2015
@timvandermeij
Copy link
Contributor

Nice, thanks!

@Snuffleupagus Snuffleupagus deleted the issue-6113 branch June 15, 2015 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants