[Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
authorch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2013 17:59:37 +0000 (17:59 +0000)
committerch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2013 17:59:37 +0000 (17:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113929

Reviewed by Martin Robinson.

Source/WebCore:

Make (Pass)NativeImagePtr typedefs to (Pass)RefPtr<cairo_surface_t> instead
of NativeImageCairo*. Now that we switch to using smart pointers,
NativeImageCairo is removed as it made no sense to make it ref counted when
it merely held a single ref counted member.

Now that Cairo is using smart pointers for (Pass)NativeImagePtr, this patch
also enables the implementation of SVGImage::nativeImageForCurrentFrame()
for USE(CAIRO) as well. This effectively fixes canvas drawing of SVG-based
patterns for Cairo-based ports.

No new tests, covered by svg/canvas/canvas-pattern-svg.html.

* GNUmakefile.list.am: Remove NativeImageCairo.* for GTK.

* PlatformEfl.cmake: Remove NativeImageCairo.* for EFL.

* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
Remove NativeImageCairo.* for Win.

* platform/graphics/BitmapImage.cpp:
(WebCore::FrameData::reportMemoryUsage):
Update MemoryClassInfo::addRawBuffer() call now that m_frame is a RefPtr
for USE(CAIRO).

* platform/graphics/BitmapImage.h:
(BitmapImage):
Remove factory method taking a cairo_surface_t* in argument. This is useless
now that PassNativeImagePtr is a typedef to PassRefPtr<cairo_surface_t> and
there is already a factory method taking a PassNativeImagePtr in argument.

* platform/graphics/NativeImagePtr.h:
(WebCore):
Make PassNativeImagePtr a typedef to PassRefPtr<cairo_surface_t> and
NativeImagePtr a typedef to RefPtr<cairo_surface_t>, instead of
NativeImageCairo*. Moving to smart pointers is needed to enable implementation
of SVGImage::nativeImageForCurrentFrame() for Cairo.

* platform/graphics/cairo/BitmapImageCairo.cpp:
(WebCore::BitmapImage::BitmapImage):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::checkForSolidColor):
(WebCore::FrameData::clear):
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::Image::drawPattern):
Update Cairo graphics code to reflect the (Pass)NativeImagePtr type changes.

* platform/graphics/cairo/NativeImageCairo.cpp: Removed.
* platform/graphics/cairo/NativeImageCairo.h: Removed.

* platform/graphics/cairo/PatternCairo.cpp:
(WebCore::Pattern::createPlatformPattern):
* platform/graphics/efl/GraphicsContext3DEfl.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/efl/ImageEfl.cpp:
(WebCore::BitmapImage::getEvasObject):
* platform/graphics/gtk/ImageGtk.cpp:
(WebCore::BitmapImage::getGdkPixbuf):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::BitmapTextureGL::updateContents):
* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::create):
(WebCore::BitmapImage::drawFrameMatchingSourceSize):
* platform/gtk/DragImageGtk.cpp:
(WebCore::createDragImageFromImage):
* platform/image-decoders/cairo/ImageDecoderCairo.cpp:
(WebCore::ImageFrame::asNewNativeImage):
* platform/win/DragImageCairoWin.cpp:
(WebCore::createDragImageFromImage):
Update code to reflect the (Pass)NativeImagePtr type changes.

* svg/graphics/SVGImage.cpp:
(WebCore):
* svg/graphics/SVGImage.h:
Enable SVGImage::nativeImageForCurrentFrame() for USE(CAIRO).

Source/WebKit:

Remove outdated symbols now that NativeImageCairo was removed.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

Source/WebKit/efl:

Update code now that PassNativeImagePtr is now a typedef to PassRefPtr<cairo_surface_t>
instead of NativeImageCairo*.

* ewk/ewk_history.cpp:
(ewk_history_item_icon_surface_get):
(ewk_history_item_icon_object_add):
* ewk/ewk_settings.cpp:
(ewk_settings_icon_database_icon_surface_get):
(ewk_settings_icon_database_icon_object_get):

Source/WebKit/gtk:

Update code now that PassNativeImagePtr is now a typedef to PassRefPtr<cairo_surface_t>
instead of NativeImageCairo*.

* webkit/webkitfavicondatabase.cpp:
(getIconPixbufSynchronously):

Source/WebKit/win:

Remove outdated symbols now that NativeImageCairo was removed.

* WebKit.vcproj/WebKitExports.def.in:

Source/WebKit2:

Update code now that PassNativeImagePtr is now a typedef to PassRefPtr<cairo_surface_t>
instead of NativeImageCairo*.

* Shared/gtk/ArgumentCodersGtk.cpp:
(CoreIPC::decodeImage):
* UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp:
(WKIconDatabaseTryGetCairoSurfaceForURL):
* UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
(getIconSurfaceSynchronously):

LayoutTests:

Add EFL / GTK pixels results for svg/canvas/canvas-pattern-svg.html now that
the test passes for cairo-based ports.

* platform/efl/svg/canvas/canvas-pattern-svg-expected.png: Added.
* platform/gtk/svg/canvas/canvas-pattern-svg-expected.png: Added.

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

41 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/efl/svg/canvas/canvas-pattern-svg-expected.png [new file with mode: 0644]
LayoutTests/platform/gtk/svg/canvas/canvas-pattern-svg-expected.png [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/PlatformEfl.cmake
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/NativeImagePtr.h
Source/WebCore/platform/graphics/cairo/BitmapImageCairo.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
Source/WebCore/platform/graphics/cairo/ImageCairo.cpp
Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp [deleted file]
Source/WebCore/platform/graphics/cairo/NativeImageCairo.h [deleted file]
Source/WebCore/platform/graphics/cairo/PatternCairo.cpp
Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
Source/WebCore/platform/graphics/efl/ImageEfl.cpp
Source/WebCore/platform/graphics/gtk/ImageGtk.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/graphics/win/ImageCairoWin.cpp
Source/WebCore/platform/gtk/DragImageGtk.cpp
Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp
Source/WebCore/platform/win/DragImageCairoWin.cpp
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebCore/svg/graphics/SVGImage.h
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_history.cpp
Source/WebKit/efl/ewk/ewk_settings.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp

index b73524c..52563b8 100644 (file)
@@ -1,3 +1,16 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Add EFL / GTK pixels results for svg/canvas/canvas-pattern-svg.html now that
+        the test passes for cairo-based ports.
+
+        * platform/efl/svg/canvas/canvas-pattern-svg-expected.png: Added.
+        * platform/gtk/svg/canvas/canvas-pattern-svg-expected.png: Added.
+
 2013-04-04  Xidorn Quan  <quanxunzhen@gmail.com>
 
         REGRESSION (r145870): Can't get insertion point to appear in some input and textareas on wordpress
diff --git a/LayoutTests/platform/efl/svg/canvas/canvas-pattern-svg-expected.png b/LayoutTests/platform/efl/svg/canvas/canvas-pattern-svg-expected.png
new file mode 100644 (file)
index 0000000..e9901e9
Binary files /dev/null and b/LayoutTests/platform/efl/svg/canvas/canvas-pattern-svg-expected.png differ
diff --git a/LayoutTests/platform/gtk/svg/canvas/canvas-pattern-svg-expected.png b/LayoutTests/platform/gtk/svg/canvas/canvas-pattern-svg-expected.png
new file mode 100644 (file)
index 0000000..6d565bf
Binary files /dev/null and b/LayoutTests/platform/gtk/svg/canvas/canvas-pattern-svg-expected.png differ
index 7ecdb01..9f43277 100644 (file)
@@ -1,3 +1,89 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Make (Pass)NativeImagePtr typedefs to (Pass)RefPtr<cairo_surface_t> instead
+        of NativeImageCairo*. Now that we switch to using smart pointers,
+        NativeImageCairo is removed as it made no sense to make it ref counted when
+        it merely held a single ref counted member.
+
+        Now that Cairo is using smart pointers for (Pass)NativeImagePtr, this patch
+        also enables the implementation of SVGImage::nativeImageForCurrentFrame()
+        for USE(CAIRO) as well. This effectively fixes canvas drawing of SVG-based
+        patterns for Cairo-based ports.
+
+        No new tests, covered by svg/canvas/canvas-pattern-svg.html.
+
+        * GNUmakefile.list.am: Remove NativeImageCairo.* for GTK.
+
+        * PlatformEfl.cmake: Remove NativeImageCairo.* for EFL.
+
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        Remove NativeImageCairo.* for Win.
+
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::FrameData::reportMemoryUsage):
+        Update MemoryClassInfo::addRawBuffer() call now that m_frame is a RefPtr
+        for USE(CAIRO).
+
+        * platform/graphics/BitmapImage.h:
+        (BitmapImage):
+        Remove factory method taking a cairo_surface_t* in argument. This is useless
+        now that PassNativeImagePtr is a typedef to PassRefPtr<cairo_surface_t> and
+        there is already a factory method taking a PassNativeImagePtr in argument.
+
+        * platform/graphics/NativeImagePtr.h:
+        (WebCore):
+        Make PassNativeImagePtr a typedef to PassRefPtr<cairo_surface_t> and
+        NativeImagePtr a typedef to RefPtr<cairo_surface_t>, instead of
+        NativeImageCairo*. Moving to smart pointers is needed to enable implementation
+        of SVGImage::nativeImageForCurrentFrame() for Cairo.
+
+        * platform/graphics/cairo/BitmapImageCairo.cpp:
+        (WebCore::BitmapImage::BitmapImage):
+        (WebCore::BitmapImage::draw):
+        (WebCore::BitmapImage::checkForSolidColor):
+        (WebCore::FrameData::clear):
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
+        * platform/graphics/cairo/ImageCairo.cpp:
+        (WebCore::Image::drawPattern):
+        Update Cairo graphics code to reflect the (Pass)NativeImagePtr type changes.
+
+        * platform/graphics/cairo/NativeImageCairo.cpp: Removed.
+        * platform/graphics/cairo/NativeImageCairo.h: Removed.
+
+        * platform/graphics/cairo/PatternCairo.cpp:
+        (WebCore::Pattern::createPlatformPattern):
+        * platform/graphics/efl/GraphicsContext3DEfl.cpp:
+        (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
+        * platform/graphics/efl/ImageEfl.cpp:
+        (WebCore::BitmapImage::getEvasObject):
+        * platform/graphics/gtk/ImageGtk.cpp:
+        (WebCore::BitmapImage::getGdkPixbuf):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::BitmapTextureGL::updateContents):
+        * platform/graphics/win/ImageCairoWin.cpp:
+        (WebCore::BitmapImage::create):
+        (WebCore::BitmapImage::drawFrameMatchingSourceSize):
+        * platform/gtk/DragImageGtk.cpp:
+        (WebCore::createDragImageFromImage):
+        * platform/image-decoders/cairo/ImageDecoderCairo.cpp:
+        (WebCore::ImageFrame::asNewNativeImage):
+        * platform/win/DragImageCairoWin.cpp:
+        (WebCore::createDragImageFromImage):
+        Update code to reflect the (Pass)NativeImagePtr type changes.
+
+        * svg/graphics/SVGImage.cpp:
+        (WebCore):
+        * svg/graphics/SVGImage.h:
+        Enable SVGImage::nativeImageForCurrentFrame() for USE(CAIRO).
+
 2013-04-04  Ed Bartosh  <bartosh@gmail.com>
 
         [EFL] --minimal build fails with 'error: unused variable'
