$OpenBSD$ index 10aa9a7..6878bb2 100644 --- widget/cocoa/nsCocoaUtils.mm.orig Fri Feb 20 15:40:39 2015 +++ widget/cocoa/nsCocoaUtils.mm Fri Feb 20 15:40:39 2015 @@ -400,12 +400,19 @@ nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, ui int scaledWidth = (int)ceilf(width * scaleFactor); int scaledHeight = (int)ceilf(height * scaleFactor); - nsRefPtr frame = - new gfxImageSurface(gfxIntSize(scaledWidth, scaledHeight), gfxImageFormat::ARGB32); - NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); + RefPtr drawTarget = gfxPlatform::GetPlatform()-> + CreateOffscreenContentDrawTarget(IntSize(scaledWidth, scaledHeight), + SurfaceFormat::B8G8R8A8); + if (!drawTarget) { + NS_ERROR("Failed to create DrawTarget"); + return NS_ERROR_FAILURE; + } - nsRefPtr context = new gfxContext(frame); - NS_ENSURE_TRUE(context, NS_ERROR_FAILURE); + nsRefPtr context = new gfxContext(drawTarget); + if (!context) { + NS_ERROR("Failed to create gfxContext"); + return NS_ERROR_FAILURE; + } aImage->Draw(context, GraphicsFilter::FILTER_NEAREST, gfxMatrix(), gfxRect(0.0f, 0.0f, scaledWidth, scaledHeight), @@ -413,8 +420,7 @@ nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, ui nsIntSize(scaledWidth, scaledHeight), nullptr, aWhichFrame, imgIContainer::FLAG_SYNC_DECODE); - surface = - gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, frame); + surface = drawTarget->Snapshot(); } else { surface = aImage->GetFrame(aWhichFrame, imgIContainer::FLAG_SYNC_DECODE); }