Reviewed by Maciej
authorbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Jun 2006 07:35:01 +0000 (07:35 +0000)
committerbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Jun 2006 07:35:01 +0000 (07:35 +0000)
        Added functionality to WebCore::Image to get multiple representations/sizes into TIFF data

        * platform/mac/ImageMac.mm:
        (WebCore::Image::getTIFFRepresentation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/mac/ImageMac.mm

index 5382f063e8dad3931629ebf8ad3db571add02bfd..09927aa1607c7bff322fee08937d6d6a817622f3 100644 (file)
@@ -1,3 +1,12 @@
+2006-06-27  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Maciej
+
+        Added functionality to WebCore::Image to get multiple representations/sizes into TIFF data
+
+        * platform/mac/ImageMac.mm:
+        (WebCore::Image::getTIFFRepresentation):
+
 2006-06-26  David Hyatt  <hyatt@apple.com>
 
         Fix for 9538, support syntax highlighted HTML source.  Lots of loose
index 665563039402556e4dcbb06183267131b495a711..49976d120a555892a7400b19e37f24e3a48690ce 100644 (file)
@@ -157,19 +157,24 @@ CFDataRef Image::getTIFFRepresentation()
 {
     if (m_tiffRep)
         return m_tiffRep;
-
-    CGImageRef cgImage = frameAtIndex(0);
-    if (!cgImage)
-        return 0;
-   
+    
+    unsigned numFrames = frameCount();
     CFMutableDataRef data = CFDataCreateMutable(0, 0);
     // FIXME:  Use type kCGImageTypeIdentifierTIFF constant once is becomes available in the API
-    CGImageDestinationRef destination = CGImageDestinationCreateWithData(data, CFSTR("public.tiff"), 1, 0);
-    if (destination) {
+    CGImageDestinationRef destination = CGImageDestinationCreateWithData(data, CFSTR("public.tiff"), numFrames, 0);
+    if (!destination)
+        return 0;
+
+    for (unsigned i = 0; i < numFrames; ++i ) {
+        CGImageRef cgImage = frameAtIndex(i);
+        if (!cgImage) {
+            CFRelease(destination);
+            return 0;    
+        }
         CGImageDestinationAddImage(destination, cgImage, 0);
-        CGImageDestinationFinalize(destination);
-        CFRelease(destination);
     }
+    CGImageDestinationFinalize(destination);
+    CFRelease(destination);
 
     m_tiffRep = data;
     return m_tiffRep;