Closed Bug 1161147 Opened 9 years ago Closed 9 years ago

pdf.js canvas is not marked as opaque

Categories

(Firefox :: PDF Viewer, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Firefox 45
Tracking Status
firefox40 --- affected

People

(Reporter: mstange, Unassigned)

References

Details

(Whiteboard: [pdfjs-c-rendering][pdfjs-f-fixed-upstream] https://github.com/mozilla/pdf.js/pull/6551)

This is the reason that even with the patch for bug 1161122, pdf.js still won't have subpixel text AA on OS X after the switch to Skia.
(I don't know whether pdf.js has subpixel AA on Windows - I suspect not, because it will run into the same problem.)

There's this line in pdf.js:
> this.ctx.mozOpaque = true;

But this sets it on the context, so it has no effect. It needs to be set on the canvas.

If I change it to
> this.ctx.canvas.mozOpaque = true;
then Gecko correctly allocates an opaque surface for it. However, the resulting transform on the canvas is wrong: On a HiDPI display, all pages are rendered at half the size in the top left corner of the page.
I suspect that this is because changing mozOpaque destroys the surface that backs the canvas, along with the existing transform on it. PDF.js needs to anticipate that and set its HiDPI transform again afterwards.

(Unlike the setters of canvas.width/.height, mozOpaque has the bad behavior that it only throws away the existing state if its value actually changes. Maybe it should just always throw it away, so that it's more predictable for the user.)
Priority: -- → P3
Whiteboard: [pdfjs-c-rendering]
Status: NEW → RESOLVED
Closed: 9 years ago
Depends on: 1226621
Resolution: --- → FIXED
Whiteboard: [pdfjs-c-rendering] → [pdfjs-c-rendering][pdfjs-f-fixed-upstream] https://github.com/mozilla/pdf.js/pull/6551
Target Milestone: --- → Firefox 45
You need to log in before you can comment on or make changes to this bug.