diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm index 26aeb8a2c54b..3f87574eaaed 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm @@ -28,10 +28,13 @@ { //============================================================================== -class CoreGraphicsImage : public ImagePixelData +// This class has been renamed from CoreGraphicsImage to avoid a symbol +// collision in Pro Tools 2019.12 and possibly 2020 depending on the Pro Tools +// release schedule. +class CoreGraphicsPixelData : public ImagePixelData { public: - CoreGraphicsImage (const Image::PixelFormat format, int w, int h, bool clearImage) + CoreGraphicsPixelData (const Image::PixelFormat format, int w, int h, bool clearImage) : ImagePixelData (format, w, h) { pixelStride = format == Image::RGB ? 3 : ((format == Image::ARGB) ? 4 : 1); @@ -57,7 +60,7 @@ CGColorSpaceRelease (colourSpace); } - ~CoreGraphicsImage() override + ~CoreGraphicsPixelData() override { freeCachedImageRef(); CGContextRelease (context); @@ -86,7 +89,7 @@ void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, Image::Bitma ImagePixelData::Ptr clone() override { - auto im = new CoreGraphicsImage (pixelFormat, width, height, false); + auto im = new CoreGraphicsPixelData (pixelFormat, width, height, false); memcpy (im->imageDataHolder->data, imageDataHolder->data, (size_t) (lineStride * height)); return *im; } @@ -96,7 +99,7 @@ void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, Image::Bitma //============================================================================== static CGImageRef getCachedImageRef (const Image& juceImage, CGColorSpaceRef colourSpace) { - auto cgim = dynamic_cast (juceImage.getPixelData()); + auto cgim = dynamic_cast (juceImage.getPixelData()); if (cgim != nullptr && cgim->cachedImageRef != nullptr) { @@ -127,7 +130,7 @@ static CGImageRef createImage (const Image& juceImage, CGColorSpaceRef colourSpa { auto* imageDataContainer = [](const Image& img) -> HeapBlockContainer::Ptr* { - if (auto* cgim = dynamic_cast (img.getPixelData())) + if (auto* cgim = dynamic_cast (img.getPixelData())) return new HeapBlockContainer::Ptr (cgim->imageDataHolder); return nullptr; @@ -183,12 +186,12 @@ static CGBitmapInfo getCGImageFlags (const Image::PixelFormat& format) #endif } - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreGraphicsImage) + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreGraphicsPixelData) }; ImagePixelData::Ptr NativeImageType::create (Image::PixelFormat format, int width, int height, bool clearImage) const { - return *new CoreGraphicsImage (format == Image::RGB ? Image::ARGB : format, width, height, clearImage); + return *new CoreGraphicsPixelData (format == Image::RGB ? Image::ARGB : format, width, height, clearImage); } //============================================================================== @@ -326,7 +329,7 @@ static CGBitmapInfo getCGImageFlags (const Image::PixelFormat& format) if (sourceImage.getFormat() != Image::SingleChannel) singleChannelImage = sourceImage.convertedToFormat (Image::SingleChannel); - CGImageRef image = CoreGraphicsImage::createImage (singleChannelImage, greyColourSpace, true); + CGImageRef image = CoreGraphicsPixelData::createImage (singleChannelImage, greyColourSpace, true); flip(); auto t = AffineTransform::verticalFlip (sourceImage.getHeight()).followedBy (transform); @@ -524,7 +527,7 @@ static CGBitmapInfo getCGImageFlags (const Image::PixelFormat& format) auto colourSpace = sourceImage.getFormat() == Image::PixelFormat::SingleChannel ? greyColourSpace : rgbColourSpace; - CGImageRef image = CoreGraphicsImage::getCachedImageRef (sourceImage, colourSpace); + CGImageRef image = CoreGraphicsPixelData::getCachedImageRef (sourceImage, colourSpace); CGContextSaveGState (context); CGContextSetAlpha (context, state->fillType.getOpacity()); @@ -887,8 +890,8 @@ Image image (NativeImageType().create (Image::ARGB, // (CoreImage doesn't work w (int) CGImageGetHeight (loadedImage), hasAlphaChan)); - auto cgImage = dynamic_cast (image.getPixelData()); - jassert (cgImage != nullptr); // if USE_COREGRAPHICS_RENDERING is set, the CoreGraphicsImage class should have been used. + auto cgImage = dynamic_cast (image.getPixelData()); + jassert (cgImage != nullptr); // if USE_COREGRAPHICS_RENDERING is set, the CoreGraphicsPixelData class should have been used. CGContextDrawImage (cgImage->context, convertToCGRect (image.getBounds()), loadedImage); CGContextFlush (cgImage->context); @@ -912,7 +915,7 @@ Image image (NativeImageType().create (Image::ARGB, // (CoreImage doesn't work w Image juce_createImageFromCIImage (CIImage*, int, int); Image juce_createImageFromCIImage (CIImage* im, int w, int h) { - auto cgImage = new CoreGraphicsImage (Image::ARGB, w, h, false); + auto cgImage = new CoreGraphicsPixelData (Image::ARGB, w, h, false); CIContext* cic = [CIContext contextWithCGContext: cgImage->context options: nil]; [cic drawImage: im inRect: CGRectMake (0, 0, w, h) fromRect: CGRectMake (0, 0, w, h)]; @@ -924,12 +927,12 @@ Image juce_createImageFromCIImage (CIImage* im, int w, int h) CGImageRef juce_createCoreGraphicsImage (const Image& juceImage, CGColorSpaceRef colourSpace, const bool mustOutliveSource) { - return CoreGraphicsImage::createImage (juceImage, colourSpace, mustOutliveSource); + return CoreGraphicsPixelData::createImage (juceImage, colourSpace, mustOutliveSource); } CGContextRef juce_getImageContext (const Image& image) { - if (auto cgi = dynamic_cast (image.getPixelData())) + if (auto cgi = dynamic_cast (image.getPixelData())) return cgi->context; jassertfalse;