index b08d035..aa1d5a5 100644 (file)
@@ -5521,8 +5521,6 @@ webcore_platform_sources += \
        Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h \
        Source/WebCore/platform/graphics/cairo/ImageCairo.cpp \
        Source/WebCore/platform/graphics/cairo/IntRectCairo.cpp \
-       Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp \
-       Source/WebCore/platform/graphics/cairo/NativeImageCairo.h \
        Source/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp \
        Source/WebCore/platform/graphics/cairo/OwnPtrCairo.h \
        Source/WebCore/platform/graphics/cairo/PathCairo.cpp \
index d6663b3..b7e99aa 100644 (file)
@@ -96,7 +96,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/cairo/ImageBufferCairo.cpp
     platform/graphics/cairo/ImageCairo.cpp
     platform/graphics/cairo/IntRectCairo.cpp
-    platform/graphics/cairo/NativeImageCairo.cpp
     platform/graphics/cairo/OwnPtrCairo.cpp
     platform/graphics/cairo/PathCairo.cpp
     platform/graphics/cairo/PatternCairo.cpp
index 1000e67..8f5016a 100755 (executable)
                                                </FileConfiguration>
                                        </File>
                                        <File
-                                               RelativePath="..\platform\graphics\cairo\NativeImageCairo.cpp"
-                                               >
-                                               <FileConfiguration
-                                                       Name="Debug|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCLCompilerTool"
-                                                       />
-                                               </FileConfiguration>
-                                               <FileConfiguration
-                                                       Name="Release|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCLCompilerTool"
-                                                       />
-                                               </FileConfiguration>
-                                               <FileConfiguration
-                                                       Name="Debug_All|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCLCompilerTool"
-                                                       />
-                                               </FileConfiguration>
-                                               <FileConfiguration
-                                                       Name="Production|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCLCompilerTool"
-                                                       />
-                                               </FileConfiguration>
-                                       </File>
-                                       <File
                                                RelativePath="..\platform\graphics\cairo\OwnPtrCairo.cpp"
                                                >
                                                <FileConfiguration
index a15977c..38a0641 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\platform\graphics\cairo\NativeImageCairo.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\platform\graphics\cairo\OwnPtrCairo.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
index 484fca3..e1f92f1 100644 (file)
     <ClCompile Include="..\platform\graphics\cairo\IntRectCairo.cpp">
       <Filter>platform\graphics\cairo</Filter>
     </ClCompile>
-    <ClCompile Include="..\platform\graphics\cairo\NativeImageCairo.cpp">
-      <Filter>platform\graphics\cairo</Filter>
-    </ClCompile>
     <ClCompile Include="..\platform\graphics\cairo\OwnPtrCairo.cpp">
       <Filter>platform\graphics\cairo</Filter>
     </ClCompile>
       <Filter>rendering</Filter>
     </CustomBuildStep>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
index cb80a8d..381501d 100644 (file)
@@ -588,7 +588,7 @@ void FrameData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
     memoryObjectInfo->setClassName("FrameData");
-#if OS(WINCE) && !PLATFORM(QT)
+#if (OS(WINCE) && !PLATFORM(QT)) || USE(CAIRO)
     info.addRawBuffer(m_frame.get(), m_frameBytes, "NativeImage", "frame");
 #elif USE(SKIA)
     info.addMember(m_frame, "frame", WTF::RetainingPointer);
index 31c9058..1636a0e 100644 (file)
@@ -165,10 +165,6 @@ public:
     virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE);
 #endif
 
-#if USE(CAIRO)
-    static PassRefPtr<BitmapImage> create(cairo_surface_t*);
-#endif
-
 #if PLATFORM(GTK)
     virtual GdkPixbuf* getGdkPixbuf();
 #endif
index 7353141..b721991 100644 (file)
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
 class QPixmap;
 QT_END_NAMESPACE
 #elif USE(CAIRO)
