Open Bug 1168934 Opened 9 years ago Updated 2 years ago

CreateDrawTargetForSurface can fail - what should we do?

Categories

(Core :: Graphics, defect, P3)

41 Branch
Unspecified
All
defect

Tracking

()

Tracking Status
firefox41 --- affected

People

(Reporter: milan, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [gfx-noted])

In bug 1140113, we try to deal with the fallout from CreateDrawTarget failing; it turns out CreateDrawTargetSurface can fail as well (size 0,0 will do it, see bug 1019063, for an example.)

The question - what do we do?  Let it fail, and protect against it in the callers, or don't let it fail, by, say, creating a surface sized 1,1, and crashing if that fails, or something yet different?
Jeff, thoughts?
Flags: needinfo?(jmuizelaar)
I'm all for allocating a small or dummy drawtarget and using that.
Flags: needinfo?(jmuizelaar)
(In reply to Jeff Muizelaar [:jrmuizel] from comment #2)
> I'm all for allocating a small or dummy drawtarget and using that.

Canvas already has the concept of an 'error drawtarget' we could move that to gfxPlatform and use that and in callers that really need something use it. I'm not in favor of making CreateDrawTarget do it directly as I feel this might cause us to miss issues in parts of the code where DT creation really isn't expected to fail, and when it is it's a sign we're unable to render, in those parts we want to be aware of any issues.

If we really want to I can live with creating an 'CreateDrawTargetInfallible' function that is non-fallible in Moz2D, and that users that might sometimes expect failures can use. In theory we could also make that return a 'DrawTargetNull' which is a no-op implementation of the DrawTarget API, which can make us truly infallible. But I'm not sure whether that's worth it.
Whiteboard: [gfx-noted]
If we resolve this bug, we will want to check if we still need:
MOZ_CRASH("Cannot CreateDrawTargetForSurface");
introduced in bug 1019063.
Summary: CreateDrawTargetSurface can fail - what should we do? → CreateDrawTargetForSurface can fail - what should we do?
Blocks: 1276536
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.