Changeset 85697 in webkit


Ignore:
Timestamp:
May 3, 2011 5:38:54 PM (13 years ago)
Author:
beidson@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=60087 and <rdar://problem/9373182>
WK2 Icon Database should provide access to all image representations in the icon.

Reviewed by Sam Weinig.

../WebCore:

Add an accessor for CG platforms to get a CFArrayRef of all the CGImageRefs represented:

  • platform/graphics/BitmapImage.h:
  • platform/graphics/Image.h:

(WebCore::Image::getCGImageArray):

  • platform/graphics/cg/ImageCG.cpp:

(WebCore::BitmapImage::getCGImageArray):

../WebKit2:

Expose a CFArrayRef of CGImageRefs as API for CG platforms:

  • UIProcess/API/C/cg/WKIconDatabaseCG.cpp:

(WKIconDatabaseTryCopyCGImageArrayForURL):

  • UIProcess/API/C/cg/WKIconDatabaseCG.h:
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85695 r85697  
     12011-05-03  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=60087 and <rdar://problem/9373182>
     6        WK2 Icon Database should provide access to all image representations in the icon.
     7
     8        Add an accessor for CG platforms to get a CFArrayRef of all the CGImageRefs represented:
     9        * platform/graphics/BitmapImage.h:
     10        * platform/graphics/Image.h:
     11        (WebCore::Image::getCGImageArray):
     12        * platform/graphics/cg/ImageCG.cpp:
     13        (WebCore::BitmapImage::getCGImageArray):
     14
    1152011-05-03  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r84321 r85697  
    143143    virtual CGImageRef getCGImageRef();
    144144    virtual CGImageRef getFirstCGImageRefOfSize(const IntSize&);
     145    virtual RetainPtr<CFArrayRef> getCGImageArray();
    145146#endif
    146147
  • trunk/Source/WebCore/platform/graphics/Image.h

    r84101 r85697  
    3737#include <wtf/RefCounted.h>
    3838#include <wtf/RefPtr.h>
     39#include <wtf/RetainPtr.h>
    3940
    4041#if PLATFORM(MAC)
     
    140141    virtual CGImageRef getCGImageRef() { return 0; }
    141142    virtual CGImageRef getFirstCGImageRefOfSize(const IntSize&) { return 0; }
     143    virtual RetainPtr<CFArrayRef> getCGImageArray() { return 0; }
    142144#endif
    143145
  • trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp

    r85036 r85697  
    3737#include "PlatformString.h"
    3838#include <ApplicationServices/ApplicationServices.h>
     39#include <CoreFoundation/CFArray.h>
    3940#include <wtf/RetainPtr.h>
    4041
     
    168169}
    169170
     171RetainPtr<CFArrayRef> BitmapImage::getCGImageArray()
     172{
     173    size_t count = frameCount();
     174    if (!count)
     175        return 0;
     176   
     177    CFMutableArrayRef array = CFArrayCreateMutable(NULL, count, &kCFTypeArrayCallBacks);
     178    for (size_t i = 0; i < count; ++i)
     179        CFArrayAppendValue(array, frameAtIndex(i));
     180       
     181    return RetainPtr<CFArrayRef>(AdoptCF, array);
     182}
     183
    170184void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp)
    171185{
  • trunk/Source/WebKit2/ChangeLog

    r85689 r85697  
     12011-05-03  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=60087 and <rdar://problem/9373182>
     6        WK2 Icon Database should provide access to all image representations in the icon.
     7
     8        Expose a CFArrayRef of CGImageRefs as API for CG platforms:
     9        * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
     10        (WKIconDatabaseTryCopyCGImageArrayForURL):
     11        * UIProcess/API/C/cg/WKIconDatabaseCG.h:
     12
    1132011-05-03  Sam Weinig  <sam@webkit.org>
    214
  • trunk/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp

    r83091 r85697  
    4040    return image ? image->getFirstCGImageRefOfSize(IntSize(static_cast<int>(size.width), static_cast<int>(size.height))) : 0;
    4141}
     42
     43CFArrayRef WKIconDatabaseTryCopyCGImageArrayForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef)
     44{
     45    Image* image = toImpl(iconDatabaseRef)->imageForPageURL(toWTFString(urlRef));
     46    return image ? image->getCGImageArray().leakRef() : 0;
     47}
     48
  • trunk/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h

    r83091 r85697  
    2727#define WKIconDatabaseCG_h
    2828
     29#include <CoreFoundation/CFArray.h>
    2930#include <CoreGraphics/CGImage.h>
    3031#include <WebKit2/WKBase.h>
     
    3536#endif
    3637
    37 WK_EXPORT CGImageRef WKIconDatabaseTryGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef urlString, WKSize size);
     38WK_EXPORT CGImageRef WKIconDatabaseTryGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef url, WKSize size);
     39WK_EXPORT CFArrayRef WKIconDatabaseTryCopyCGImageArrayForURL(WKIconDatabaseRef iconDatabase, WKURLRef url);
    3840
    3941#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.