-#include "NativeImageCairo.h"
+#include "RefPtrCairo.h"
 #elif USE(SKIA)
 #include "NativeImageSkia.h"
 namespace WebCore {
@@ -72,7 +72,8 @@ typedef wxGraphicsBitmap* NativeImagePtr;
 typedef wxBitmap* NativeImagePtr;
 #endif
 #elif USE(CAIRO)
-typedef WebCore::NativeImageCairo* NativeImagePtr;
+typedef RefPtr<cairo_surface_t> NativeImagePtr;
+typedef PassRefPtr<cairo_surface_t> PassNativeImagePtr;
 #elif USE(SKIA)
 typedef RefPtr<NativeImageSkia> NativeImagePtr;
 typedef PassRefPtr<NativeImageSkia> PassNativeImagePtr;
@@ -83,7 +84,7 @@ typedef RefPtr<SharedBitmap> NativeImagePtr;
 typedef void* NativeImagePtr;
 #endif
 
-#if !USE(SKIA)
+#if !USE(SKIA) && !USE(CAIRO)
 typedef NativeImagePtr PassNativeImagePtr;
 #endif
 
index d0953cc..071979a 100644 (file)
 #include "BitmapImage.h"
 
 #include "ImageObserver.h"
-#include "NativeImageCairo.h"
 #include "PlatformContextCairo.h"
 #include <cairo.h>
 
 namespace WebCore {
 
-PassRefPtr<BitmapImage> BitmapImage::create(cairo_surface_t* surface)
-{
-    return BitmapImage::create(new NativeImageCairo(surface));
-}
-
-BitmapImage::BitmapImage(NativeImageCairo* nativeImage, ImageObserver* observer)
+BitmapImage::BitmapImage(PassRefPtr<cairo_surface_t> nativeImage, ImageObserver* observer)
     : Image(observer)
     , m_currentFrame(0)
     , m_frames(0)
@@ -58,15 +52,14 @@ BitmapImage::BitmapImage(NativeImageCairo* nativeImage, ImageObserver* observer)
     , m_sizeAvailable(true)
     , m_haveFrameCount(true)
 {
-    cairo_surface_t* surface = nativeImage->surface();
-    int width = cairo_image_surface_get_width(surface);
-    int height = cairo_image_surface_get_height(surface);
+    int width = cairo_image_surface_get_width(nativeImage.get());
+    int height = cairo_image_surface_get_height(nativeImage.get());
     m_decodedSize = width * height * 4;
     m_size = IntSize(width, height);
 
     m_frames.grow(1);
+    m_frames[0].m_hasAlpha = cairo_surface_get_content(nativeImage.get()) != CAIRO_CONTENT_COLOR;
     m_frames[0].m_frame = nativeImage;
-    m_frames[0].m_hasAlpha = cairo_surface_get_content(surface) != CAIRO_CONTENT_COLOR;
     m_frames[0].m_haveMetadata = true;
     checkForSolidColor();
 }
@@ -84,8 +77,8 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
 
     startAnimation();
 
-    NativeImageCairo* nativeImage = frameAtIndex(m_currentFrame);
-    if (!nativeImage) // If it's too early we won't have an image yet.
+    RefPtr<cairo_surface_t> surface = frameAtIndex(m_currentFrame);
+    if (!surface) // If it's too early we won't have an image yet.
         return;
 
     if (mayFillWithSolidColor()) {
@@ -102,8 +95,7 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
         context->setCompositeOperation(op, blendMode);
 
 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
-    cairo_surface_t* surface = nativeImage->surface();
-    IntSize scaledSize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface));
+    IntSize scaledSize(cairo_image_surface_get_width(surface.get()), cairo_image_surface_get_height(surface.get()));
     FloatRect adjustedSrcRect = adjustSourceRectForDownSampling(src, scaledSize);
 #else
     FloatRect adjustedSrcRect(src);
@@ -127,7 +119,7 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
         }
     }
 
-    context->platformContext()->drawSurfaceToContext(nativeImage->surface(), dstRect, adjustedSrcRect, context);
+    context->platformContext()->drawSurfaceToContext(surface.get(), dstRect, adjustedSrcRect, context);
 
     context->restore();
 
@@ -143,20 +135,19 @@ void BitmapImage::checkForSolidColor()
     if (frameCount() > 1)
         return;
 
-    NativeImageCairo* nativeImage = frameAtIndex(m_currentFrame);
-    if (!nativeImage) // If it's too early we won't have an image yet.
+    RefPtr<cairo_surface_t> surface = frameAtIndex(m_currentFrame);
+    if (!surface) // If it's too early we won't have an image yet.
         return;
 
-    cairo_surface_t* surface = nativeImage->surface();
-    ASSERT(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE);
+    ASSERT(cairo_surface_get_type(surface.get()) == CAIRO_SURFACE_TYPE_IMAGE);
 
-    int width = cairo_image_surface_get_width(surface);
-    int height = cairo_image_surface_get_height(surface);
+    int width = cairo_image_surface_get_width(surface.get());
+    int height = cairo_image_surface_get_height(surface.get());
 
     if (width != 1 || height != 1)
         return;
 
-    unsigned* pixelColor = reinterpret_cast<unsigned*>(cairo_image_surface_get_data(surface));
+    unsigned* pixelColor = reinterpret_cast<unsigned*>(cairo_image_surface_get_data(surface.get()));
     m_solidColor = colorFromPremultipliedARGB(*pixelColor);
 
     m_isSolidColor = true;
@@ -168,8 +159,7 @@ bool FrameData::clear(bool clearMetadata)
         m_haveMetadata = false;
 
     if (m_frame) {
-        delete m_frame;
-        m_frame = 0;
+        m_frame.clear();
         return true;
     }
     return false;
index 9440b91..21cbd1a 100644 (file)
@@ -186,11 +186,9 @@ bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool
         decoder.setData(m_image->data(), true);
         if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
             return false;
