Bug 702158 - [Skia] Get Skia backend working on Linux. r=mattwoodrow

This commit is contained in:
Marco Castelluccio 2012-01-26 09:54:31 +09:00
parent 508d732db1
commit 94763126a2
7 changed files with 56 additions and 2 deletions

View File

@ -268,6 +268,11 @@ freetype/ftoutln.h
freetype/ttnameid.h
freetype/tttables.h
freetype/t1tables.h
freetype/ftlcdfil.h
freetype/ftsizes.h
freetype/ftadvanc.h
freetype/ftbitmap.h
freetype/ftxf86.h
fribidi/fribidi.h
FSp_fopen.h
fstream

View File

@ -8056,7 +8056,7 @@ dnl ========================================================
dnl Graphics checks.
dnl ========================================================
if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android"; then
if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
MOZ_ENABLE_SKIA=1
else
MOZ_ENABLE_SKIA=

View File

@ -995,7 +995,7 @@ NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult)
!Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) {
return NS_ERROR_NOT_AVAILABLE;
}
#elif !defined(XP_MACOSX) && !defined(ANDROID)
#elif !defined(XP_MACOSX) && !defined(ANDROID) && !defined(XP_LINUX)
return NS_ERROR_NOT_AVAILABLE;
#endif

View File

@ -68,6 +68,7 @@ VPATH += \
$(srcdir)/src/ports \
$(srcdir)/src/opts \
$(srcdir)/src/effects \
$(srcdir)/src/utils \
$(NULL)
EXPORTS_skia = \
@ -317,6 +318,19 @@ DEFINES += -DSK_BUILD_FOR_ANDROID_NDK
OS_CXXFLAGS += $(CAIRO_FT_CFLAGS)
endif
ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
CPPSRCS += \
SkFontHost_FreeType.cpp \
SkFontHost_linux.cpp \
SkFontHost_gamma.cpp \
SkTime_Unix.cpp \
SkMMapStream.cpp \
SkOSFile.cpp \
$(NULL)
OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS)
endif
ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
EXPORTS_skia += \
include/config/sk_stdint.h \

View File

@ -56,6 +56,8 @@
#include "gfxFT2Fonts.h"
#endif
#include "mozilla/gfx/2D.h"
#include "cairo.h"
#include <gtk/gtk.h>
@ -83,6 +85,9 @@
#include FT_FREETYPE_H
#endif
using namespace mozilla;
using namespace mozilla::gfx;
gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nsnull;
#ifndef MOZ_PANGO
@ -761,3 +766,23 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
return NULL;
}
RefPtr<ScaledFont>
gfxPlatformGtk::GetScaledFontForFont(gfxFont *aFont)
{
NativeFont nativeFont;
nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE;
nativeFont.mFont = aFont;
RefPtr<ScaledFont> scaledFont =
Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
return scaledFont;
}
bool
gfxPlatformGtk::SupportsAzure(BackendType& aBackend)
{
aBackend = BACKEND_SKIA;
return true;
}

View File

@ -66,6 +66,11 @@ public:
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxASurface::gfxContentType contentType);
mozilla::RefPtr<mozilla::gfx::ScaledFont>
GetScaledFontForFont(gfxFont *aFont);
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend);
nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts);

View File

@ -268,6 +268,11 @@ freetype/ftoutln.h
freetype/ttnameid.h
freetype/tttables.h
freetype/t1tables.h
freetype/ftlcdfil.h
freetype/ftsizes.h
freetype/ftadvanc.h
freetype/ftbitmap.h
freetype/ftxf86.h
fribidi/fribidi.h
FSp_fopen.h
fstream