Open Bug 1071796 Opened 10 years ago Updated 2 years ago

Stop using cairo quartz for printing on OS X

Categories

(Core :: Graphics, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: jrmuizel, Unassigned)

References

Details

* frame #0: 0x0000000103f17980 XUL`_moz_cairo_quartz_surface_create
    frame #1: 0x0000000102636517 XUL`gfxQuartzSurface::gfxQuartzSurface(gfxSize const&, gfxImageFormat, bool) + 183
    frame #2: 0x0000000103128a0c XUL`nsDeviceContextSpecX::GetSurfaceForPrinter(gfxASurface**) + 268
    frame #3: 0x000000010254bde5 XUL`nsDeviceContext::InitForPrinting(nsIDeviceContextSpec*) + 85
    frame #4: 0x000000010389c973 XUL`nsPrintEngine::DoCommonPrint(bool, nsIPrintSettings*, nsIWebProgressListener*, nsIDOMDocument*) + 2291
    frame #5: 0x000000010389bfaf XUL`nsPrintEngine::CommonPrint(bool, nsIPrintSettings*, nsIWebProgressListener*, nsIDOMDocument*) + 47
    frame #6: 0x000000010389e53e XUL`nsPrintEngine::Print(nsIPrintSettings*, nsIWebProgressListener*) + 94
    frame #7: 0x000000010363c908 XUL`nsDocumentViewer::Print(nsIPrintSettings*, nsIWebProgressListener*)
Depends on: 1072533
Notes from when I looked at this earlier today:

 - nsDeviceContext calls BeginPage/EndPage both on the gfxASurface and on the nsDeviceContextSpec instance.
 - On Mac, the former does nothing, and on other platforms the latter does nothing.
 - Mac is different because on Mac each page has its own CGContext.
 - On Mac, nsDeviceContextSpecX::BeginPage/EndPage does the actual work. It operates on a PMSession object.
 - After each call to nsDeviceContextSpecX::BeginPage, a new surface with the new page's CGContext is
   retrieved from the PMSession.

Proposed way forward:
 - Add DrawTarget::BeginPage/EndPage, implement it like gfxASurface::BeginPage/EndPage, including making it a no-op on Mac.
 - Keep the rest of the behavior and just use a DrawTarget in place of a gfxASurface.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.