-        OwnPtr<NativeImageCairo> nativeImage = adoptPtr(decoder.createFrameAtIndex(0));
-        m_imageSurface = nativeImage->surface();
+        m_imageSurface = decoder.createFrameAtIndex(0);
     } else {
-        NativeImageCairo* nativeImage = m_image->nativeImageForCurrentFrame();
-        m_imageSurface = (nativeImage) ? nativeImage->surface() : 0;
+        m_imageSurface = m_image->nativeImageForCurrentFrame();
         // 1. For texImage2D with HTMLVideoElment input, assume no PremultiplyAlpha had been applied and the alpha value is 0xFF for each pixel,
         // which is true at present and may be changed in the future and needs adjustment accordingly.
         // 2. For texImage2D with HTMLCanvasElement input in which Alpha is already Premultiplied in this port, 
index e858547..46a39b4 100644 (file)
@@ -35,7 +35,6 @@
 #include "Color.h"
 #include "GraphicsContext.h"
 #include "ImageObserver.h"
-#include "NativeImageCairo.h"
 #include "PlatformContextCairo.h"
 #include <cairo.h>
 #include <math.h>
@@ -45,12 +44,12 @@ namespace WebCore {
 void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform,
     const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode)
 {
-    NativeImageCairo* image = nativeImageForCurrentFrame();
-    if (!image) // If it's too early we won't have an image yet.
+    RefPtr<cairo_surface_t> surface = nativeImageForCurrentFrame();
+    if (!surface) // If it's too early we won't have an image yet.
         return;
 
     cairo_t* cr = context->platformContext()->cr();
-    drawPatternToCairoContext(cr, image->surface(), size(), tileRect, patternTransform, phase, toCairoOperator(op), destRect);
+    drawPatternToCairoContext(cr, surface.get(), size(), tileRect, patternTransform, phase, toCairoOperator(op), destRect);
 
     if (imageObserver())
         imageObserver()->didDraw(this);
diff --git a/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp b/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp
deleted file mode 100644 (file)
index af674d4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
- * Copyright (c) 2012, Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "NativeImageCairo.h"
-
-namespace WebCore {
-
-NativeImageCairo::NativeImageCairo()
-{
-}
-
-NativeImageCairo::NativeImageCairo(cairo_surface_t* surface)
-    : m_surface(adoptRef(surface))
-{
-}
-
-NativeImageCairo::~NativeImageCairo()
-{
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/cairo/NativeImageCairo.h b/Source/WebCore/platform/graphics/cairo/NativeImageCairo.h
deleted file mode 100644 (file)
index 79dc1db..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
- * Copyright (c) 2012, Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef NativeImageCairo_h
-#define NativeImageCairo_h
-
-#include "RefPtrCairo.h"
-
-namespace WebCore {
-
-class NativeImageCairo {
-public:
-    NativeImageCairo();
-    ~NativeImageCairo();
-    explicit NativeImageCairo(cairo_surface_t*);
-    cairo_surface_t* surface () { return m_surface.get(); }
-
-private:
-    RefPtr<cairo_surface_t> m_surface;
-};
-
-}
-#endif // NativeImageCairo_h
-
index 22368b8..8870d3e 100644 (file)
@@ -34,11 +34,11 @@ namespace WebCore {
 
 cairo_pattern_t* Pattern::createPlatformPattern(const AffineTransform&) const
 {
-    NativeImageCairo* image = tileImage()->nativeImageForCurrentFrame();
-    if (!image)
+    RefPtr<cairo_surface_t> surface = tileImage()->nativeImageForCurrentFrame();
+    if (!surface)
         return 0;
 
-    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image->surface());
+    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface.get());
 
     // cairo merges patter space and user space itself
     cairo_matrix_t matrix = m_patternSpaceTransformation;
index a977943..d712e4f 100644 (file)
@@ -263,11 +263,9 @@ bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool
         if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
             return false;
 
-        OwnPtr<NativeImageCairo> nativeImage = adoptPtr(decoder.createFrameAtIndex(0));
-        m_imageSurface = nativeImage->surface();
+        m_imageSurface = decoder.createFrameAtIndex(0);
     } else {
-        NativeImageCairo* nativeImage = m_image->nativeImageForCurrentFrame();
-        m_imageSurface = (nativeImage) ? nativeImage->surface() : 0;
+        m_imageSurface = m_image->nativeImageForCurrentFrame();
         // 1. For texImage2D with HTMLVideoElment input, assume no PremultiplyAlpha had been applied and the alpha value is 0xFF for each pixel,
         // which is true at present and may be changed in the future and needs adjustment accordingly.
         // 2. For texImage2D with HTMLCanvasElement input in which Alpha is already Premultiplied in this port,
index e8d5d6e..c9d4b04 100644 (file)
@@ -65,8 +65,8 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name)
 
 Evas_Object* BitmapImage::getEvasObject(Evas* evas)
 {
-    NativeImageCairo* image = nativeImageForCurrentFrame();
-    return image ? evasObjectFromCairoImageSurface(evas, image->surface()).leakRef() : 0;
+    RefPtr<cairo_surface_t> surface = nativeImageForCurrentFrame();
+    return surface ? evasObjectFromCairoImageSurface(evas, surface.get()).leakRef() : 0;
 }
 
 }
index 9d9fbef..19e91cd 100644 (file)
@@ -108,8 +108,8 @@ PassRefPtr<Image> Image::loadPlatformThemeIcon(const char* name, int size)
 
 GdkPixbuf* BitmapImage::getGdkPixbuf()
 {
-    NativeImageCairo* image = nativeImageForCurrentFrame();
-    return image ? cairoImageSurfaceToGdkPixbuf(image->surface()) : 0;
+    RefPtr<cairo_surface_t> surface = nativeImageForCurrentFrame();
+    return surface ? cairoImageSurfaceToGdkPixbuf(surface.get()) : 0;
 }
 
 }
index 3142015..a8ba967 100644 (file)
@@ -729,7 +729,7 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co
     imageData = reinterpret_cast<const char*>(qImage.constBits());
     bytesPerLine = qImage.bytesPerLine();
 #elif USE(CAIRO)
-    cairo_surface_t* surface = frameImage->surface();
+    cairo_surface_t* surface = frameImage.get();
     imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface));
     bytesPerLine = cairo_image_surface_get_stride(surface);
 #endif
