зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1286317 - part 1 - remove Qt widget usage from gfx. r=jrmuizel
This commit is contained in:
Родитель
06ee3b6f86
Коммит
16ca3223d9
|
@ -659,9 +659,7 @@ TextAttrsMgr::FontWeightTextAttr::
|
|||
// font->GetStyle()->weight will give the absolute weight requested of the
|
||||
// font face. The gfxPangoFontGroup code uses the gfxFontEntry constructor
|
||||
// which doesn't initialize the weight field.
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
useFontEntryWeight = false;
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
useFontEntryWeight = gfxPlatformGtk::UseFcFontList();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -202,12 +202,12 @@ FINAL_LIBRARY = 'xul'
|
|||
for var in ('USE_CAIRO', 'MOZ2D_HAS_MOZ_CAIRO'):
|
||||
DEFINES[var] = True
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk'):
|
||||
DEFINES['MOZ_ENABLE_FREETYPE'] = True
|
||||
|
||||
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk'):
|
||||
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
|
||||
|
||||
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#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)))
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW))
|
||||
#else
|
||||
#define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
|
||||
#endif
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#define GET_NATIVE_WINDOW(aWidget) GDK_WINDOW_XID((GdkWindow*) aWidget->GetNativeData(NS_NATIVE_WINDOW))
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#define GET_NATIVE_WINDOW(aWidget) (Window)(aWidget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW))
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
|
|
@ -17,8 +17,6 @@ elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
|
|||
gl_provider = 'EGL'
|
||||
else:
|
||||
gl_provider = 'GLX'
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
gl_provider = 'GLX'
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
gl_provider = 'EGL'
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
|
|
|
@ -66,7 +66,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in {
|
|||
'gtk3',
|
||||
'uikit',
|
||||
'gonk',
|
||||
'qt',
|
||||
}:
|
||||
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
|
||||
|
||||
|
@ -138,11 +137,11 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
|
|||
'-Wno-unused-private-field',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk'):
|
||||
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
||||
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
|
||||
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
|
||||
"""
|
||||
|
||||
|
@ -419,9 +418,6 @@ def write_mozbuild(sources):
|
|||
f.write("if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:\n")
|
||||
write_sources(f, sources['linux'], 4)
|
||||
|
||||
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':\n")
|
||||
write_sources(f, sources['linux'], 4)
|
||||
|
||||
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n")
|
||||
# Windows-specific files don't get unification because of nasty headers.
|
||||
# Luckily there are not many files in this.
|
||||
|
|
|
@ -488,18 +488,6 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
|
|||
'skia/src/ports/SkFontHost_cairo.cpp',
|
||||
'skia/src/ports/SkFontHost_FreeType_common.cpp',
|
||||
]
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
UNIFIED_SOURCES += [
|
||||
'skia/src/ports/SkDebug_stdio.cpp',
|
||||
'skia/src/ports/SkOSFile_posix.cpp',
|
||||
'skia/src/ports/SkOSLibrary_posix.cpp',
|
||||
'skia/src/ports/SkTLS_pthread.cpp',
|
||||
'skia/src/utils/SkThreadUtils_pthread.cpp',
|
||||
]
|
||||
SOURCES += [
|
||||
'skia/src/ports/SkFontHost_cairo.cpp',
|
||||
'skia/src/ports/SkFontHost_FreeType_common.cpp',
|
||||
]
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
SOURCES += [
|
||||
'skia/src/ports/SkDebug_win.cpp',
|
||||
|
@ -602,7 +590,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in {
|
|||
'gtk3',
|
||||
'uikit',
|
||||
'gonk',
|
||||
'qt',
|
||||
}:
|
||||
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
|
||||
|
||||
|
@ -674,9 +661,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
|
|||
'-Wno-unused-private-field',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk'):
|
||||
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
||||
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
|
||||
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
|
||||
|
|
|
@ -13,13 +13,9 @@
|
|||
#if defined(MOZ_WIDGET_GTK)
|
||||
# include <gdk/gdk.h>
|
||||
# include <gdk/gdkx.h>
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include "gfxQtPlatform.h"
|
||||
#undef CursorShape
|
||||
# include <X11/Xlib.h>
|
||||
#else
|
||||
# error Unknown toolkit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <string.h> // for memset
|
||||
#include "mozilla/Scoped.h" // for SCOPED_TEMPLATE
|
||||
|
@ -34,8 +30,6 @@ DefaultXDisplay()
|
|||
{
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
return gfxQtPlatform::GetXDisplay();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -151,8 +151,6 @@ gfxASurface::Wrap (cairo_surface_t *csurf, const IntSize& aSize)
|
|||
/* No wrapper; figure out the surface type and create it */
|
||||
cairo_surface_type_t stype = cairo_surface_get_type(csurf);
|
||||
|
||||
MOZ_ASSERT(stype != CAIRO_SURFACE_TYPE_QT);
|
||||
|
||||
if (stype == CAIRO_SURFACE_TYPE_IMAGE) {
|
||||
result = new gfxImageSurface(csurf);
|
||||
}
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h"
|
||||
#define gfxToolkitPlatform gfxPlatformGtk
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include <qfontinfo.h>
|
||||
#include "gfxQtPlatform.h"
|
||||
#define gfxToolkitPlatform gfxQtPlatform
|
||||
#elif defined(XP_WIN)
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#define gfxToolkitPlatform gfxWindowsPlatform
|
||||
|
|
|
@ -57,7 +57,7 @@ class gfxTextContextPaint;
|
|||
// we use a platform-dependent value to harmonize with the platform's own APIs.
|
||||
#ifdef XP_WIN
|
||||
#define OBLIQUE_SKEW_FACTOR 0.3
|
||||
#elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
#define OBLIQUE_SKEW_FACTOR 0.2
|
||||
#else
|
||||
#define OBLIQUE_SKEW_FACTOR 0.25
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "gfxPlatformGtk.h"
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "gfxQtPlatform.h"
|
||||
#endif
|
||||
#include "gfxFontconfigFonts.h"
|
||||
#include "gfxFT2FontBase.h"
|
||||
#include "gfxFT2Utils.h"
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
#include "gfxQuartzSurface.h"
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h"
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include "gfxQtPlatform.h"
|
||||
#elif defined(ANDROID)
|
||||
#include "gfxAndroidPlatform.h"
|
||||
#endif
|
||||
|
@ -664,8 +662,6 @@ gfxPlatform::Init()
|
|||
gPlatform = new gfxPlatformMac;
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
gPlatform = new gfxPlatformGtk;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
gPlatform = new gfxQtPlatform;
|
||||
#elif defined(ANDROID)
|
||||
gPlatform = new gfxAndroidPlatform;
|
||||
#else
|
||||
|
@ -691,8 +687,6 @@ gfxPlatform::Init()
|
|||
bool usePlatformFontList = true;
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
usePlatformFontList = gfxPlatformGtk::UseFcFontList();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
usePlatformFontList = false;
|
||||
#endif
|
||||
|
||||
if (usePlatformFontList) {
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#include "gfxQtNativeRenderer.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "gfxXlibSurface.h"
|
||||
|
||||
nsresult
|
||||
gfxQtNativeRenderer::Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
|
||||
uint32_t flags, Screen* screen, Visual* visual)
|
||||
{
|
||||
Display *dpy = DisplayOfScreen(screen);
|
||||
bool isOpaque = (flags & DRAW_IS_OPAQUE) ? true : false;
|
||||
int screenNumber = screen - ScreenOfDisplay(dpy, 0);
|
||||
|
||||
if (!isOpaque) {
|
||||
int depth = 32;
|
||||
XVisualInfo vinfo;
|
||||
int foundVisual = XMatchVisualInfo(dpy, screenNumber,
|
||||
depth, TrueColor,
|
||||
&vinfo);
|
||||
if (!foundVisual)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
visual = vinfo.visual;
|
||||
}
|
||||
|
||||
RefPtr<gfxXlibSurface> xsurf =
|
||||
gfxXlibSurface::Create(screen, visual,
|
||||
mozilla::gfx::IntSize(size.width, size.height));
|
||||
|
||||
if (!isOpaque) {
|
||||
gfxUtils::ClearThebesSurface(xsurf);
|
||||
}
|
||||
|
||||
nsresult rv = DrawWithXlib(xsurf->CairoSurface(), nsIntPoint(0, 0), nullptr, 0);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
ctx->SetSource(xsurf);
|
||||
ctx->Paint();
|
||||
|
||||
return rv;
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef GFXQTNATIVERENDER_H_
|
||||
#define GFXQTNATIVERENDER_H_
|
||||
|
||||
#include "gfxContext.h"
|
||||
#include "gfxXlibSurface.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
|
||||
/**
|
||||
* This class lets us take code that draws into an Xlib surface drawable and lets us
|
||||
* use it to draw into any Thebes context. The user should subclass this class,
|
||||
* override NativeDraw, and then call Draw(). The drawing will be subjected
|
||||
* to all Thebes transformations, clipping etc.
|
||||
*/
|
||||
class gfxQtNativeRenderer {
|
||||
public:
|
||||
/**
|
||||
* Perform the native drawing.
|
||||
* @param offsetX draw at this offset into the given drawable
|
||||
* @param offsetY draw at this offset into the given drawable
|
||||
* @param clipRects an array of rects; clip to the union
|
||||
* @param numClipRects the number of rects in the array, or zero if
|
||||
* no clipping is required
|
||||
*/
|
||||
virtual nsresult DrawWithXlib(cairo_surface_t* surface,
|
||||
nsIntPoint offset,
|
||||
mozilla::gfx::IntRect* clipRects,
|
||||
uint32_t numClipRects) = 0;
|
||||
|
||||
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)
|
||||
// will be set and there is no dependence on what the existing pixels
|
||||
// in the drawable are set to.
|
||||
DRAW_IS_OPAQUE = 0x01,
|
||||
// If set, then numClipRects can be zero or one
|
||||
DRAW_SUPPORTS_CLIP_RECT = 0x04,
|
||||
// If set, then numClipRects can be any value. If neither this
|
||||
// nor CLIP_RECT are set, then numClipRects will be zero
|
||||
DRAW_SUPPORTS_CLIP_LIST = 0x08,
|
||||
// If set, then the visual passed in can be any visual, otherwise the
|
||||
// visual passed in must be the default visual for dpy's default screen
|
||||
DRAW_SUPPORTS_ALTERNATE_VISUAL = 0x10,
|
||||
// If set, then the Screen 'screen' in the callback can be different
|
||||
// from the default Screen of the display passed to 'Draw' and can be
|
||||
// on a different display.
|
||||
DRAW_SUPPORTS_ALTERNATE_SCREEN = 0x20
|
||||
};
|
||||
|
||||
/**
|
||||
* @param flags see above
|
||||
* @param size Draw()'s drawing is guaranteed to be restricted to
|
||||
* the rectangle (offset.x,offset.y,size.width,size.height)
|
||||
* @param dpy a display to use for the drawing if ctx doesn't have one
|
||||
* @param resultSurface if non-null, we will try to capture a copy of the
|
||||
* rendered image into a surface similar to the surface of ctx; if
|
||||
* successful, a pointer to the new gfxASurface is stored in *resultSurface,
|
||||
* otherwise *resultSurface is set to nullptr.
|
||||
*/
|
||||
nsresult Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
|
||||
uint32_t flags, Screen* screen, Visual* visual);
|
||||
};
|
||||
|
||||
#endif /*GFXQTNATIVERENDER_H_*/
|
|
@ -1,203 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QWindow>
|
||||
#ifdef MOZ_X11
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
|
||||
#include "gfxQtPlatform.h"
|
||||
|
||||
#include "gfxFontconfigUtils.h"
|
||||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
#include "cairo.h"
|
||||
|
||||
#include "gfxImageSurface.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
|
||||
#include "gfxFontconfigFonts.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
|
||||
#include "nsUnicharUtils.h"
|
||||
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#ifdef MOZ_X11
|
||||
#include "gfxXlibSurface.h"
|
||||
#include "prenv.h"
|
||||
#endif
|
||||
|
||||
#include "qcms.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::unicode;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
gfxFontconfigUtils *gfxQtPlatform::sFontconfigUtils = nullptr;
|
||||
|
||||
static gfxImageFormat sOffscreenFormat = SurfaceFormat::X8R8G8B8_UINT32;
|
||||
|
||||
gfxQtPlatform::gfxQtPlatform()
|
||||
{
|
||||
if (!sFontconfigUtils)
|
||||
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
|
||||
|
||||
int32_t depth = GetScreenDepth();
|
||||
if (depth == 16) {
|
||||
sOffscreenFormat = SurfaceFormat::R5G6B5_UINT16;
|
||||
}
|
||||
uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO) | BackendTypeBit(BackendType::SKIA);
|
||||
uint32_t contentMask = BackendTypeBit(BackendType::CAIRO) | BackendTypeBit(BackendType::SKIA);
|
||||
InitBackendPrefs(canvasMask, BackendType::CAIRO,
|
||||
contentMask, BackendType::CAIRO);
|
||||
}
|
||||
|
||||
gfxQtPlatform::~gfxQtPlatform()
|
||||
{
|
||||
gfxFontconfigUtils::Shutdown();
|
||||
sFontconfigUtils = nullptr;
|
||||
|
||||
gfxPangoFontGroup::Shutdown();
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
Display*
|
||||
gfxQtPlatform::GetXDisplay(QWindow* aWindow)
|
||||
{
|
||||
return (Display*)(qApp->platformNativeInterface()->
|
||||
nativeResourceForScreen("display", aWindow ? aWindow->screen() : qApp->primaryScreen()));
|
||||
}
|
||||
|
||||
Screen*
|
||||
gfxQtPlatform::GetXScreen(QWindow* aWindow)
|
||||
{
|
||||
return ScreenOfDisplay(GetXDisplay(aWindow),
|
||||
(int)(intptr_t)qApp->platformNativeInterface()->
|
||||
nativeResourceForScreen("screen", aWindow ? aWindow->screen() : qApp->primaryScreen()));
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxQtPlatform::CreateOffscreenSurface(const IntSize& aSize,
|
||||
gfxImageFormat aFormat)
|
||||
{
|
||||
RefPtr<gfxASurface> newSurface =
|
||||
new gfxImageSurface(aSize, aFormat);
|
||||
|
||||
return newSurface.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxQtPlatform::GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts)
|
||||
{
|
||||
return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily,
|
||||
aListOfFonts);
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxQtPlatform::UpdateFontList()
|
||||
{
|
||||
return sFontconfigUtils->UpdateFontList();
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxQtPlatform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
|
||||
{
|
||||
return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
|
||||
}
|
||||
|
||||
gfxFontGroup *
|
||||
gfxQtPlatform::CreateFontGroup(const FontFamilyList& aFontFamilyList,
|
||||
const gfxFontStyle *aStyle,
|
||||
gfxTextPerfMetrics* aTextPerf,
|
||||
gfxUserFontSet* aUserFontSet,
|
||||
gfxFloat aDevToCssSize)
|
||||
{
|
||||
return new gfxPangoFontGroup(aFontFamilyList, aStyle,
|
||||
aUserFontSet, aDevToCssSize);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxQtPlatform::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle)
|
||||
{
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aStyle);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxQtPlatform::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// passing ownership of the font data to the new font entry
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aStyle,
|
||||
aFontData, aLength);
|
||||
}
|
||||
|
||||
bool
|
||||
gfxQtPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
||||
{
|
||||
// check for strange format flags
|
||||
NS_ASSERTION(!(aFormatFlags & gfxUserFontSet::FLAG_FORMAT_NOT_USED),
|
||||
"strange font format hint set");
|
||||
|
||||
// accept supported formats
|
||||
// Pango doesn't apply features from AAT TrueType extensions.
|
||||
// Assume that if this is the only SFNT format specified,
|
||||
// then AAT extensions are required for complex script support.
|
||||
if (aFormatFlags & gfxUserFontSet::FLAG_FORMATS_COMMON) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// reject all other formats, known and unknown
|
||||
if (aFormatFlags != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// no format hint set, need to look at data
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
gfxQtPlatform::GetPlatformCMSOutputProfile(void *&mem, size_t &size)
|
||||
{
|
||||
mem = nullptr;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
gfxQtPlatform::GetDPI()
|
||||
{
|
||||
return qApp->primaryScreen()->logicalDotsPerInch();
|
||||
}
|
||||
|
||||
gfxImageFormat
|
||||
gfxQtPlatform::GetOffscreenFormat()
|
||||
{
|
||||
return sOffscreenFormat;
|
||||
}
|
||||
|
||||
already_AddRefed<ScaledFont>
|
||||
gfxQtPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont* aFont)
|
||||
{
|
||||
return GetScaledFontForFontWithCairoSkia(aTarget, aFont);
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef GFX_PLATFORM_QT_H
|
||||
#define GFX_PLATFORM_QT_H
|
||||
|
||||
#include "gfxPlatform.h"
|
||||
#include "nsAutoRef.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#ifdef MOZ_X11
|
||||
#include "X11/Xlib.h"
|
||||
#endif
|
||||
|
||||
class gfxFontconfigUtils;
|
||||
class QWindow;
|
||||
|
||||
class gfxQtPlatform : public gfxPlatform {
|
||||
public:
|
||||
gfxQtPlatform();
|
||||
virtual ~gfxQtPlatform();
|
||||
|
||||
static gfxQtPlatform *GetPlatform() {
|
||||
return static_cast<gfxQtPlatform*>(gfxPlatform::GetPlatform());
|
||||
}
|
||||
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
CreateOffscreenSurface(const IntSize& aSize,
|
||||
gfxImageFormat aFormat) override;
|
||||
|
||||
virtual already_AddRefed<mozilla::gfx::ScaledFont>
|
||||
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) override;
|
||||
|
||||
virtual nsresult GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts) override;
|
||||
|
||||
virtual nsresult UpdateFontList() override;
|
||||
|
||||
virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
|
||||
|
||||
gfxFontGroup*
|
||||
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
|
||||
const gfxFontStyle *aStyle,
|
||||
gfxTextPerfMetrics* aTextPerf,
|
||||
gfxUserFontSet *aUserFontSet,
|
||||
gfxFloat aDevToCssSize) override;
|
||||
|
||||
/**
|
||||
* Look up a local platform font using the full font face name (needed to
|
||||
* support @font-face src local() )
|
||||
*/
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle) override;
|
||||
|
||||
/**
|
||||
* Activate a platform font (needed to support @font-face src url() )
|
||||
*
|
||||
*/
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength) override;
|
||||
|
||||
/**
|
||||
* Check whether format is supported on a platform or not (if unclear,
|
||||
* returns true).
|
||||
*/
|
||||
virtual bool IsFontFormatSupported(nsIURI *aFontURI,
|
||||
uint32_t aFormatFlags) override;
|
||||
|
||||
static int32_t GetDPI();
|
||||
|
||||
virtual gfxImageFormat GetOffscreenFormat() override;
|
||||
#ifdef MOZ_X11
|
||||
static Display* GetXDisplay(QWindow* aWindow = 0);
|
||||
static Screen* GetXScreen(QWindow* aWindow = 0);
|
||||
#endif
|
||||
|
||||
bool AccelerateLayersByDefault() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
static gfxFontconfigUtils *sFontconfigUtils;
|
||||
|
||||
private:
|
||||
virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size) override;
|
||||
|
||||
int mScreenDepth;
|
||||
};
|
||||
|
||||
#endif /* GFX_PLATFORM_QT_H */
|
||||
|
|
@ -1610,8 +1610,6 @@ gfxFontGroup::BuildFontList()
|
|||
#if defined(MOZ_WIDGET_GTK)
|
||||
// xxx - eliminate this once gfxPangoFontGroup is no longer needed
|
||||
enumerateFonts = gfxPlatformGtk::UseFcFontList();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
enumerateFonts = false;
|
||||
#endif
|
||||
if (!enumerateFonts) {
|
||||
return;
|
||||
|
|
|
@ -139,34 +139,6 @@ elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
|
|||
'gfxXlibSurface.cpp',
|
||||
]
|
||||
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
EXPORTS += [
|
||||
'gfxFontconfigFonts.h',
|
||||
'gfxFT2FontBase.h',
|
||||
'gfxQtNativeRenderer.h',
|
||||
'gfxQtPlatform.h',
|
||||
]
|
||||
EXPORTS.mozilla.gfx += [
|
||||
'PrintTargetPDF.h',
|
||||
]
|
||||
SOURCES += [
|
||||
'gfxFontconfigFonts.cpp',
|
||||
'gfxFontconfigUtils.cpp',
|
||||
'gfxFT2FontBase.cpp',
|
||||
'gfxFT2Utils.cpp',
|
||||
'gfxQtPlatform.cpp',
|
||||
'PrintTargetPDF.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_X11']:
|
||||
EXPORTS += [
|
||||
'gfxXlibSurface.h',
|
||||
]
|
||||
SOURCES += [
|
||||
'gfxQtNativeRenderer.cpp',
|
||||
'gfxXlibSurface.cpp',
|
||||
]
|
||||
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
EXPORTS += [
|
||||
'gfxDWriteFonts.h',
|
||||
|
@ -288,7 +260,7 @@ LOCAL_INCLUDES += [
|
|||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
LOCAL_INCLUDES += ['/widget/gonk']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk'):
|
||||
DEFINES['MOZ_ENABLE_FREETYPE'] = True
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
|
@ -301,7 +273,7 @@ CXXFLAGS += CONFIG['TK_CFLAGS']
|
|||
CFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
||||
CFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
|
||||
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
|
@ -309,7 +281,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
|||
# top of the android java runtime.
|
||||
DEFINES['MOZ_USING_ANDROID_JAVA_WIDGETS'] = True
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
|
||||
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
|
||||
|
||||
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
|
||||
|
|
|
@ -19,9 +19,6 @@ platform = None
|
|||
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
|
||||
platform = 'gtk'
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
platform = 'qt'
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
platform = 'win'
|
||||
|
||||
|
|
|
@ -2055,8 +2055,6 @@ nsPresContext::UserFontSetUpdated(gfxUserFontEntry* aUpdatedFont)
|
|||
bool usePlatformFontList = true;
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
usePlatformFontList = gfxPlatformGtk::UseFcFontList();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
usePlatformFontList = false;
|
||||
#endif
|
||||
|
||||
// xxx - until the Linux platform font list is always used, use full
|
||||
|
|
Загрузка…
Ссылка в новой задаче