From 2bba863937087e9bd67c9aa9e59c3b1f69096314 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 30 Sep 2019 23:17:33 +0200 Subject: [PATCH] Get rid of unnecessary variables We can pass NULL argument directly to CGBitmapContextCreate() and using a temporary variable holding NULL is not necessary. --- src/osx/core/bitmap.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 3f1d177f56..76a5ac9bb4 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -236,16 +236,15 @@ bool wxBitmapRefData::Create(CGImageRef image, double scale) m_scaleFactor = scale; size_t m_bytesPerRow = GetBestBytesPerRow(m_width * 4); - void* data = NULL; CGImageAlphaInfo alpha = CGImageGetAlphaInfo(image); if (alpha == kCGImageAlphaNone || alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast) { - m_hBitmap = CGBitmapContextCreate((char*)data, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst); + m_hBitmap = CGBitmapContextCreate(NULL, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst); } else { - m_hBitmap = CGBitmapContextCreate((char*)data, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); + m_hBitmap = CGBitmapContextCreate(NULL, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); } CGRect rect = CGRectMake(0, 0, m_width, m_height); CGContextDrawImage(m_hBitmap, rect, image); @@ -283,8 +282,7 @@ bool wxBitmapRefData::Create(int w, int h, int WXUNUSED(d), double logicalscale) m_hBitmap = NULL; size_t m_bytesPerRow = GetBestBytesPerRow(m_width * 4); - void* data = NULL; - m_hBitmap = CGBitmapContextCreate((char*)data, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst); + m_hBitmap = CGBitmapContextCreate(NULL, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst); wxASSERT_MSG(m_hBitmap, wxT("Unable to create CGBitmapContext context")); CGContextTranslateCTM(m_hBitmap, 0, m_height); CGContextScaleCTM(m_hBitmap, 1 * GetScaleFactor(), -1 * GetScaleFactor());