Closed Bug 980472 Opened 10 years ago Closed 10 years ago

Make SurfaceToPackedBGRA take a DataSourceSurface to avoid unnecessary surface conversion

Categories

(Core :: Graphics, defect)

29 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: jwatt, Assigned: jwatt)

Details

Attachments

(1 file)

Right now callers of SurfaceToPackedBGRA that happen to have a DataSourceSurface end up having GetDataSurface called on that surface by SurfaceToPackedBGRA. Since bug 943614 that involves a second, unnecessary conversion (to type DATA) for certain backends. We should have callers do the GetDataSurface call as necessary and pass a DataSourceSurface so that we're not doing an extra conversion for callers that already have a DataSourceSurface.
Attached patch patchSplinter Review
Attachment #8386971 - Flags: review?(bas)
There's only one caller currently, and that already passes a DataSourceSurface. Another patch that I have that adds a second caller also does the same.
Attachment #8386971 - Flags: review?(bas) → review+
https://hg.mozilla.org/mozilla-central/rev/2ac59d28974c
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
(In reply to Jonathan Watt [:jwatt] from comment #0)
> Right now callers of SurfaceToPackedBGRA that happen to have a
> DataSourceSurface end up having GetDataSurface called on that surface by
> SurfaceToPackedBGRA. Since bug 943614 that involves a second, unnecessary
> conversion (to type DATA) for certain backends.

FWIW I'm told that this is wrong. The "second" call will just create a very lightweight wrapper for which GetType()==DATA, and that has virtually no overhead. That said, it's still good to have callers know that the call involves converting to a data SourceSurface (has readback overhead, potentially), so this is still not a bad change.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: