diff options
Diffstat (limited to 'WebCore/platform/graphics/cg/ImageSourceCG.cpp')
-rw-r--r-- | WebCore/platform/graphics/cg/ImageSourceCG.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 08e8172..2bfc204 100644 --- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,15 @@ #include "config.h" #include "ImageSource.h" +#include "SharedBuffer.h" #if PLATFORM(CG) #include "IntSize.h" -#include "SharedBuffer.h" #include <ApplicationServices/ApplicationServices.h> namespace WebCore { -static const CFStringRef kCGImageSourceShouldPreferRGB32 = CFSTR("kCGImageSourceShouldPreferRGB32"); - ImageSource::ImageSource() : m_decoder(0) { @@ -54,13 +52,15 @@ void ImageSource::clear() } } +const CFStringRef kCGImageSourceShouldPreferRGB32 = CFSTR("kCGImageSourceShouldPreferRGB32"); + CFDictionaryRef imageSourceOptions() { static CFDictionaryRef options; if (!options) { - const void* keys[2] = { kCGImageSourceShouldCache, kCGImageSourceShouldPreferRGB32 }; - const void* values[2] = { kCFBooleanTrue, kCFBooleanTrue }; + const void *keys[2] = { kCGImageSourceShouldCache, kCGImageSourceShouldPreferRGB32 }; + const void *values[2] = { kCFBooleanTrue, kCFBooleanTrue }; options = CFDictionaryCreate(NULL, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); } @@ -154,20 +154,7 @@ size_t ImageSource::frameCount() const CGImageRef ImageSource::createFrameAtIndex(size_t index) { - CGImageRef image = CGImageSourceCreateImageAtIndex(m_decoder, index, imageSourceOptions()); - CFStringRef imageUTI = CGImageSourceGetType(m_decoder); - static const CFStringRef xbmUTI = CFSTR("public.xbitmap-image"); - if (!imageUTI || !CFEqual(imageUTI, xbmUTI)) - return image; - - // If it is an xbm image, mask out all the white areas to render them transparent. - const CGFloat maskingColors[6] = {255, 255, 255, 255, 255, 255}; - CGImageRef maskedImage = CGImageCreateWithMaskingColors(image, maskingColors); - if (!maskedImage) - return image; - - CGImageRelease(image); - return maskedImage; + return CGImageSourceCreateImageAtIndex(m_decoder, index, imageSourceOptions()); } bool ImageSource::frameIsCompleteAtIndex(size_t index) |