bool ImageDecoder::isSizeAvailable() const { // Ragnaros yells: TOO SOON! You have awakened me TOO SOON, Executus! if (CGImageSourceGetStatus(m_nativeDecoder.get()) < kCGImageStatusIncomplete) return false; RetainPtr<CFDictionaryRef> image0Properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_nativeDecoder.get(), 0, imageSourceOptions().get())); if (!image0Properties) return false; return CFDictionaryContainsKey(image0Properties.get(), kCGImagePropertyPixelWidth) && CFDictionaryContainsKey(image0Properties.get(), kCGImagePropertyPixelHeight); }
bool ImageSource::isSizeAvailable() { bool result = false; CGImageSourceStatus imageSourceStatus = CGImageSourceGetStatus(m_decoder); // Ragnaros yells: TOO SOON! You have awakened me TOO SOON, Executus! if (imageSourceStatus >= kCGImageStatusIncomplete) { RetainPtr<CFDictionaryRef> image0Properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions())); if (image0Properties) { CFNumberRef widthNumber = (CFNumberRef)CFDictionaryGetValue(image0Properties.get(), kCGImagePropertyPixelWidth); CFNumberRef heightNumber = (CFNumberRef)CFDictionaryGetValue(image0Properties.get(), kCGImagePropertyPixelHeight); result = widthNumber && heightNumber; } } return result; }