[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mrobinson at webkit.org
mrobinson at webkit.org
Wed Dec 22 15:25:22 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 0ba306884546c1e5cdadd3478c74c1e03481c9c6
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Nov 3 02:23:03 2010 +0000
2010-11-02 Martin Robinson <mrobinson at igalia.com>
Reviewed by Adam Barth.
[Cairo] Remove PlatformRefPtrCairo
https://bugs.webkit.org/show_bug.cgi?id=48192
Replace PlatformRefPtrCairo with a RefPtr specialization for Cairo and
Fontconfig types. This is the first step toward removing PlatformRefPtr,
whose job is better handled by RefPtr.
* CMakeListsEfl.txt: Update the sources list to include RefPtrCairo
instead of PlatformRefPtrCairo.
* GNUmakefile.am: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* platform/graphics/GraphicsContext.h: Replace PlatformRefPtrCairo with
RefPtrCairo.
* platform/graphics/cairo/CairoUtilities.cpp: Ditto.
(WebCore::drawPatternToCairoContext): Ditto.
* platform/graphics/cairo/FontCacheFreeType.cpp: Ditto.
(WebCore::FontCache::getFontDataForCharacters): Ditto.
(WebCore::FontCache::createFontPlatformData): Ditto.
* platform/graphics/cairo/FontPlatformDataFreeType.cpp: Ditto.
(WebCore::FontPlatformData::FontPlatformData): Ditto.
(WebCore::FontPlatformData::initializeWithFontFace): Ditto.
* platform/graphics/cairo/FontPlatformDataFreeType.h: Ditto.
* platform/graphics/cairo/GraphicsContextCairo.cpp: Ditto.
* platform/graphics/cairo/ImageCairo.cpp: Ditto.
* platform/graphics/cairo/RefPtrCairo.cpp: Renamed from WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp.
(WTF::refIfNotNull): Added.
(WTF::derefIfNotNull): Added.
* platform/graphics/cairo/RefPtrCairo.h: Renamed from WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h.
* platform/gtk/CursorGtk.cpp: Replace PlatformRefPtrCairo with
RefPtrCairo.
(WebCore::createNamedCursor): Ditto.
* platform/gtk/DragImageGtk.cpp: Ditto.
(WebCore::scaleDragImage): Ditto.
(WebCore::dissolveDragImageToFraction): Ditto.
* plugins/gtk/PluginViewGtk.cpp: Ditto.
(WebCore::PluginView::paint): Ditto.
2010-11-02 Martin Robinson <mrobinson at igalia.com>
Reviewed by Adam Barth.
[Cairo] Remove PlatformRefPtrCairo
https://bugs.webkit.org/show_bug.cgi?id=48192
Replace instances of PlatformRefPtr smart pointers that wrap Cairo
types with RefPtrs.
* WebCoreSupport/DragClientGtk.cpp: Use RefPtr instead of PlatformRefPtr.
(WebKit::dragIconWindowDrawEventCallback):
* WebCoreSupport/DragClientGtk.h: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/CMakeListsEfl.txt b/WebCore/CMakeListsEfl.txt
index 3397bc2..18fedc3 100644
--- a/WebCore/CMakeListsEfl.txt
+++ b/WebCore/CMakeListsEfl.txt
@@ -81,7 +81,7 @@ IF (WTF_PLATFORM_CAIRO)
platform/graphics/cairo/OwnPtrCairo.cpp
platform/graphics/cairo/PathCairo.cpp
platform/graphics/cairo/PatternCairo.cpp
- platform/graphics/cairo/PlatformRefPtrCairo.cpp
+ platform/graphics/cairo/RefPtrCairo.cpp
platform/graphics/cairo/SimpleFontDataCairo.cpp
platform/graphics/cairo/TransformationMatrixCairo.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d7557c5..64cc08c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,44 @@
+2010-11-02 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Adam Barth.
+
+ [Cairo] Remove PlatformRefPtrCairo
+ https://bugs.webkit.org/show_bug.cgi?id=48192
+
+ Replace PlatformRefPtrCairo with a RefPtr specialization for Cairo and
+ Fontconfig types. This is the first step toward removing PlatformRefPtr,
+ whose job is better handled by RefPtr.
+
+ * CMakeListsEfl.txt: Update the sources list to include RefPtrCairo
+ instead of PlatformRefPtrCairo.
+ * GNUmakefile.am: Ditto.
+ * WebCore.vcproj/WebCore.vcproj: Ditto.
+ * platform/graphics/GraphicsContext.h: Replace PlatformRefPtrCairo with
+ RefPtrCairo.
+ * platform/graphics/cairo/CairoUtilities.cpp: Ditto.
+ (WebCore::drawPatternToCairoContext): Ditto.
+ * platform/graphics/cairo/FontCacheFreeType.cpp: Ditto.
+ (WebCore::FontCache::getFontDataForCharacters): Ditto.
+ (WebCore::FontCache::createFontPlatformData): Ditto.
+ * platform/graphics/cairo/FontPlatformDataFreeType.cpp: Ditto.
+ (WebCore::FontPlatformData::FontPlatformData): Ditto.
+ (WebCore::FontPlatformData::initializeWithFontFace): Ditto.
+ * platform/graphics/cairo/FontPlatformDataFreeType.h: Ditto.
+ * platform/graphics/cairo/GraphicsContextCairo.cpp: Ditto.
+ * platform/graphics/cairo/ImageCairo.cpp: Ditto.
+ * platform/graphics/cairo/RefPtrCairo.cpp: Renamed from WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp.
+ (WTF::refIfNotNull): Added.
+ (WTF::derefIfNotNull): Added.
+ * platform/graphics/cairo/RefPtrCairo.h: Renamed from WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h.
+ * platform/gtk/CursorGtk.cpp: Replace PlatformRefPtrCairo with
+ RefPtrCairo.
+ (WebCore::createNamedCursor): Ditto.
+ * platform/gtk/DragImageGtk.cpp: Ditto.
+ (WebCore::scaleDragImage): Ditto.
+ (WebCore::dissolveDragImageToFraction): Ditto.
+ * plugins/gtk/PluginViewGtk.cpp: Ditto.
+ (WebCore::PluginView::paint): Ditto.
+
2010-11-02 Chris Rogers <crogers at google.com>
Reviewed by Kenneth Russell.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 983b05e..16bdaec 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -3519,8 +3519,8 @@ webcoregtk_sources += \
WebCore/platform/graphics/cairo/OwnPtrCairo.h \
WebCore/platform/graphics/cairo/PathCairo.cpp \
WebCore/platform/graphics/cairo/PatternCairo.cpp \
- WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp \
- WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h \
+ WebCore/platform/graphics/cairo/RefPtrCairo.cpp \
+ WebCore/platform/graphics/cairo/RefPtrCairo.h \
WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \
WebCore/platform/graphics/gstreamer/DataSourceGStreamer.cpp \
WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index d3e3e7c..efe3559 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -27426,7 +27426,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\graphics\cairo\PlatformRefPtrCairo.cpp"
+ RelativePath="..\platform\graphics\cairo\RefPtrCairo.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -27462,7 +27462,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\graphics\cairo\PlatformRefPtrCairo.h"
+ RelativePath="..\platform\graphics\cairo\RefPtrCairo.h"
>
<FileConfiguration
Name="Debug|Win32"
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index f2606a3..592bf6f 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -40,7 +40,6 @@
#if PLATFORM(CG)
typedef struct CGContext PlatformGraphicsContext;
#elif PLATFORM(CAIRO)
-#include "PlatformRefPtrCairo.h"
namespace WebCore {
class ContextShadow;
}
diff --git a/WebCore/platform/graphics/cairo/CairoUtilities.cpp b/WebCore/platform/graphics/cairo/CairoUtilities.cpp
index 7af5577..709ee8f 100644
--- a/WebCore/platform/graphics/cairo/CairoUtilities.cpp
+++ b/WebCore/platform/graphics/cairo/CairoUtilities.cpp
@@ -34,7 +34,7 @@
#include "IntRect.h"
#include "OwnPtrCairo.h"
#include "Path.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
#include <wtf/Vector.h>
namespace WebCore {
@@ -126,11 +126,11 @@ void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSiz
cairo_save(cr);
- PlatformRefPtr<cairo_surface_t> clippedImageSurface = 0;
+ RefPtr<cairo_surface_t> clippedImageSurface = 0;
if (tileRect.size() != imageSize) {
IntRect imageRect = enclosingIntRect(tileRect);
- clippedImageSurface = adoptPlatformRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, imageRect.width(), imageRect.height()));
- PlatformRefPtr<cairo_t> clippedImageContext(cairo_create(clippedImageSurface.get()));
+ clippedImageSurface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, imageRect.width(), imageRect.height()));
+ RefPtr<cairo_t> clippedImageContext(cairo_create(clippedImageSurface.get()));
cairo_set_source_surface(clippedImageContext.get(), image, -tileRect.x(), -tileRect.y());
cairo_paint(clippedImageContext.get());
image = clippedImageSurface.get();
diff --git a/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp b/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp
index cd9ee46..61ee625 100644
--- a/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp
@@ -25,7 +25,7 @@
#include "CString.h"
#include "Font.h"
#include "OwnPtrCairo.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
#include "SimpleFontData.h"
#include <cairo-ft.h>
#include <cairo.h>
@@ -83,17 +83,17 @@ FcPattern* findBestFontGivenFallbacks(const FontPlatformData& fontData, FcPatter
const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
- PlatformRefPtr<FcPattern> pattern = adoptPlatformRef(createFontConfigPatternForCharacters(characters, length));
+ RefPtr<FcPattern> pattern = adoptRef(createFontConfigPatternForCharacters(characters, length));
const FontPlatformData& fontData = font.primaryFont()->platformData();
- PlatformRefPtr<FcPattern> fallbackPattern = adoptPlatformRef(findBestFontGivenFallbacks(fontData, pattern.get()));
+ RefPtr<FcPattern> fallbackPattern = adoptRef(findBestFontGivenFallbacks(fontData, pattern.get()));
if (fallbackPattern) {
FontPlatformData alternateFontData(fallbackPattern.get(), font.fontDescription());
return getCachedFontData(&alternateFontData);
}
FcResult fontConfigResult;
- PlatformRefPtr<FcPattern> resultPattern = adoptPlatformRef(FcFontMatch(0, pattern.get(), &fontConfigResult));
+ RefPtr<FcPattern> resultPattern = adoptRef(FcFontMatch(0, pattern.get(), &fontConfigResult));
if (!resultPattern)
return 0;
FontPlatformData alternateFontData(resultPattern.get(), font.fontDescription());
@@ -147,7 +147,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
// The CSS font matching algorithm (http://www.w3.org/TR/css3-fonts/#font-matching-algorithm)
// says that we must find an exact match for font family, slant (italic or oblique can be used)
// and font weight (we only match bold/non-bold here).
- PlatformRefPtr<FcPattern> pattern = adoptPlatformRef(FcPatternCreate());
+ RefPtr<FcPattern> pattern = adoptRef(FcPatternCreate());
String familyNameString(getFamilyNameStringFromFontDescriptionAndFamily(fontDescription, family));
if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(familyNameString.utf8().data())))
return 0;
@@ -174,7 +174,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
String familyNameAfterConfiguration = String::fromUTF8(reinterpret_cast<char*>(fontConfigFamilyNameAfterConfiguration));
FcResult fontConfigResult;
- PlatformRefPtr<FcPattern> resultPattern = adoptPlatformRef(FcFontMatch(0, pattern.get(), &fontConfigResult));
+ RefPtr<FcPattern> resultPattern = adoptRef(FcFontMatch(0, pattern.get(), &fontConfigResult));
if (!resultPattern) // No match.
return 0;
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
index ebbc50d..394082d 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
@@ -122,7 +122,7 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
, m_fixedWidth(false)
, m_scaledFont(0)
{
- PlatformRefPtr<cairo_font_face_t> fontFace = adoptPlatformRef(cairo_ft_font_face_create_for_pattern(m_pattern.get()));
+ RefPtr<cairo_font_face_t> fontFace = adoptRef(cairo_ft_font_face_create_for_pattern(m_pattern.get()));
initializeWithFontFace(fontFace.get());
int spacing;
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
index 8c0bde8..016489e 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
@@ -29,7 +29,7 @@
#include "FontDescription.h"
#include "GlyphBuffer.h"
#include "HashFunctions.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
#include <wtf/Forward.h>
typedef struct _FcFontSet FcFontSet;
@@ -86,7 +86,7 @@ public:
String description() const;
#endif
- PlatformRefPtr<FcPattern> m_pattern;
+ RefPtr<FcPattern> m_pattern;
mutable FcFontSet* m_fallbacks; // Initialized lazily.
float m_size;
bool m_syntheticBold;
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 7eb01b9..755adff 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -46,7 +46,7 @@
#include "NotImplemented.h"
#include "Path.h"
#include "Pattern.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
#include "SimpleFontData.h"
#include <cairo.h>
#include <math.h>
diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp
index 8f7a194..0ac3955 100644
--- a/WebCore/platform/graphics/cairo/ImageCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp
@@ -35,10 +35,10 @@
#include "Color.h"
#include "ContextShadow.h"
#include "FloatRect.h"
-#include "PlatformRefPtrCairo.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "ImageObserver.h"
+#include "RefPtrCairo.h"
#include <cairo.h>
#include <math.h>
#include <wtf/OwnPtr.h>
diff --git a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp
deleted file mode 100644
index d289585..0000000
--- a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2010 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "PlatformRefPtrCairo.h"
-
-#include <cairo.h>
-
-#if defined(USE_FREETYPE)
-#include <cairo-ft.h>
-#include <fontconfig/fcfreetype.h>
-#endif
-
-namespace WTF {
-
-template <> cairo_t* refPlatformPtr(cairo_t* ptr)
-{
- if (ptr)
- cairo_reference(ptr);
- return ptr;
-}
-
-template <> void derefPlatformPtr(cairo_t* ptr)
-{
- if (ptr)
- cairo_destroy(ptr);
-}
-
-template <> cairo_surface_t* refPlatformPtr(cairo_surface_t* ptr)
-{
- if (ptr)
- cairo_surface_reference(ptr);
- return ptr;
-}
-
-template <> void derefPlatformPtr(cairo_surface_t* ptr)
-{
- if (ptr)
- cairo_surface_destroy(ptr);
-}
-
-template <> cairo_font_face_t* refPlatformPtr(cairo_font_face_t* ptr)
-{
- if (ptr)
- cairo_font_face_reference(ptr);
- return ptr;
-}
-
-template <> void derefPlatformPtr(cairo_font_face_t* ptr)
-{
- if (ptr)
- cairo_font_face_destroy(ptr);
-}
-
-template <> cairo_scaled_font_t* refPlatformPtr(cairo_scaled_font_t* ptr)
-{
- if (ptr)
- cairo_scaled_font_reference(ptr);
- return ptr;
-}
-
-template <> void derefPlatformPtr(cairo_scaled_font_t* ptr)
-{
- if (ptr)
- cairo_scaled_font_destroy(ptr);
-}
-
-#if defined(USE_FREETYPE)
-template <> FcPattern* refPlatformPtr(FcPattern* ptr)
-{
- if (ptr)
- FcPatternReference(ptr);
- return ptr;
-}
-
-template <> void derefPlatformPtr(FcPattern* ptr)
-{
- if (ptr)
- FcPatternDestroy(ptr);
-}
-#endif
-
-}
diff --git a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h
deleted file mode 100644
index 3b720c6..0000000
--- a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2010 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef PlatformRefPtrCairo_h
-#define PlatformRefPtrCairo_h
-
-#include "PlatformRefPtr.h"
-
-typedef struct _cairo cairo_t;
-typedef struct _cairo_surface cairo_surface_t;
-typedef struct _cairo_font_face cairo_font_face_t;
-typedef struct _cairo_scaled_font cairo_scaled_font_t;
-
-#if defined(USE_FREETYPE)
-typedef struct _FcPattern FcPattern;
-#endif
-
-namespace WTF {
-
-template <> cairo_t* refPlatformPtr(cairo_t* ptr);
-template <> void derefPlatformPtr(cairo_t* ptr);
-
-template <> cairo_surface_t* refPlatformPtr(cairo_surface_t* ptr);
-template <> void derefPlatformPtr(cairo_surface_t* ptr);
-
-template <> cairo_font_face_t* refPlatformPtr(cairo_font_face_t*);
-template <> void derefPlatformPtr(cairo_font_face_t*);
-
-template <> cairo_scaled_font_t* refPlatformPtr(cairo_scaled_font_t*);
-template <> void derefPlatformPtr(cairo_scaled_font_t*);
-
-#if defined(USE_FREETYPE)
-template <> FcPattern* refPlatformPtr(FcPattern*);
-template <> void derefPlatformPtr(FcPattern*);
-#endif
-
-}
-
-#endif
diff --git a/WebCore/platform/graphics/cairo/RefPtrCairo.cpp b/WebCore/platform/graphics/cairo/RefPtrCairo.cpp
new file mode 100644
index 0000000..a6c983e
--- /dev/null
+++ b/WebCore/platform/graphics/cairo/RefPtrCairo.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RefPtrCairo.h"
+
+#include <cairo.h>
+
+#if defined(USE_FREETYPE)
+#include <cairo-ft.h>
+#include <fontconfig/fcfreetype.h>
+#endif
+
+namespace WTF {
+
+template<> void refIfNotNull(cairo_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_reference(ptr);
+}
+
+template<> void derefIfNotNull(cairo_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_destroy(ptr);
+}
+
+template<> void refIfNotNull(cairo_surface_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_surface_reference(ptr);
+}
+
+template<> void derefIfNotNull(cairo_surface_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_surface_destroy(ptr);
+}
+
+template<> void refIfNotNull(cairo_font_face_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_font_face_reference(ptr);
+}
+
+template<> void derefIfNotNull(cairo_font_face_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_font_face_reference(ptr);
+}
+
+template<> void refIfNotNull(cairo_scaled_font_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_scaled_font_reference(ptr);
+}
+
+template<> void derefIfNotNull(cairo_scaled_font_t* ptr)
+{
+ if (LIKELY(ptr != 0))
+ cairo_scaled_font_destroy(ptr);
+}
+
+#if defined(USE_FREETYPE)
+template<> void refIfNotNull(FcPattern* ptr)
+{
+ if (LIKELY(ptr != 0))
+ FcPatternReference(ptr);
+}
+
+template<> void derefIfNotNull(FcPattern* ptr)
+{
+ if (LIKELY(ptr != 0))
+ FcPatternDestroy(ptr);
+}
+
+#endif
+
+}
diff --git a/WebCore/platform/graphics/cairo/RefPtrCairo.h b/WebCore/platform/graphics/cairo/RefPtrCairo.h
new file mode 100644
index 0000000..0429ec5
--- /dev/null
+++ b/WebCore/platform/graphics/cairo/RefPtrCairo.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RefPtrCairo_h
+#define RefPtrCairo_h
+
+#include "RefPtr.h"
+
+typedef struct _cairo cairo_t;
+typedef struct _cairo_surface cairo_surface_t;
+typedef struct _cairo_font_face cairo_font_face_t;
+typedef struct _cairo_scaled_font cairo_scaled_font_t;
+
+#if defined(USE_FREETYPE)
+typedef struct _FcPattern FcPattern;
+#endif
+
+namespace WTF {
+
+template<> void refIfNotNull(cairo_t* ptr);
+template<> void derefIfNotNull(cairo_t* ptr);
+
+template<> void refIfNotNull(cairo_surface_t* ptr);
+template<> void derefIfNotNull(cairo_surface_t* ptr);
+
+template<> void refIfNotNull(cairo_font_face_t* ptr);
+template<> void derefIfNotNull(cairo_font_face_t* ptr);
+
+template<> void refIfNotNull(cairo_scaled_font_t* ptr);
+template<> void derefIfNotNull(cairo_scaled_font_t* ptr);
+
+#if defined(USE_FREETYPE)
+template<> void refIfNotNull(FcPattern* ptr);
+template<> void derefIfNotNull(FcPattern* ptr);
+#endif
+
+}
+
+#endif // RefPtrCairo_h
diff --git a/WebCore/platform/gtk/CursorGtk.cpp b/WebCore/platform/gtk/CursorGtk.cpp
index 9971bfb..39073ae 100644
--- a/WebCore/platform/gtk/CursorGtk.cpp
+++ b/WebCore/platform/gtk/CursorGtk.cpp
@@ -32,7 +32,7 @@
#include "Image.h"
#include "IntPoint.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <wtf/Assertions.h>
@@ -47,10 +47,10 @@ static PlatformRefPtr<GdkCursor> createNamedCursor(CustomCursorType cursorType)
return c;
IntSize cursorSize = IntSize(32, 32);
- PlatformRefPtr<cairo_surface_t> source = adoptPlatformRef(cairo_image_surface_create_for_data(const_cast<unsigned char*>(cursor.bits), CAIRO_FORMAT_A1, 32, 32, 4));
- PlatformRefPtr<cairo_surface_t> mask = adoptPlatformRef(cairo_image_surface_create_for_data(const_cast<unsigned char*>(cursor.mask_bits), CAIRO_FORMAT_A1, 32, 32, 4));
- PlatformRefPtr<cairo_surface_t> surface = adoptPlatformRef(cairo_image_surface_create(CAIRO_FORMAT_A1, 32, 32));
- PlatformRefPtr<cairo_t> cr = adoptPlatformRef(cairo_create(surface.get()));
+ RefPtr<cairo_surface_t> source = adoptRef(cairo_image_surface_create_for_data(const_cast<unsigned char*>(cursor.bits), CAIRO_FORMAT_A1, 32, 32, 4));
+ RefPtr<cairo_surface_t> mask = adoptRef(cairo_image_surface_create_for_data(const_cast<unsigned char*>(cursor.mask_bits), CAIRO_FORMAT_A1, 32, 32, 4));
+ RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_A1, 32, 32));
+ RefPtr<cairo_t> cr = adoptRef(cairo_create(surface.get()));
cairo_set_source_surface(cr.get(), source.get(), cursor.hot_x, cursor.hot_y);
cairo_mask_surface(cr.get(), mask.get(), cursor.hot_x, cursor.hot_y);
diff --git a/WebCore/platform/gtk/DragImageGtk.cpp b/WebCore/platform/gtk/DragImageGtk.cpp
index 9d0d838..71a65e1 100644
--- a/WebCore/platform/gtk/DragImageGtk.cpp
+++ b/WebCore/platform/gtk/DragImageGtk.cpp
@@ -21,7 +21,7 @@
#include "CachedImage.h"
#include "Image.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
#include <cairo.h>
namespace WebCore {
@@ -49,7 +49,7 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize scale)
int newHeight = scale.height() * cairo_image_surface_get_height(image);
cairo_surface_t* scaledSurface = cairo_surface_create_similar(image, CAIRO_CONTENT_COLOR_ALPHA, newWidth, newHeight);
- PlatformRefPtr<cairo_t> context = adoptPlatformRef(cairo_create(scaledSurface));
+ RefPtr<cairo_t> context = adoptRef(cairo_create(scaledSurface));
cairo_scale(context.get(), scale.width(), scale.height());
cairo_pattern_set_extend(cairo_get_source(context.get()), CAIRO_EXTEND_PAD);
cairo_pattern_set_filter(cairo_get_source(context.get()), CAIRO_FILTER_BEST);
@@ -66,7 +66,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction)
if (!image)
return 0;
- PlatformRefPtr<cairo_t> context = adoptPlatformRef(cairo_create(image));
+ RefPtr<cairo_t> context = adoptRef(cairo_create(image));
cairo_set_operator(context.get(), CAIRO_OPERATOR_DEST_IN);
cairo_set_source_rgba(context.get(), 0, 0, 0, fraction);
cairo_paint(context.get());
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index 80641a1..6608f6c 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -66,6 +66,7 @@
#include <gtk/gtk.h>
#if defined(XP_UNIX)
+#include "RefPtrCairo.h"
#include "gtk2xtbin.h"
#define Bool int // this got undefined somewhere
#define Status int // ditto
@@ -195,18 +196,18 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
exposedRect.intersect(frameRect());
exposedRect.move(-frameRect().x(), -frameRect().y());
- PlatformRefPtr<cairo_surface_t> drawableSurface = adoptPlatformRef(cairo_xlib_surface_create(display,
- m_drawable,
- m_visual,
- m_windowRect.width(),
- m_windowRect.height()));
+ RefPtr<cairo_surface_t> drawableSurface = adoptRef(cairo_xlib_surface_create(display,
+ m_drawable,
+ m_visual,
+ m_windowRect.width(),
+ m_windowRect.height()));
if (m_isTransparent) {
// If we have a 32 bit drawable and the plugin wants transparency,
// we'll clear the exposed area to transparent first. Otherwise,
// we'd end up with junk in there from the last paint, or, worse,
// uninitialized data.
- PlatformRefPtr<cairo_t> cr = adoptPlatformRef(cairo_create(drawableSurface.get()));
+ RefPtr<cairo_t> cr = adoptRef(cairo_create(drawableSurface.get()));
if (!(cairo_surface_get_content(drawableSurface.get()) & CAIRO_CONTENT_ALPHA)) {
// Attempt to fake it when we don't have an alpha channel on our
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 19f251d..06a923a 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-02 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Adam Barth.
+
+ [Cairo] Remove PlatformRefPtrCairo
+ https://bugs.webkit.org/show_bug.cgi?id=48192
+
+ Replace instances of PlatformRefPtr smart pointers that wrap Cairo
+ types with RefPtrs.
+
+ * WebCoreSupport/DragClientGtk.cpp: Use RefPtr instead of PlatformRefPtr.
+ (WebKit::dragIconWindowDrawEventCallback):
+ * WebCoreSupport/DragClientGtk.h: Ditto.
+
2010-11-02 Daniel Bates <dbates at rim.com>
Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
index b850cec..be0fb10 100644
--- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
@@ -44,7 +44,7 @@ namespace WebKit {
#ifdef GTK_API_VERSION_2
static gboolean dragIconWindowDrawEventCallback(GtkWidget* widget, GdkEventExpose* event, DragClient* client)
{
- PlatformRefPtr<cairo_t> context = adoptPlatformRef(gdk_cairo_create(event->window));
+ RefPtr<cairo_t> context = adoptRef(gdk_cairo_create(event->window));
client->drawDragIconWindow(widget, context.get());
return TRUE;
}
diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.h b/WebKit/gtk/WebCoreSupport/DragClientGtk.h
index 0d07c88..086ec69 100644
--- a/WebKit/gtk/WebCoreSupport/DragClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.h
@@ -32,7 +32,7 @@
#include "DragClient.h"
#include "GRefPtr.h"
-#include "PlatformRefPtrCairo.h"
+#include "RefPtrCairo.h"
typedef struct _WebKitWebView WebKitWebView;
@@ -60,7 +60,7 @@ namespace WebKit {
WebKitWebView* m_webView;
WebCore::IntPoint m_startPos;
PlatformRefPtr<GtkWidget> m_dragIconWindow;
- PlatformRefPtr<cairo_surface_t> m_dragImage;
+ RefPtr<cairo_surface_t> m_dragImage;
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list