Closed Bug 1231864 Opened 9 years ago Closed 9 years ago

De-weirdify GetCairo() and its uses

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Attachments

(2 files, 1 obsolete file)

GetCairo()'s an odd function, in that it gets the current DrawTarget's cairo_t if it uses a Cairo backend, and falls back to the refCairo (which has a 1x1 surface) otherwise. Some of the callsites rely on the non-fallback behaviour. This bug is about clarifying and simplifying this a bit.
GetCairo() never returns null so testing its result like this is pointless.
Attachment #8697459 - Flags: review?(matt.woodrow)
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
This patch inlines the CurrentSurface() and GetDCWithClip() calls in BeginNativeDrawing(). This allows them to share a single |cairo_t*| and gets rid of the GetCairo() call in GetDCWithClip(), which was one of those confusing ones that only made sense if its a Cairo backend. The patch also inverts the sense of mDeviceOffset, and changes its type from gfxPoint to Point.
Attachment #8697461 - Flags: review?(matt.woodrow)
This is a cut down version of part 1 from bug 1231550. It avoids one GetCairo() calls.
Attachment #8697463 - Flags: review?(jfkthame)
Attachment #8697459 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8697461 [details] [diff] [review] (part 2) - Clean up gfxWindowsNativeDrawing::BeginNativeDrawing() Review of attachment 8697461 [details] [diff] [review]: ----------------------------------------------------------------- It would be nice to do a follow up that removes gfxASurface usage from this too. It looks like we check GetType, GetContentType, MarkDirty and GetAsImageSurface on surf/mWinSurface/mBackSurface/mWhiteSurface. Those should all be fairly easy inlined.
Attachment #8697461 - Flags: review?(matt.woodrow) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/747868feec5183a7bdea401472dce1dcdc31d137 Bug 1231864 (part 1) - Remove useless GetCairo() call in gfxWindowsNativeDrawing::BeginNativeDrawing(). r=mattwoodrow. https://hg.mozilla.org/integration/mozilla-inbound/rev/5d48e09f0d179ab78efec9cca157e6f2aee09c16 Bug 1231864 (part 2) - Clean up gfxWindowsNativeDrawing::BeginNativeDrawing(). r=mattwoodrow.
Attachment #8697459 - Flags: checkin+
Attachment #8697461 - Flags: checkin+
Still waiting for review on part 3.
Keywords: leave-open
Comment on attachment 8697463 [details] [diff] [review] (part 3) - Pass a cairo_t* to GetSVGGlyphExtents() I'll move this patch to another bug.
Attachment #8697463 - Attachment is obsolete: true
Attachment #8697463 - Flags: review?(jfkthame)
Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: