Add a CoreGraphics subclass of PrintTarget

RESOLVED FIXED in Firefox 50

Status

()

Core
Graphics
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: jwatt, Assigned: jwatt)

Tracking

unspecified
mozilla50
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox50 fixed)

Details

Attachments

(1 attachment)

Add a CoreGraphics subclass of PrintTarget.
Created attachment 8760540 [details] [diff] [review]
patch - needs memory reporting, but otherwise works
(Assignee)

Updated

2 years ago
Attachment #8760540 - Flags: review?(mstange)
Comment on attachment 8760540 [details] [diff] [review]
patch - needs memory reporting, but otherwise works

Review of attachment 8760540 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/thebes/PrintTargetCG.cpp
@@ +20,5 @@
> +                             const IntSize& aSize)
> +  : PrintTarget(aCairoSurface, aSize)
> +  , mCGContext(cairo_quartz_surface_get_cg_context(aCairoSurface))
> +{
> +  CGContextRetain(mCGContext);

Why is this necessary? Shouldn't the cairo surface keep the context alive? And shouldn't PrintTarget addref/release the cairo surface?
Attachment #8760540 - Flags: review?(mstange)
(In reply to Markus Stange [:mstange] from comment #2)
> Why is this necessary? Shouldn't the cairo surface keep the context alive?

Yeah, the cairo surface will keep it alive so it's not necessary. I'll remove the CGContextRetain/CGContextRelease calls. In fact I suppose I can remove the mCGContext member completely. I have this stuff in the patch because gfxQuartsSurface is doing that, but it seems unnecessary there too.

> And shouldn't PrintTarget addref/release the cairo surface?

The ownership of the cairo surface is handed over to the PrintTarget ctor, so it doesn't call cairo_surface_reference. This is documented here:

https://mxr.mozilla.org/mozilla-central/source/gfx/thebes/PrintTarget.cpp#28

The PrintTarget dtor does the cairo_surface_destroy call.
Comment on attachment 8760540 [details] [diff] [review]
patch - needs memory reporting, but otherwise works

Review of attachment 8760540 [details] [diff] [review]:
-----------------------------------------------------------------

Ok, sounds good! r+ with the Retain/Release calls removed then.
Attachment #8760540 - Flags: review+

Comment 5

2 years ago
Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d3695a07cbdc
Add a CoreGraphics subclass of PrintTarget. r=mstange

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/d3695a07cbdc
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox50: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.