Bug 1087732 - Get rid of the gfxContext::GetCairo call in nsNativeThemeGTK::DrawWidgetBackground. r=mattwoodrow
authorJonathan Watt <jwatt@jwatt.org>
Fri, 24 Oct 2014 08:26:27 +0100
changeset 212078 4ded53bfb503183e0c97273938498857187f9f92
parent 212077 d2836e069aef6d8ce2cd6aad02cebcc8a1a3b57e
child 212079 3c8d2d2871be6257908aa875f46564b0eec32e53
push id27697
push usercbook@mozilla.com
push dateFri, 24 Oct 2014 13:48:53 +0000
treeherdermozilla-central@de805196bbc4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1087732
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1087732 - Get rid of the gfxContext::GetCairo call in nsNativeThemeGTK::DrawWidgetBackground. r=mattwoodrow
widget/gtk/nsNativeThemeGTK.cpp
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -778,16 +778,20 @@ nsNativeThemeGTK::GetExtraSizeForWidget(
 
 NS_IMETHODIMP
 nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
                                        nsIFrame* aFrame,
                                        uint8_t aWidgetType,
                                        const nsRect& aRect,
                                        const nsRect& aDirtyRect)
 {
+#if (MOZ_WIDGET_GTK != 2)
+  DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
+#endif
+
   GtkWidgetState state;
   GtkThemeWidgetType gtkWidgetType;
   GtkTextDirection direction = GetTextDirection(aFrame);
   gint flags;
   if (!GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, &state,
                             &flags))
     return NS_OK;
 
@@ -871,17 +875,20 @@ nsNativeThemeGTK::DrawWidgetBackground(n
   }
 
   // GtkStyles (used by the widget drawing backend) are created for a
   // particular colormap/visual.
   GdkColormap* colormap = moz_gtk_widget_get_colormap();
 
   renderer.Draw(ctx, drawingRect.Size(), rendererFlags, colormap);
 #else 
-  moz_gtk_widget_paint(gtkWidgetType, ctx->GetCairo(), &gdk_rect, 
+  cairo_t *ctx =
+    (cairo_t*)aDrawTarget->GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT); 
+  MOZ_ASSERT(ctx);
+  moz_gtk_widget_paint(gtkWidgetType, ctx, &gdk_rect, 
                        &state, flags, direction);
 #endif
 
   if (!safeState) {
     gdk_flush();
     gLastGdkError = gdk_error_trap_pop ();
 
     if (gLastGdkError) {