Open Bug 1168934 Opened 5 years ago Updated 2 years ago
Draw Target For Surface can fail - what should we do?
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?
I'm all for allocating a small or dummy drawtarget and using that.
5 years ago
See Also: → 996351
(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.
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?
2 years ago
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.