diff --git a/Meta/Lagom/Contrib/MacPDF/LagomPDFView.mm b/Meta/Lagom/Contrib/MacPDF/LagomPDFView.mm index d5cd106408..a72ea1a91d 100644 --- a/Meta/Lagom/Contrib/MacPDF/LagomPDFView.mm +++ b/Meta/Lagom/Contrib/MacPDF/LagomPDFView.mm @@ -44,16 +44,19 @@ static PDF::PDFErrorOr> render(PDF::Document& documen static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr bitmap_p) { auto& bitmap = bitmap_p.leak_ref(); - auto space = CGColorSpaceCreateDeviceRGB(); - CGBitmapInfo info = kCGBitmapByteOrder32Little | kCGImageAlphaFirst; + CGBitmapInfo info = kCGBitmapByteOrder32Little | (CGBitmapInfo)kCGImageAlphaFirst; auto data = CGDataProviderCreateWithData( &bitmap, bitmap.begin(), bitmap.size_in_bytes(), - [](void* p, void const*, size_t) { (void)adopt_ref(*reinterpret_cast(p)); }); + [](void* p, void const*, size_t) { + (void)adopt_ref(*reinterpret_cast(p)); + }); + auto space = CGColorSpaceCreateDeviceRGB(); auto cgbmp = CGImageCreate(bitmap.width(), bitmap.height(), 8, 32, bitmap.pitch(), space, info, data, nullptr, false, kCGRenderingIntentDefault); - auto* bmp = [[NSBitmapImageRep alloc] initWithCGImage:cgbmp]; CGColorSpaceRelease(space); + CGDataProviderRelease(data); + auto* bmp = [[NSBitmapImageRep alloc] initWithCGImage:cgbmp]; CGImageRelease(cgbmp); return bmp; }