diff options
Diffstat (limited to 'webkit/port/platform')
-rw-r--r-- | webkit/port/platform/chromium/RenderThemeGtk.cpp | 8 | ||||
-rw-r--r-- | webkit/port/platform/graphics/PlatformContextSkia.cpp | 13 | ||||
-rw-r--r-- | webkit/port/platform/graphics/PlatformContextSkia.h | 11 | ||||
-rw-r--r-- | webkit/port/platform/graphics/skia/GdkSkia.cc (renamed from webkit/port/platform/chromium/gdkskiadrawable.cc) | 2 | ||||
-rw-r--r-- | webkit/port/platform/graphics/skia/GdkSkia.h (renamed from webkit/port/platform/chromium/gdkskiadrawable.h) | 0 |
5 files changed, 27 insertions, 7 deletions
diff --git a/webkit/port/platform/chromium/RenderThemeGtk.cpp b/webkit/port/platform/chromium/RenderThemeGtk.cpp index 54b3254..9d2f2cd 100644 --- a/webkit/port/platform/chromium/RenderThemeGtk.cpp +++ b/webkit/port/platform/chromium/RenderThemeGtk.cpp @@ -29,7 +29,7 @@ #include "PlatformContextSkia.h" #include "RenderObject.h" #include "gtkdrawing.h" -#include "gdkskiadrawable.h" +#include "GdkSkia.h" #include <gdk/gdk.h> @@ -183,13 +183,9 @@ static bool paintMozWidget(RenderTheme* theme, GtkThemeWidgetType type, RenderOb gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect); - // TODO(agl): we should look at not creating this anew every time. - GdkSkia* skiadrawable = gdk_skia_new(canvas); - const gint r = - moz_gtk_widget_paint(type, skiadrawable, &gdkRect, &gdkClipRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS; + moz_gtk_widget_paint(type, pcs->gdk_skia(), &gdkRect, &gdkClipRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS; - g_object_unref(skiadrawable); return r; } diff --git a/webkit/port/platform/graphics/PlatformContextSkia.cpp b/webkit/port/platform/graphics/PlatformContextSkia.cpp index dd50cb0..fd5cf91 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.cpp +++ b/webkit/port/platform/graphics/PlatformContextSkia.cpp @@ -43,6 +43,10 @@ #include "SkShader.h" #include "SkDashPathEffect.h" +#if defined(OS_LINUX) +#include "GdkSkia.h" +#endif + // State ----------------------------------------------------------------------- // Encapsulates the additional painting state information we store for each @@ -145,10 +149,19 @@ PlatformContextSkia::PlatformContextSkia(gfx::PlatformCanvas* canvas) { m_stateStack.append(State()); m_state = &m_stateStack.last(); +#if defined(OS_LINUX) + m_gdkskia = m_canvas ? gdk_skia_new(m_canvas) : NULL; +#endif } PlatformContextSkia::~PlatformContextSkia() { +#if defined(OS_LINUX) + if (m_gdkskia) { + g_object_unref(m_gdkskia); + m_gdkskia = NULL; + } +#endif } void PlatformContextSkia::setCanvas(gfx::PlatformCanvas* canvas) diff --git a/webkit/port/platform/graphics/PlatformContextSkia.h b/webkit/port/platform/graphics/PlatformContextSkia.h index a0c72e0..c7a16da 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.h +++ b/webkit/port/platform/graphics/PlatformContextSkia.h @@ -40,6 +40,8 @@ #include "GraphicsContext.h" #include "wtf/Vector.h" +typedef struct _GdkDrawable GdkSkia; + // This class holds the platform-specific state for GraphicsContext. We put // most of our Skia wrappers on this class. In theory, a lot of this stuff could // be moved to GraphicsContext directly, except that some code external to this @@ -137,6 +139,10 @@ public: // possible quality. bool IsPrinting(); +#if defined(OS_LINUX) + GdkSkia* gdk_skia() const { return m_gdkskia; } +#endif + private: // Defines drawing style. struct State; @@ -157,6 +163,11 @@ private: // Disallow these. PlatformContextSkia(const PlatformContextSkia&); void operator=(const PlatformContextSkia&); + +#if defined(OS_LINUX) + // A pointer to a GDK Drawable wrapping of this Skia canvas + GdkSkia* m_gdkskia; +#endif }; #endif // PlatformContextSkia_h diff --git a/webkit/port/platform/chromium/gdkskiadrawable.cc b/webkit/port/platform/graphics/skia/GdkSkia.cc index d780014..4774aaf 100644 --- a/webkit/port/platform/chromium/gdkskiadrawable.cc +++ b/webkit/port/platform/graphics/skia/GdkSkia.cc @@ -34,7 +34,7 @@ #include <SkBitmap.h> #include <SkDevice.h> -#include "gdkskiadrawable.h" +#include "GdkSkia.h" static GdkGC *gdk_skia_create_gc (GdkDrawable *drawable, GdkGCValues *values, diff --git a/webkit/port/platform/chromium/gdkskiadrawable.h b/webkit/port/platform/graphics/skia/GdkSkia.h index 6e6b76a..6e6b76a 100644 --- a/webkit/port/platform/chromium/gdkskiadrawable.h +++ b/webkit/port/platform/graphics/skia/GdkSkia.h |