Changeset 88967 in webkit


Ignore:
Timestamp:
Jun 15, 2011 12:50:30 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-06-15 Anders Carlsson <andersca@apple.com>

Reviewed by Darin Adler.

Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
https://bugs.webkit.org/show_bug.cgi?id=62742

  • Shared/ShareableBitmap.h: Move createImage out of the #if PLATFORM(QT) section.
  • Shared/WebCoreArgumentCoders.cpp: (CoreIPC::decodeImage): Call ShareableBitmap::createImage.
  • Shared/WebCoreArgumentCoders.h: remove createImage function declaration.
  • Shared/cairo/ShareableBitmapCairo.cpp: (WebKit::ShareableBitmap::createImage): Add implementation.
  • Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::createImage): Move createImage implementation from WebCoreArgumentCodersCG.cpp here.
  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj: Update projects.
Location:
trunk/Source/WebKit2
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r88960 r88967  
     12011-06-15  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
     6        https://bugs.webkit.org/show_bug.cgi?id=62742
     7
     8        * Shared/ShareableBitmap.h:
     9        Move createImage out of the #if PLATFORM(QT) section.
     10
     11        * Shared/WebCoreArgumentCoders.cpp:
     12        (CoreIPC::decodeImage):
     13        Call ShareableBitmap::createImage.
     14
     15        * Shared/WebCoreArgumentCoders.h:
     16        remove createImage function declaration.
     17
     18        * Shared/cairo/ShareableBitmapCairo.cpp:
     19        (WebKit::ShareableBitmap::createImage):
     20        Add implementation.
     21
     22        * Shared/cg/ShareableBitmapCG.cpp:
     23        (WebKit::ShareableBitmap::createGraphicsContext):
     24        (WebKit::ShareableBitmap::createImage):
     25        Move createImage implementation from WebCoreArgumentCodersCG.cpp here.
     26
     27        * WebKit2.xcodeproj/project.pbxproj:
     28        * win/WebKit2.vcproj:
     29        Update projects.
     30
    1312011-06-15  Anders Carlsson  <andersca@apple.com>
    232
  • trunk/Source/WebKit2/Shared/ShareableBitmap.h

    r88797 r88967  
    2828
    2929#include "SharedMemory.h"
    30 #include <WebCore/Image.h>
    3130#include <WebCore/IntRect.h>
    3231#include <wtf/PassOwnPtr.h>
     
    4847
    4948namespace WebCore {
     49    class Image;
    5050    class GraphicsContext;
    5151}
     
    108108    bool isBackedBySharedMemory() const { return m_sharedMemory; }
    109109
     110    // This creates a bitmap image that directly references the shared bitmap data.
     111    // This is only safe to use when we know that the contents of the shareable bitmap won't change.
     112    PassRefPtr<WebCore::Image> createImage();
     113
    110114#if USE(CG)
    111115    // This creates a copied CGImageRef (most likely a copy-on-write) of the shareable bitmap.
     
    123127    // This is only safe to use when we know that the contents of the shareable bitmap won't change.
    124128    QImage createQImage();
    125     PassRefPtr<WebCore::Image> createImage();
    126129#endif
    127130
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp

    r88960 r88967  
    182182    if (!bitmap)
    183183        return false;
    184     image = createImage(bitmap.get());
     184    image = bitmap->createImage();
    185185    if (!image)
    186186        return false;
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h

    r88960 r88967  
    142142void encodeImage(ArgumentEncoder*, WebCore::Image*);
    143143bool decodeImage(ArgumentDecoder*, RefPtr<WebCore::Image>&);
    144 RefPtr<WebCore::Image> createImage(WebKit::ShareableBitmap*);
    145144
    146145template<> struct ArgumentCoder<WebCore::Cursor> {
  • trunk/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp

    r87517 r88967  
    2929#include "ShareableBitmap.h"
    3030
     31#include <WebCore/BitmapImage.h>
    3132#include <WebCore/CairoUtilities.h>
    3233#include <WebCore/GraphicsContext.h>
    33 #include <WebCore/NotImplemented.h>
    3434#include <WebCore/PlatformContextCairo.h>
    3535
     
    7373}
    7474
     75PassRefPtr<Image> ShareableBitmap::createImage()
     76{
     77    RefPtr<cairo_surface_t> surface = createCairoSurface();
     78    if (!surface)
     79        return 0;
     80
     81    // BitmapImage::create adopts the cairo_surface_t that's passed in, which is why we need to leakRef here.
     82    return BitmapImage::create(surface.release().leakRef());
     83}
     84
    7585} // namespace WebKit
  • trunk/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp

    r85754 r88967  
    2727#include "ShareableBitmap.h"
    2828
     29#include <WebCore/BitmapImage.h>
    2930#include <WebCore/GraphicsContext.h>
    3031#include <wtf/RetainPtr.h>
     
    4950{
    5051    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
    51 
    5252
    5353    ref(); // Balanced by deref in releaseBitmapContextData.
     
    107107}
    108108
     109PassRefPtr<Image> ShareableBitmap::createImage()
     110{
     111    RetainPtr<CGImageRef> platformImage = makeCGImage();
     112    if (!platformImage)
     113        return 0;
     114
     115    // BitmapImage::create adopts the CGImageRef that's passed in, which is why we need to leakRef here.
     116    return BitmapImage::create(platformImage.leakRef());
     117}
     118
    109119} // namespace WebKit
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r88846 r88967  
    413413                9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */; };
    414414                939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */; };
    415                 939AE7681316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7671316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp */; };
    416415                93C01DAC139AC91700ED51D7 /* CoreIPCClientRunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C01DAA139AC91700ED51D7 /* CoreIPCClientRunLoop.h */; };
    417416                93C01DAD139AC91700ED51D7 /* CoreIPCClientRunLoop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93C01DAB139AC91700ED51D7 /* CoreIPCClientRunLoop.mm */; };
     
    13521351                9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameNetworkingContext.mm; sourceTree = "<group>"; };
    13531352                939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCoders.cpp; sourceTree = "<group>"; };
    1354                 939AE7671316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCodersCG.cpp; sourceTree = "<group>"; };
    13551353                93C01DAA139AC91700ED51D7 /* CoreIPCClientRunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreIPCClientRunLoop.h; sourceTree = "<group>"; };
    13561354                93C01DAB139AC91700ED51D7 /* CoreIPCClientRunLoop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreIPCClientRunLoop.mm; sourceTree = "<group>"; };
     
    32543252                        children = (
    32553253                                C01A260012662F2100C9ED55 /* ShareableBitmapCG.cpp */,
    3256                                 939AE7671316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp */,
    32573254                        );
    32583255                        path = cg;
     
    44414438                                51A9E12A1315ED35009E7031 /* WebKeyValueStorageManagerProxyMessageReceiver.cpp in Sources */,
    44424439                                939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */,
    4443                                 939AE7681316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp in Sources */,
    44444440                                330934471315B9220097A7BC /* WebCookieManagerMessageReceiver.cpp in Sources */,
    44454441                                330934491315B9220097A7BC /* WebCookieManagerProxyMessageReceiver.cpp in Sources */,
  • trunk/Source/WebKit2/win/WebKit2.vcproj

    r88846 r88967  
    13061306                                        </FileConfiguration>
    13071307                                </File>
    1308                                 <File
    1309                                         RelativePath="..\Shared\cg\WebCoreArgumentCodersCG.cpp"
    1310                                         >
    1311                                         <FileConfiguration
    1312                                                 Name="Debug_Cairo_CFLite|Win32"
    1313                                                 ExcludedFromBuild="true"
    1314                                                 >
    1315                                                 <Tool
    1316                                                         Name="VCCLCompilerTool"
    1317                                                 />
    1318                                         </FileConfiguration>
    1319                                         <FileConfiguration
    1320                                                 Name="Release_Cairo_CFLite|Win32"
    1321                                                 ExcludedFromBuild="true"
    1322                                                 >
    1323                                                 <Tool
    1324                                                         Name="VCCLCompilerTool"
    1325                                                 />
    1326                                         </FileConfiguration>
    1327                                 </File>
    13281308                                <Filter
    13291309                                        Name="win"
Note: See TracChangeset for help on using the changeset viewer.