index 8fc6b86..665cef4 100644 (file)
@@ -27,6 +27,7 @@
 #include "Image.h"
 #include "BitmapImage.h"
 #include "GraphicsContext.h"
+#include "RefPtrCairo.h"
 #include <cairo.h>
 #include <cairo-win32.h>
 
@@ -49,9 +50,9 @@ PassRefPtr<BitmapImage> BitmapImage::create(HBITMAP hBitmap)
     if (!dibSection.dsBm.bmBits)
         return 0;
 
-    cairo_surface_t* surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32, dibSection.dsBm.bmWidth, dibSection.dsBm.bmHeight);
+    RefPtr<cairo_surface_t> surface = adoptRef(cairo_win32_surface_create_with_dib(CAIRO_FORMAT_ARGB32, dibSection.dsBm.bmWidth, dibSection.dsBm.bmHeight));
 
-    return BitmapImage::create(new NativeImageCairo(surface));
+    return BitmapImage::create(surface.release());
 }
 
 bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, LPSIZE size)
@@ -95,14 +96,11 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const Float
 {
     size_t frames = frameCount();
     for (size_t i = 0; i < frames; ++i) {
-        NativeImageCairo* nativeImage = frameAtIndex(i);
-        if (!nativeImage)
-            continue;
-        cairo_surface_t* image = nativeImage->surface();
-        if (!image)
+        RefPtr<cairo_surface_t> surface = frameAtIndex(i);
+        if (!surface)
             continue;
 
-        if (cairo_image_surface_get_height(image) == static_cast<size_t>(srcSize.height()) && cairo_image_surface_get_width(image) == static_cast<size_t>(srcSize.width())) {
+        if (cairo_image_surface_get_height(surface.get()) == static_cast<size_t>(srcSize.height()) && cairo_image_surface_get_width(surface.get()) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
             draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), ColorSpaceDeviceRGB, compositeOp, BlendModeNormal);
index 3b7c4c1..9292792 100644 (file)
@@ -79,8 +79,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction)
 
 DragImageRef createDragImageFromImage(Image* image, RespectImageOrientationEnum)
 {
-    NativeImageCairo* nativeImage = image->nativeImageForCurrentFrame();
-    return nativeImage ? cairo_surface_reference(nativeImage->surface()) : 0;
+    return image->nativeImageForCurrentFrame().leakRef();
 }
 
 DragImageRef createDragImageIconForCachedImage(CachedImage*)
index 5cbdc56..1d99a56 100644 (file)
@@ -32,7 +32,7 @@ namespace WebCore {
 
 PassNativeImagePtr ImageFrame::asNewNativeImage() const
 {
-    return new NativeImageCairo(cairo_image_surface_create_for_data(
+    return adoptRef(cairo_image_surface_create_for_data(
         reinterpret_cast<unsigned char*>(const_cast<PixelData*>(m_bytes)),
         CAIRO_FORMAT_ARGB32, width(), height(), width() * sizeof(PixelData)));
 }
index 44a67f5..5425364 100644 (file)
@@ -31,7 +31,6 @@
 #include "GraphicsContext.h"
 #include "GraphicsContextPlatformPrivateCairo.h"
 #include "Image.h"
-#include "NativeImageCairo.h"
 #include <wtf/RetainPtr.h>
 #include <cairo-win32.h>
 #include <windows.h>
@@ -173,12 +172,10 @@ DragImageRef createDragImageFromImage(Image* img, RespectImageOrientationEnum)
     cairo_set_source_rgb(cr, 1.0, 0.0, 1.0);
     cairo_fill_preserve(cr);
 
-    NativeImageCairo* srcNativeImage = img->nativeImageForCurrentFrame();
-    cairo_surface_t* srcImage = (srcNativeImage) ? srcNativeImage->surface() : 0;
-
-    if (srcImage) {
+    RefPtr<cairo_surface_t> surface = img->nativeImageForCurrentFrame();
+    if (surface) {
         // Draw the image.
-        cairo_set_source_surface(cr, srcImage, 0.0, 0.0);
+        cairo_set_source_surface(cr, surface.get(), 0.0, 0.0);
         cairo_paint(cr);
     }
 
index 8635a63..c8aaf73 100644 (file)
@@ -141,7 +141,7 @@ void SVGImage::drawForContainer(GraphicsContext* context, const FloatSize contai
     setImageObserver(observer);
 }
 
-#if USE(SKIA)
+#if USE(SKIA) || USE(CAIRO)
 // Passes ownership of the native image to the caller so PassNativeImagePtr needs
 // to be a smart pointer type.
 PassNativeImagePtr SVGImage::nativeImageForCurrentFrame()
index 5dd0e7b..eadb101 100644 (file)
@@ -62,7 +62,7 @@ public:
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
 
-#if USE(SKIA)
+#if USE(SKIA) || USE(CAIRO)
     virtual PassNativeImagePtr nativeImageForCurrentFrame() OVERRIDE;
 #endif
 
index 71c85a8..7ba97eb 100644 (file)
@@ -1,3 +1,14 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Remove outdated symbols now that NativeImageCairo was removed.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
+
 2013-04-03  Roger Fong  <roger_fong@apple.com>
 
         Unreviewed VS2010 build fix.
index a672c82..39a33a8 100644 (file)
@@ -370,9 +370,6 @@ EXPORTS
         ?getCGImageRef@BitmapImage@WebCore@@UAEPAUCGImage@@XZ
         ?getFirstCGImageRefOfSize@BitmapImage@WebCore@@UAEPAUCGImage@@ABVIntSize@2@@Z
         ?getCGImageArray@BitmapImage@WebCore@@UAE?AV?$RetainPtr@PBU__CFArray@@@WTF@@XZ
-#elif USE(CAIRO)
-        ?nativeImageForCurrentFrame@BitmapImage@WebCore@@UAEPAVNativeImageCairo@2@XZ
-        ?frameAtIndex@BitmapImage@WebCore@@IAEPAVNativeImageCairo@2@I@Z
 #endif
         ?getHBITMAP@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@@Z
         ?getHBITMAPOfSize@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@PAUtagSIZE@@@Z
index e5cf1d9..4686672 100644 (file)
@@ -1,3 +1,20 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Update code now that PassNativeImagePtr is now a typedef to PassRefPtr<cairo_surface_t>
+        instead of NativeImageCairo*.
+
+        * ewk/ewk_history.cpp:
+        (ewk_history_item_icon_surface_get):
+        (ewk_history_item_icon_object_add):
+        * ewk/ewk_settings.cpp:
+        (ewk_settings_icon_database_icon_surface_get):
+        (ewk_settings_icon_database_icon_object_get):
+
 2013-03-31  Kangil Han  <kangil.han@samsung.com>
 
         [EFL] Remove unused stdio.h includes
index 49c3a1a..9172997 100644 (file)
@@ -336,11 +336,11 @@ cairo_surface_t* ewk_history_item_icon_surface_get(const Ewk_History_Item* item)
 {
     EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
 
-    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));
+    RefPtr<cairo_surface_t> icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));
     if (!icon)
         ERR("icon is NULL.");
 
-    return icon ? icon->surface() : 0;
+    return icon.get();
 }
 
 Evas_Object* ewk_history_item_icon_object_add(const Ewk_History_Item* item, Evas* canvas)
@@ -348,14 +348,13 @@ Evas_Object* ewk_history_item_icon_object_add(const Ewk_History_Item* item, Evas
     EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
     EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
 
-    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));
-    if (!icon) {
+    RefPtr<cairo_surface_t> surface = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));
+    if (!surface) {
         ERR("icon is NULL.");
         return 0;
     }
 
