mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1028491: Try to create a reasonable size surface when surface creation fails, otherwise OOM abort. r=jrmuizel
This commit is contained in:
parent
2925d0ee01
commit
cdab073abf
@ -2278,9 +2278,21 @@ gfxContext::PushNewDT(gfxContentType content)
|
||||
clipBounds.width = std::max(1.0f, clipBounds.width);
|
||||
clipBounds.height = std::max(1.0f, clipBounds.height);
|
||||
|
||||
SurfaceFormat format = gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content);
|
||||
|
||||
RefPtr<DrawTarget> newDT =
|
||||
mDT->CreateSimilarDrawTarget(IntSize(int32_t(clipBounds.width), int32_t(clipBounds.height)),
|
||||
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content));
|
||||
format);
|
||||
|
||||
if (!newDT) {
|
||||
NS_WARNING("Failed to create DrawTarget of sufficient size.");
|
||||
newDT = mDT->CreateSimilarDrawTarget(IntSize(64, 64), format);
|
||||
|
||||
if (!newDT) {
|
||||
// If even this fails.. we're most likely just out of memory!
|
||||
NS_ABORT_OOM(BytesPerPixel(format) * 64 * 64);
|
||||
}
|
||||
}
|
||||
|
||||
Save();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user