Backout a55eea2c294d (bug 627699) for bustage

This commit is contained in:
Ed Morley 2012-06-13 16:07:22 +01:00
parent c4ba33218a
commit 5e91e96ae5
16 changed files with 35 additions and 146 deletions

View File

@ -8,7 +8,7 @@
#if defined(XP_UNIX)
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include <gdk/gdkx.h>
// we're using default display for now
#define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#define GET_NATIVE_WINDOW(aWidget) GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
@ -32,7 +32,7 @@
#include "gfxCrashReporterUtils.h"
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include "gfxPlatformGtk.h"
#endif
@ -224,7 +224,7 @@ GLXLibrary::EnsureInitialized()
GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_texturefrompixmap,
(GLLibraryLoader::PlatformLookupFunction)&xGetProcAddress))
{
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
mUseTextureFromPixmap = gfxPlatformGtk::UseXRender();
#else
mUseTextureFromPixmap = true;

View File

@ -10,7 +10,7 @@
// Utilities common to all X clients, regardless of UI toolkit.
#if (MOZ_WIDGET_GTK >= 2)
#if defined(MOZ_WIDGET_GTK2)
# include <gdk/gdkx.h>
#elif defined(MOZ_WIDGET_QT)
#include "gfxQtPlatform.h"
@ -33,8 +33,8 @@ namespace mozilla {
inline Display*
DefaultXDisplay()
{
#if (MOZ_WIDGET_GTK >= 2)
return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
#if defined(MOZ_WIDGET_GTK2)
return GDK_DISPLAY();
#elif defined(MOZ_WIDGET_QT)
return gfxQtPlatform::GetXDisplay();
#endif

View File

@ -23,7 +23,7 @@
#include "gfxPDFSurface.h"
#endif
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_ENABLE_GTK2
#include "gfxPSSurface.h"
#elif XP_WIN
#include "gfxWindowsSurface.h"
@ -640,7 +640,7 @@ nsDeviceContext::CalcPrintingSize()
break;
#endif
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_ENABLE_GTK2
case gfxASurface::SurfaceTypePS:
inPoints = true;
size = reinterpret_cast<gfxPSSurface*>(mPrintingSurface.get())->GetSize();

View File

@ -20,7 +20,7 @@
#include "gfxTestCocoaHelper.h"
#endif
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include "gtk/gtk.h"
#endif
@ -297,7 +297,7 @@ main (int argc, char **argv) {
int passed = 0;
int failed = 0;
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
gtk_init(&argc, &argv);
#endif
#ifdef XP_MACOSX

View File

@ -22,7 +22,7 @@
#include "gfxTestCocoaHelper.h"
#endif
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include "gtk/gtk.h"
#endif
@ -106,7 +106,7 @@ PRUint32 iterations = 20;
int
main (int argc, char **argv) {
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
gtk_init(&argc, &argv);
#endif
#ifdef XP_MACOSX

View File

@ -20,7 +20,7 @@
#include "gfxTestCocoaHelper.h"
#endif
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include "gtk/gtk.h"
#endif
@ -93,7 +93,7 @@ MakeContext ()
int
main (int argc, char **argv) {
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
gtk_init(&argc, &argv);
#endif
#ifdef XP_MACOSX

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if (MOZ_WIDGET_GTK >= 2)
#if defined(MOZ_WIDGET_GTK2)
#include "gfxPlatformGtk.h"
#define gfxToolkitPlatform gfxPlatformGtk
#elif defined(MOZ_WIDGET_QT)
@ -97,7 +97,7 @@ gfxFT2FontGroup::gfxFT2FontGroup(const nsAString& families,
QFont defaultFont;
QFontInfo fi (defaultFont);
familyArray.AppendElement(nsDependentString(static_cast<const PRUnichar *>(fi.family().utf16())));
#elif (MOZ_WIDGET_GTK >= 2)
#elif defined(MOZ_WIDGET_GTK2)
FcResult result;
FcChar8 *family = nsnull;
FcPattern* pat = FcPatternCreate();

View File

@ -11,8 +11,6 @@
#include <gdk/gdkx.h>
#include "cairo-xlib.h"
#include "gfxXlibSurface.h"
#if defined(MOZ_WIDGET_GTK2)
nsresult
gfxGdkNativeRenderer::DrawWithXlib(gfxXlibSurface* surface,
nsIntPoint offset,
@ -61,36 +59,4 @@ gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
gfxXlibNativeRenderer::Draw(ctx, size, flags, screen, visual, nsnull);
}
#else
nsresult
gfxGdkNativeRenderer::DrawWithXlib(cairo_t* cr,
nsIntPoint offset,
nsIntRect* clipRects, PRUint32 numClipRects)
{
GdkRectangle clipRect;
if (numClipRects) {
NS_ASSERTION(numClipRects == 1, "Too many clip rects");
clipRect.x = clipRects[0].x;
clipRect.y = clipRects[0].y;
clipRect.width = clipRects[0].width;
clipRect.height = clipRects[0].height;
}
nsresult rv = DrawWithGDK(cr, offset.x, offset.y,
numClipRects ? &clipRect : NULL, numClipRects);
return rv;
}
void
gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
PRUint32 flags, GdkVisual *visual)
{
mVisual = gdk_visual_get_system();
Visual* xvisual = gdk_x11_visual_get_xvisual(mVisual);
Screen* xscreen = gdk_x11_screen_get_xscreen(gdk_screen_get_default());
gfxXlibNativeRenderer::Draw(ctx, size, flags, xscreen, xvisual, nsnull);
}
#endif
#endif

View File

@ -35,15 +35,9 @@ public:
* @param numClipRects the number of rects in the array, or zero if
* no clipping is required
*/
#if defined(MOZ_WIDGET_GTK2)
virtual nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX,
gint offsetY, GdkRectangle * clipRects, PRUint32 numClipRects) = 0;
#else
virtual nsresult DrawWithGDK(cairo_t * cr, gint offsetX,
gint offsetY, GdkRectangle * clipRects, PRUint32 numClipRects) = 0;
#endif
enum {
// If set, then Draw() is opaque, i.e., every pixel in the intersection
// of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
@ -71,29 +65,17 @@ public:
* the rectangle (offset.x,offset.y,bounds.width,bounds.height)
* @param dpy a display to use for the drawing if ctx doesn't have one
*/
#if defined(MOZ_WIDGET_GTK2)
void Draw(gfxContext* ctx, nsIntSize size,
PRUint32 flags, GdkColormap* colormap);
#else
void Draw(gfxContext* ctx, nsIntSize size,
PRUint32 flags, GdkVisual *visual);
#endif
private:
#ifdef MOZ_X11
#if defined(MOZ_WIDGET_GTK2)
// for gfxXlibNativeRenderer:
virtual nsresult DrawWithXlib(gfxXlibSurface* surface,
nsIntPoint offset,
nsIntRect* clipRects, PRUint32 numClipRects);
GdkColormap *mColormap;
#else
// for gfxXlibNativeRenderer:
virtual nsresult DrawWithXlib(cairo_t *cr,
nsIntPoint offset,
nsIntRect* clipRects, PRUint32 numClipRects);
GdkVisual *mVisual;
#endif
#endif
};

View File

@ -15,7 +15,7 @@
#include "nsTArray.h"
#include "gfxContext.h"
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include "gfxPlatformGtk.h"
#endif
#ifdef MOZ_WIDGET_QT
@ -44,7 +44,7 @@
#include <pango/pango-modules.h>
#include <pango/pangofc-fontmap.h>
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
#include <gdk/gdk.h>
#endif
@ -950,7 +950,7 @@ gfx_pango_fc_font_get_coverage(PangoFont *font, PangoLanguage *lang)
static PRInt32
GetDPI()
{
#if (MOZ_WIDGET_GTK >= 2)
#if defined(MOZ_WIDGET_GTK2)
return gfxPlatformGtk::GetDPI();
#elif defined(MOZ_WIDGET_QT)
return gfxQtPlatform::GetDPI();
@ -1731,7 +1731,7 @@ gfx_pango_font_map_class_init(gfxPangoFontMapClass *klass)
// dynamically respond to changes in the screen cairo_font_options_t.
}
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
static void ApplyGdkScreenFontOptions(FcPattern *aPattern);
#endif
@ -1768,7 +1768,7 @@ PrepareSortPattern(FcPattern *aPattern, double aFallbackSize,
cairo_ft_font_options_substitute(options, aPattern);
cairo_font_options_destroy(options);
#endif
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
ApplyGdkScreenFontOptions(aPattern);
#endif
}
@ -3145,7 +3145,7 @@ GuessPangoLanguage(nsIAtom *aLanguage)
return pango_language_from_string(lang.get());
}
#if (MOZ_WIDGET_GTK >= 2)
#ifdef MOZ_WIDGET_GTK2
/***************************************************************************
*
* This function must be last in the file because it uses the system cairo

View File

@ -15,7 +15,7 @@
#include "gfxD2DSurface.h"
#elif defined(XP_MACOSX)
#include "gfxPlatformMac.h"
#elif (MOZ_WIDGET_GTK >= 2)
#elif defined(MOZ_WIDGET_GTK2)
#include "gfxPlatformGtk.h"
#elif defined(MOZ_WIDGET_QT)
#include "gfxQtPlatform.h"
@ -258,7 +258,7 @@ gfxPlatform::Init()
gPlatform = new gfxWindowsPlatform;
#elif defined(XP_MACOSX)
gPlatform = new gfxPlatformMac;
#elif (MOZ_WIDGET_GTK >= 2)
#elif defined(MOZ_WIDGET_GTK2)
gPlatform = new gfxPlatformGtk;
#elif defined(MOZ_WIDGET_QT)
gPlatform = new gfxQtPlatform;

View File

@ -68,11 +68,7 @@ static FT_Library gPlatformFTLibrary = NULL;
static cairo_user_data_key_t cairo_gdk_drawable_key;
static void do_gdk_drawable_unref (void *data)
{
#if defined(MOZ_WIDGET_GTK2)
GdkDrawable *d = (GdkDrawable*) data;
#else
GdkWindow *d = (GdkWindow*) data;
#endif
g_object_unref (d);
}
@ -479,7 +475,7 @@ gfxPlatformGtk::GetOffscreenFormat()
{
// Make sure there is a screen
GdkScreen *screen = gdk_screen_get_default();
if (screen && gdk_visual_get_depth(gdk_visual_get_system()) == 16) {
if (screen && gdk_visual_get_system()->depth == 16) {
return gfxASurface::ImageFormatRGB16_565;
}
@ -494,7 +490,7 @@ gfxPlatformGtk::GetPlatformCMSOutputProfile()
const char ICC_PROFILE_ATOM_NAME[] = "_ICC_PROFILE";
Atom edidAtom, iccAtom;
Display *dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
Display *dpy = GDK_DISPLAY();
Window root = gdk_x11_get_default_root_xwindow();
Atom retAtom;
@ -694,7 +690,7 @@ gfxPlatformGtk::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxF
}
#endif
#if defined(MOZ_WIDGET_GTK2)
void
gfxPlatformGtk::SetGdkDrawable(gfxASurface *target,
GdkDrawable *drawable)
@ -739,7 +735,6 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
return NULL;
}
#endif
RefPtr<ScaledFont>
gfxPlatformGtk::GetScaledFontForFont(gfxFont *aFont)
@ -760,3 +755,4 @@ gfxPlatformGtk::SupportsAzure(BackendType& aBackend)
aBackend = BACKEND_SKIA;
return true;
}

View File

@ -10,11 +10,9 @@
#include "nsAutoRef.h"
#include "nsTArray.h"
#if defined(MOZ_WIDGET_GTK2)
extern "C" {
typedef struct _GdkDrawable GdkDrawable;
}
#endif
class gfxFontconfigUtils;
#ifndef MOZ_PANGO
@ -92,11 +90,9 @@ public:
FT_Library GetFTLibrary();
#endif
#if defined(MOZ_WIDGET_GTK2)
static void SetGdkDrawable(gfxASurface *target,
GdkDrawable *drawable);
static GdkDrawable *GetGdkDrawable(gfxASurface *target);
#endif
static PRInt32 GetDPI();

View File

@ -230,16 +230,10 @@ gfxXlibNativeRenderer::DrawDirect(gfxContext *ctx, nsIntSize size,
/* we're good to go! */
NATIVE_DRAWING_NOTE("TAKING FAST PATH\n");
cairo_surface_flush (target);
#if defined(MOZ_WIDGET_GTK2)
nsRefPtr<gfxASurface> surface = gfxASurface::Wrap(target);
nsresult rv = DrawWithXlib(static_cast<gfxXlibSurface*>(surface.get()),
offset, rectangles,
needs_clip ? rect_count : 0);
#else
nsresult rv = DrawWithXlib(cr,
offset, rectangles,
needs_clip ? rect_count : 0);
#endif
if (NS_SUCCEEDED(rv)) {
cairo_surface_mark_dirty (target);
return true;
@ -418,7 +412,6 @@ CreateTempXlibSurface (gfxASurface *destination, nsIntSize size,
return surface.forget();
}
#if defined(MOZ_WIDGET_GTK2)
bool
gfxXlibNativeRenderer::DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
nsIntPoint offset)
@ -430,24 +423,6 @@ gfxXlibNativeRenderer::DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
tempXlibSurface->MarkDirty();
return NS_SUCCEEDED(rv);
}
#else
PRBool
gfxXlibNativeRenderer::DrawOntoTempSurface(cairo_t *cr,
nsIntPoint offset)
{
cairo_surface_t *target = cairo_get_group_target (cr);
cairo_surface_flush (target);
/* no clipping is needed because the callback can't draw outside the native
surface anyway */
nsresult rv = DrawWithXlib(cr, offset, NULL, 0);
if (NS_SUCCEEDED(rv)) {
cairo_surface_mark_dirty (target);
}
return NS_SUCCEEDED(rv);
}
#endif
static already_AddRefed<gfxImageSurface>
CopyXlibSurfaceToImage(gfxXlibSurface *tempXlibSurface,
@ -548,8 +523,9 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
result = NULL;
}
nsRefPtr<gfxContext> tmpCtx = new gfxContext(tempXlibSurface);
nsRefPtr<gfxContext> tmpCtx;
if (!drawIsOpaque) {
tmpCtx = new gfxContext(tempXlibSurface);
if (method == eCopyBackground) {
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
tmpCtx->SetSource(target, -(offset + matrix.GetTranslation()));
@ -566,15 +542,9 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
tmpCtx->Paint();
}
#if defined(MOZ_WIDGET_GTK2)
if (!DrawOntoTempSurface(tempXlibSurface, -drawingRect.TopLeft())) {
return;
}
#else
if (!DrawOntoTempSurface(tmpCtx->GetCairo(), -drawingRect.TopLeft())) {
return;
}
#endif
if (method != eAlphaExtraction) {
ctx->SetSource(tempXlibSurface, offset);
@ -595,11 +565,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
tmpCtx->SetDeviceColor(gfxRGBA(1.0, 1.0, 1.0));
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
tmpCtx->Paint();
#if defined(MOZ_WIDGET_GTK2)
DrawOntoTempSurface(tempXlibSurface, -drawingRect.TopLeft());
#else
DrawOntoTempSurface(tmpCtx->GetCairo(), -drawingRect.TopLeft());
#endif
nsRefPtr<gfxImageSurface> whiteImage =
CopyXlibSurfaceToImage(tempXlibSurface, gfxASurface::ImageFormatRGB24);

View File

@ -10,10 +10,6 @@
#include "nsAutoPtr.h"
#include "nsRect.h"
#include <X11/Xlib.h>
#if MOZ_WIDGET_GTK == 3
#include "cairo-xlib.h"
#include "cairo-xlib-xrender.h"
#endif
class gfxASurface;
class gfxXlibSurface;
@ -41,19 +37,10 @@ public:
* @param numClipRects the number of rects in the array, or zero if
* no clipping is required.
*/
#if defined(MOZ_WIDGET_GTK2)
virtual nsresult DrawWithXlib(gfxXlibSurface* surface,
nsIntPoint offset,
nsIntRect* clipRects, PRUint32 numClipRects) = 0;
#else
virtual nsresult DrawWithXlib(cairo_t *cr,
nsIntPoint offset,
nsIntRect* clipRects, PRUint32 numClipRects) = 0;
#endif
enum {
// If set, then Draw() is opaque, i.e., every pixel in the intersection
// of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
@ -102,13 +89,9 @@ private:
bool DrawDirect(gfxContext *ctx, nsIntSize bounds,
PRUint32 flags, Screen *screen, Visual *visual);
#if defined(MOZ_WIDGET_GTK2)
bool DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
nsIntPoint offset);
#else
PRBool DrawOntoTempSurface(cairo_t *cr,
nsIntPoint offset);
#endif
};
#endif /*GFXXLIBNATIVERENDER_H_*/