-    cairo_surface_t* surface = icon->surface();
-    return surface ? WebCore::evasObjectFromCairoImageSurface(canvas, surface).leakRef() : 0;
+    return surface ? WebCore::evasObjectFromCairoImageSurface(canvas, surface.get()).leakRef() : 0;
 }
 
 Eina_Bool ewk_history_item_page_cache_exists(const Ewk_History_Item* item)
index 627f6fa..395c55a 100644 (file)
@@ -213,11 +213,11 @@ cairo_surface_t* ewk_settings_icon_database_icon_surface_get(const char* url)
     EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
 
     WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
-    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
+    RefPtr<cairo_surface_t> icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
     if (!icon)
         ERR("no icon for url %s", url);
 
-    return icon ? icon->surface() : 0;
+    return icon.get();
 }
 
 Evas_Object* ewk_settings_icon_database_icon_object_get(const char* url, Evas* canvas)
@@ -226,15 +226,14 @@ Evas_Object* ewk_settings_icon_database_icon_object_get(const char* url, Evas* c
     EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
 
     WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
-    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
+    RefPtr<cairo_surface_t> surface = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
 
-    if (!icon) {
+    if (!surface) {
         ERR("no icon for url %s", url);
         return 0;
     }
 
-    cairo_surface_t* surface = icon->surface();
-    return surface ? WebCore::evasObjectFromCairoImageSurface(canvas, surface).leakRef() : 0;
+    return surface ? WebCore::evasObjectFromCairoImageSurface(canvas, surface.get()).leakRef() : 0;
 }
 
 void ewk_settings_object_cache_capacity_set(unsigned minDeadCapacity, unsigned maxDeadCapacity, unsigned totalCapacity)
index 4a09331..a078af5 100644 (file)
@@ -1,3 +1,16 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Update code now that PassNativeImagePtr is now a typedef to PassRefPtr<cairo_surface_t>
+        instead of NativeImageCairo*.
+
+        * webkit/webkitfavicondatabase.cpp:
+        (getIconPixbufSynchronously):
+
 2013-04-03  Alban Crequy  <alban.crequy@collabora.co.uk>
 
         [GTK] WebKitWebNavigationAction: fix mix between dispose and finalize
index 4ea163c..654ef2b 100644 (file)
@@ -392,11 +392,11 @@ static GdkPixbuf* getIconPixbufSynchronously(WebKitFaviconDatabase* database, co
 
     // The exact size we pass is irrelevant to the iconDatabase code.
     // We must pass something greater than 0x0 to get a pixbuf.
-    NativeImagePtr icon = iconDatabase().synchronousNativeIconForPageURL(pageURL, !iconSize.isZero() ? iconSize : IntSize(1, 1));
-    if (!icon)
+    RefPtr<cairo_surface_t> surface = iconDatabase().synchronousNativeIconForPageURL(pageURL, !iconSize.isZero() ? iconSize : IntSize(1, 1));
+    if (!surface)
         return 0;
 
-    GRefPtr<GdkPixbuf> pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(icon->surface()));
+    GRefPtr<GdkPixbuf> pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(surface.get()));
     if (!pixbuf)
         return 0;
 
index 4d2ab88..10577e0 100644 (file)
@@ -1,3 +1,14 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Remove outdated symbols now that NativeImageCairo was removed.
+
+        * WebKit.vcproj/WebKitExports.def.in:
+
 2013-04-03  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
 
         Should close select popup when the element loses focus
index a672c82..39a33a8 100644 (file)
@@ -370,9 +370,6 @@ EXPORTS
         ?getCGImageRef@BitmapImage@WebCore@@UAEPAUCGImage@@XZ
         ?getFirstCGImageRefOfSize@BitmapImage@WebCore@@UAEPAUCGImage@@ABVIntSize@2@@Z
         ?getCGImageArray@BitmapImage@WebCore@@UAE?AV?$RetainPtr@PBU__CFArray@@@WTF@@XZ
-#elif USE(CAIRO)
-        ?nativeImageForCurrentFrame@BitmapImage@WebCore@@UAEPAVNativeImageCairo@2@XZ
-        ?frameAtIndex@BitmapImage@WebCore@@IAEPAVNativeImageCairo@2@I@Z
 #endif
         ?getHBITMAP@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@@Z
         ?getHBITMAPOfSize@BitmapImage@WebCore@@UAE_NPAUHBITMAP__@@PAUtagSIZE@@@Z
index fe97609..40815be 100644 (file)
@@ -1,3 +1,20 @@
+2013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [Cairo] Fix canvas drawing of SVG-based patterns and remove NativeImageCairo
+        https://bugs.webkit.org/show_bug.cgi?id=113929
+
+        Reviewed by Martin Robinson.
+
+        Update code now that PassNativeImagePtr is now a typedef to PassRefPtr<cairo_surface_t>
+        instead of NativeImageCairo*.
+
+        * Shared/gtk/ArgumentCodersGtk.cpp:
+        (CoreIPC::decodeImage):
+        * UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp:
+        (WKIconDatabaseTryGetCairoSurfaceForURL):
+        * UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
+        (getIconSurfaceSynchronously):
+
 2013-04-04  Sze Howe Koh  <szehowe.koh@gmail.com>
 
         [Qt] docs: Fix module name format
index 3969e0c..f7e76e7 100644 (file)
@@ -71,14 +71,11 @@ static bool decodeImage(ArgumentDecoder& decoder, GRefPtr<GdkPixbuf>& pixbuf)
     if (!image)
         return false;
 
-    NativeImageCairo* nativeImage = image->nativeImageForCurrentFrame();
-    if (!nativeImage)
+    RefPtr<cairo_surface_t> surface = image->nativeImageForCurrentFrame();
+    if (!surface)
         return false;
 
-    cairo_surface_t* surface = nativeImage->surface();
-    pixbuf = adoptGRef(gdk_pixbuf_get_from_surface(surface, 0, 0,
-                                                   cairo_image_surface_get_width(surface),
-                                                   cairo_image_surface_get_height(surface)));
+    pixbuf = adoptGRef(gdk_pixbuf_get_from_surface(surface.get(), 0, 0, cairo_image_surface_get_width(surface.get()), cairo_image_surface_get_height(surface.get())));
     if (!pixbuf)
         return false;
 
index 15558cc..118c4d8 100644 (file)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "WKIconDatabaseCairo.h"
 
-#include "NativeImageCairo.h"
 #include "WKAPICast.h"
 #include "WebIconDatabase.h"
 
@@ -35,7 +34,5 @@ using namespace WebKit;
 
 cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url)
 {
-    NativeImageCairo* nativeImage = toImpl(iconDatabase)->nativeImageForPageURL(toWTFString(url));
-
-    return nativeImage ? nativeImage->surface() : 0;
+    return toImpl(iconDatabase)->nativeImageForPageURL(toWTFString(url)).get();
 }
index 9bbac00..6aad04a 100644 (file)
@@ -130,7 +130,7 @@ struct GetFaviconSurfaceAsyncData {
 };
 WEBKIT_DEFINE_ASYNC_DATA_STRUCT(GetFaviconSurfaceAsyncData)
 
-static cairo_surface_t* getIconSurfaceSynchronously(WebKitFaviconDatabase* database, const String& pageURL, GError** error)
+static PassRefPtr<cairo_surface_t> getIconSurfaceSynchronously(WebKitFaviconDatabase* database, const String& pageURL, GError** error)
 {
     ASSERT(isMainThread());
 
@@ -142,13 +142,13 @@ static cairo_surface_t* getIconSurfaceSynchronously(WebKitFaviconDatabase* datab
         return 0;
     }
 
-    WebCore::NativeImagePtr icon = iconImage->nativeImageForCurrentFrame();
-    if (!icon) {
+    RefPtr<cairo_surface_t> surface = iconImage->nativeImageForCurrentFrame();
+    if (!surface) {
         g_set_error(error, WEBKIT_FAVICON_DATABASE_ERROR, WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND, _("Page %s does not have a favicon"), pageURL.utf8().data());
         return 0;
     }
 
-    return icon->surface();
+    return surface.release();
 }
 
 static void deletePendingIconRequests(WebKitFaviconDatabase* database, PendingIconRequestVector* requests, const String& pageURL)