Closed Bug 1278441 Opened 8 years ago Closed 8 years ago

Add a CoreGraphics subclass of PrintTarget

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(1 file)

Add a CoreGraphics subclass of PrintTarget.
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+
Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d3695a07cbdc
Add a CoreGraphics subclass of PrintTarget. r=mstange
https://hg.mozilla.org/mozilla-central/rev/d3695a07cbdc
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: