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

Introduce paintSolidColorImageMask command to handle 1x1 solid image #4474

Merged
merged 2 commits into from
Mar 19, 2014

Conversation

chriskr
Copy link
Contributor

@chriskr chriskr commented Mar 17, 2014

Fixes #4436

@yurydelendik
Copy link
Contributor

Awesome patch. Looks like it's a special case of fillRect. Using too much getImageData will slow down stuff on the main thread. Let's recognize 1x1 image pattern on the worker thread on convert that into (e.g. fillRect or something) -- we can get the color there without painting on the canvas. Could you check if you can add that to the https://github.com/mozilla/pdf.js/blob/master/src/core/evaluator.js#L1706 and introduce paintSolidColorImage command on the canvas?

@chriskr
Copy link
Contributor Author

chriskr commented Mar 17, 2014

Ok, will look into that.

@chriskr
Copy link
Contributor Author

chriskr commented Mar 18, 2014

Pushed an according fix. If that is ok i can squash the two commits to one.

@yurydelendik yurydelendik changed the title Patching CanvasRenderingContext2D.prototype.drawImage Introduce paintSolidColorImageMask command to handle 1x1 solid image Mar 19, 2014
@yurydelendik
Copy link
Contributor

Awesome, thanks

/botio test

@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/1b7b2dd7db23ca3/output.txt

@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/69c1037c64a7d80/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/1b7b2dd7db23ca3/output.txt

Total script time: 25.82 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/69c1037c64a7d80/output.txt

Total script time: 37.75 mins

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

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

@chriskr
Copy link
Contributor Author

chriskr commented Mar 19, 2014

The failing tests on Chrome are expected, Blink engine doesn't handle drawing lines with drawImage well (http://chriskr.github.io/tests/canvas-draw-line-with-image.html). About the failing tests on Firefox, i don't know, worked here locally without any errors. The differences seem to be minimal.

@yurydelendik
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

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

Total script time: 25.95 mins

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 36.51 mins

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

yurydelendik added a commit that referenced this pull request Mar 19, 2014
Introduce paintSolidColorImageMask command to handle 1x1 solid image
@yurydelendik yurydelendik merged commit 1801fb2 into mozilla:master Mar 19, 2014
@yurydelendik
Copy link
Contributor

thank you for the patch

@chriskr
Copy link
Contributor Author

chriskr commented Mar 19, 2014

You're welcome :)

@chriskr chriskr deleted the draw-image-subpixel-support branch April 10, 2014 10:58
@@ -2128,6 +2128,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
}
},

paintSolidColorImageMask:
function CanvasGraphics_paintSolidColorImageMask() {
this.ctx.fillRect(0, 0, 1, 1);
Copy link

Choose a reason for hiding this comment

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

This line causes rendering problems on Firefox (v. 32, Ubuntu 14.04):

screenshot from 2014-10-06 14 21 14

If I change it to:

this.ctx.fillStyle = 'transparent';
this.ctx.fillRect(0, 0, 1, 1);

the problem with the black boxes is solved, but that would defeat the purpose of this commit. Any suggestions here?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's defect in Firefox 32 for Linux only. See https://bugzilla.mozilla.org/show_bug.cgi?id=1050788

Copy link
Contributor

Choose a reason for hiding this comment

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

couldnt we eliminate the rendering of transparent items at all?

Copy link
Contributor

Choose a reason for hiding this comment

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

@CodingFabian, color is set to black so it's not transparent. See source code of the minimal test case https://bug1050788.bugzilla.mozilla.org/attachment.cgi?id=8470100 that demonstrates issue with Firefox 32 for Linux.

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.

Math generated by LaTeX not rendered correctly
5 participants