Bug 951443 - Don't attempt to create 0x0-sized CGContexts when the UnboundnessFixer encounters an empty clip. r=jrmuizel

This commit is contained in:
Markus Stange 2014-01-08 10:31:17 +01:00
parent d7c5f41aa5
commit 41fb4612d8

View File

@ -247,13 +247,16 @@ class UnboundnessFixer
{ {
if (!IsOperatorBoundByMask(blend)) { if (!IsOperatorBoundByMask(blend)) {
mClipBounds = CGContextGetClipBoundingBox(baseCg); mClipBounds = CGContextGetClipBoundingBox(baseCg);
if (CGRectIsEmpty(mClipBounds)) {
return baseCg;
}
// TransparencyLayers aren't blended using the blend mode so // TransparencyLayers aren't blended using the blend mode so
// we are forced to use CGLayers // we are forced to use CGLayers
//XXX: The size here is in default user space units, of the layer relative to the graphics context. //XXX: The size here is in default user space units, of the layer relative to the graphics context.
// is the clip bounds still correct if, for example, we have a scale applied to the context? // is the clip bounds still correct if, for example, we have a scale applied to the context?
mLayer = CGLayerCreateWithContext(baseCg, mClipBounds.size, nullptr); mLayer = CGLayerCreateWithContext(baseCg, mClipBounds.size, nullptr);
//XXX: if the size is 0x0 we get a nullptr CGContext back from GetContext
mCg = CGLayerGetContext(mLayer); mCg = CGLayerGetContext(mLayer);
// CGContext's default to have the origin at the bottom left // CGContext's default to have the origin at the bottom left
// so flip it to the top left and adjust for the origin // so flip it to the top left and adjust for the origin