mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 848491 - Add patches to the Skia patches directory
From 35a22019f62d4e13a293e9d576b6a692b0411ac8 Mon Sep 17 00:00:00 2001
This commit is contained in:
parent
a9ed9eaf16
commit
2a79f0a78e
@ -0,0 +1,50 @@
|
||||
From: George Wright <george@mozilla.com>
|
||||
Date: Mon, 14 Jan 2013 17:59:09 -0500
|
||||
Subject: Bug 848491 - Re-apply Bug 795549 - Move TileProc functions into their own file to ensure they only exist once in a library
|
||||
|
||||
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
|
||||
index b9dbf1b..729ce4e 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
|
||||
+++ b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
|
||||
@@ -37,34 +37,9 @@ static inline void sk_memset32_dither(uint32_t dst[], uint32_t v0, uint32_t v1,
|
||||
}
|
||||
}
|
||||
|
||||
-// Clamp
|
||||
-
|
||||
-static inline SkFixed clamp_tileproc(SkFixed x) {
|
||||
- return SkClampMax(x, 0xFFFF);
|
||||
-}
|
||||
-
|
||||
-// Repeat
|
||||
-
|
||||
-static inline SkFixed repeat_tileproc(SkFixed x) {
|
||||
- return x & 0xFFFF;
|
||||
-}
|
||||
-
|
||||
-// Mirror
|
||||
-
|
||||
-// Visual Studio 2010 (MSC_VER=1600) optimizes bit-shift code incorrectly.
|
||||
-// See http://code.google.com/p/skia/issues/detail?id=472
|
||||
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
||||
-#pragma optimize("", off)
|
||||
-#endif
|
||||
-
|
||||
-static inline SkFixed mirror_tileproc(SkFixed x) {
|
||||
- int s = x << 15 >> 31;
|
||||
- return (x ^ s) & 0xFFFF;
|
||||
-}
|
||||
-
|
||||
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
||||
-#pragma optimize("", on)
|
||||
-#endif
|
||||
+SkFixed clamp_tileproc(SkFixed x);
|
||||
+SkFixed repeat_tileproc(SkFixed x);
|
||||
+SkFixed mirror_tileproc(SkFixed x);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,472 @@
|
||||
From: George Wright <george@mozilla.com>
|
||||
Date: Wed, 1 Aug 2012 16:43:15 -0400
|
||||
Subject: Bug 736276 - Add a new SkFontHost that takes a cairo_scaled_font_t r=karl
|
||||
|
||||
|
||||
diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in
|
||||
index 5ebbd2e..7c8cdbf 100644
|
||||
--- a/gfx/skia/Makefile.in
|
||||
+++ b/gfx/skia/Makefile.in
|
||||
@@ -60,15 +60,15 @@ VPATH += \
|
||||
$(NULL)
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
-OS_CXXFLAGS += $(CAIRO_FT_CFLAGS)
|
||||
+OS_CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(CAIRO_FT_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
|
||||
-OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS)
|
||||
+OS_CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PANGO_CFLAGS) $(CAIRO_FT_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq (qt,$(MOZ_WIDGET_TOOLKIT))
|
||||
-OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS)
|
||||
+OS_CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PANGO_CFLAGS) $(CAIRO_FT_CFLAGS)
|
||||
ifeq (Linux,$(OS_TARGET))
|
||||
DEFINES += -DSK_USE_POSIX_THREADS=1
|
||||
endif
|
||||
diff --git a/gfx/skia/include/ports/SkTypeface_cairo.h b/gfx/skia/include/ports/SkTypeface_cairo.h
|
||||
new file mode 100644
|
||||
index 0000000..7e44f04
|
||||
--- /dev/null
|
||||
+++ b/gfx/skia/include/ports/SkTypeface_cairo.h
|
||||
@@ -0,0 +1,11 @@
|
||||
+#ifndef SkTypeface_cairo_DEFINED
|
||||
+#define SkTypeface_cairo_DEFINED
|
||||
+
|
||||
+#include <cairo.h>
|
||||
+
|
||||
+#include "SkTypeface.h"
|
||||
+
|
||||
+SK_API extern SkTypeface* SkCreateTypefaceFromCairoFont(cairo_font_face_t* fontFace, SkTypeface::Style style, bool isFixedWidth);
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
|
||||
index 9ceba59..66efd52 100644
|
||||
--- a/gfx/skia/moz.build
|
||||
+++ b/gfx/skia/moz.build
|
||||
@@ -171,10 +171,12 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
'SkTime_win.cpp',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
|
||||
+ EXPORTS.skia += [
|
||||
+ 'include/ports/SkTypeface_cairo.h',
|
||||
+ ]
|
||||
CPP_SOURCES += [
|
||||
- 'SkFontHost_FreeType.cpp',
|
||||
+ 'SkFontHost_cairo.cpp',
|
||||
'SkFontHost_FreeType_common.cpp',
|
||||
- 'SkFontHost_linux.cpp',
|
||||
'SkThread_pthread.cpp',
|
||||
'SkThreadUtils_pthread.cpp',
|
||||
'SkThreadUtils_pthread_linux.cpp',
|
||||
@@ -183,14 +185,15 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
CPP_SOURCES += [
|
||||
- 'SkFontHost_FreeType.cpp',
|
||||
+ 'SkFontHost_cairo.cpp',
|
||||
'SkFontHost_FreeType_common.cpp',
|
||||
'SkOSFile.cpp',
|
||||
]
|
||||
if CONFIG['OS_TARGET'] == 'Linux':
|
||||
+ EXPORTS.skia += [
|
||||
+ 'include/ports/SkTypeface_cairo.h',
|
||||
+ ]
|
||||
CPP_SOURCES += [
|
||||
- 'SkFontHost_linux.cpp',
|
||||
- 'SkFontHost_tables.cpp',
|
||||
'SkThread_pthread.cpp',
|
||||
'SkThreadUtils_pthread.cpp',
|
||||
'SkThreadUtils_pthread_linux.cpp',
|
||||
@@ -204,11 +207,13 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
# Separate 'if' from above, since the else below applies to all != 'android'
|
||||
# toolkits.
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
+ EXPORTS.skia += [
|
||||
+ 'include/ports/SkTypeface_cairo.h',
|
||||
+ ]
|
||||
CPP_SOURCES += [
|
||||
'ashmem.cpp',
|
||||
'SkDebug_android.cpp',
|
||||
- 'SkFontHost_android_old.cpp',
|
||||
- 'SkFontHost_FreeType.cpp',
|
||||
+ 'SkFontHost_cairo.cpp',
|
||||
'SkFontHost_FreeType_common.cpp',
|
||||
'SkImageRef_ashmem.cpp',
|
||||
'SkTime_Unix.cpp',
|
||||
diff --git a/gfx/skia/src/ports/SkFontHost_cairo.cpp b/gfx/skia/src/ports/SkFontHost_cairo.cpp
|
||||
new file mode 100644
|
||||
index 0000000..bb5b778
|
||||
--- /dev/null
|
||||
+++ b/gfx/skia/src/ports/SkFontHost_cairo.cpp
|
||||
@@ -0,0 +1,364 @@
|
||||
+
|
||||
+/*
|
||||
+ * Copyright 2012 Mozilla Foundation
|
||||
+ *
|
||||
+ * Use of this source code is governed by a BSD-style license that can be
|
||||
+ * found in the LICENSE file.
|
||||
+ */
|
||||
+
|
||||
+#include "cairo.h"
|
||||
+#include "cairo-ft.h"
|
||||
+
|
||||
+#include "SkFontHost_FreeType_common.h"
|
||||
+
|
||||
+#include "SkAdvancedTypefaceMetrics.h"
|
||||
+#include "SkFontHost.h"
|
||||
+#include "SkPath.h"
|
||||
+#include "SkScalerContext.h"
|
||||
+#include "SkTypefaceCache.h"
|
||||
+
|
||||
+#include <ft2build.h>
|
||||
+#include FT_FREETYPE_H
|
||||
+
|
||||
+static cairo_user_data_key_t kSkTypefaceKey;
|
||||
+
|
||||
+class SkScalerContext_CairoFT : public SkScalerContext_FreeType_Base {
|
||||
+public:
|
||||
+ SkScalerContext_CairoFT(SkTypeface* typeface, const SkDescriptor* desc);
|
||||
+ virtual ~SkScalerContext_CairoFT();
|
||||
+
|
||||
+protected:
|
||||
+ virtual unsigned generateGlyphCount() SK_OVERRIDE;
|
||||
+ virtual uint16_t generateCharToGlyph(SkUnichar uniChar) SK_OVERRIDE;
|
||||
+ virtual void generateAdvance(SkGlyph* glyph) SK_OVERRIDE;
|
||||
+ virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE;
|
||||
+ virtual void generateImage(const SkGlyph& glyph) SK_OVERRIDE;
|
||||
+ virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE;
|
||||
+ virtual void generateFontMetrics(SkPaint::FontMetrics* mx,
|
||||
+ SkPaint::FontMetrics* my) SK_OVERRIDE;
|
||||
+ virtual SkUnichar generateGlyphToChar(uint16_t glyph) SK_OVERRIDE;
|
||||
+private:
|
||||
+ cairo_scaled_font_t* fScaledFont;
|
||||
+ uint32_t fLoadGlyphFlags;
|
||||
+};
|
||||
+
|
||||
+class CairoLockedFTFace {
|
||||
+public:
|
||||
+ CairoLockedFTFace(cairo_scaled_font_t* scaledFont)
|
||||
+ : fScaledFont(scaledFont)
|
||||
+ , fFace(cairo_ft_scaled_font_lock_face(scaledFont))
|
||||
+ {}
|
||||
+
|
||||
+ ~CairoLockedFTFace()
|
||||
+ {
|
||||
+ cairo_ft_scaled_font_unlock_face(fScaledFont);
|
||||
+ }
|
||||
+
|
||||
+ FT_Face getFace()
|
||||
+ {
|
||||
+ return fFace;
|
||||
+ }
|
||||
+
|
||||
+private:
|
||||
+ cairo_scaled_font_t* fScaledFont;
|
||||
+ FT_Face fFace;
|
||||
+};
|
||||
+
|
||||
+class SkCairoFTTypeface : public SkTypeface {
|
||||
+public:
|
||||
+ static SkTypeface* CreateTypeface(cairo_font_face_t* fontFace, SkTypeface::Style style, bool isFixedWidth) {
|
||||
+ SkASSERT(fontFace != NULL);
|
||||
+ SkASSERT(cairo_font_face_get_type(fontFace) == CAIRO_FONT_TYPE_FT);
|
||||
+
|
||||
+ SkFontID newId = SkTypefaceCache::NewFontID();
|
||||
+
|
||||
+ return SkNEW_ARGS(SkCairoFTTypeface, (fontFace, style, newId, isFixedWidth));
|
||||
+ }
|
||||
+
|
||||
+ cairo_font_face_t* getFontFace() {
|
||||
+ return fFontFace;
|
||||
+ }
|
||||
+
|
||||
+ virtual SkStream* onOpenStream(int*) const SK_OVERRIDE { return NULL; }
|
||||
+
|
||||
+ virtual SkAdvancedTypefaceMetrics*
|
||||
+ onGetAdvancedTypefaceMetrics(SkAdvancedTypefaceMetrics::PerGlyphInfo,
|
||||
+ const uint32_t*, uint32_t) const SK_OVERRIDE
|
||||
+ {
|
||||
+ SkDEBUGCODE(SkDebugf("SkCairoFTTypeface::onGetAdvancedTypefaceMetrics unimplemented\n"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ virtual SkScalerContext* onCreateScalerContext(const SkDescriptor* desc) const SK_OVERRIDE
|
||||
+ {
|
||||
+ return SkNEW_ARGS(SkScalerContext_CairoFT, (const_cast<SkCairoFTTypeface*>(this), desc));
|
||||
+ }
|
||||
+
|
||||
+ virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE
|
||||
+ {
|
||||
+ SkDEBUGCODE(SkDebugf("SkCairoFTTypeface::onFilterRec unimplemented\n"));
|
||||
+ }
|
||||
+
|
||||
+ virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE
|
||||
+ {
|
||||
+ SkDEBUGCODE(SkDebugf("SkCairoFTTypeface::onGetFontDescriptor unimplemented\n"));
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+private:
|
||||
+
|
||||
+ SkCairoFTTypeface(cairo_font_face_t* fontFace, SkTypeface::Style style, SkFontID id, bool isFixedWidth)
|
||||
+ : SkTypeface(style, id, isFixedWidth)
|
||||
+ , fFontFace(fontFace)
|
||||
+ {
|
||||
+ cairo_font_face_set_user_data(fFontFace, &kSkTypefaceKey, this, NULL);
|
||||
+ cairo_font_face_reference(fFontFace);
|
||||
+ }
|
||||
+
|
||||
+ ~SkCairoFTTypeface()
|
||||
+ {
|
||||
+ cairo_font_face_set_user_data(fFontFace, &kSkTypefaceKey, NULL, NULL);
|
||||
+ cairo_font_face_destroy(fFontFace);
|
||||
+ }
|
||||
+
|
||||
+ cairo_font_face_t* fFontFace;
|
||||
+};
|
||||
+
|
||||
+SkTypeface* SkCreateTypefaceFromCairoFont(cairo_font_face_t* fontFace, SkTypeface::Style style, bool isFixedWidth)
|
||||
+{
|
||||
+ SkTypeface* typeface = reinterpret_cast<SkTypeface*>(cairo_font_face_get_user_data(fontFace, &kSkTypefaceKey));
|
||||
+
|
||||
+ if (typeface) {
|
||||
+ typeface->ref();
|
||||
+ } else {
|
||||
+ typeface = SkCairoFTTypeface::CreateTypeface(fontFace, style, isFixedWidth);
|
||||
+ SkTypefaceCache::Add(typeface, style);
|
||||
+ }
|
||||
+
|
||||
+ return typeface;
|
||||
+}
|
||||
+
|
||||
+SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
|
||||
+ const char famillyName[],
|
||||
+ SkTypeface::Style style)
|
||||
+{
|
||||
+ SkDEBUGFAIL("SkFontHost::FindTypeface unimplemented");
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream*)
|
||||
+{
|
||||
+ SkDEBUGFAIL("SkFontHost::CreateTypeface unimplemented");
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+SkTypeface* SkFontHost::CreateTypefaceFromFile(char const*)
|
||||
+{
|
||||
+ SkDEBUGFAIL("SkFontHost::CreateTypefaceFromFile unimplemented");
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+///////////////////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+static bool isLCD(const SkScalerContext::Rec& rec) {
|
||||
+ switch (rec.fMaskFormat) {
|
||||
+ case SkMask::kLCD16_Format:
|
||||
+ case SkMask::kLCD32_Format:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+///////////////////////////////////////////////////////////////////////////////
|
||||
+SkScalerContext_CairoFT::SkScalerContext_CairoFT(SkTypeface* typeface, const SkDescriptor* desc)
|
||||
+ : SkScalerContext_FreeType_Base(typeface, desc)
|
||||
+{
|
||||
+ SkMatrix matrix;
|
||||
+ fRec.getSingleMatrix(&matrix);
|
||||
+
|
||||
+ cairo_font_face_t* fontFace = static_cast<SkCairoFTTypeface*>(typeface)->getFontFace();
|
||||
+
|
||||
+ cairo_matrix_t fontMatrix, ctMatrix;
|
||||
+ cairo_matrix_init(&fontMatrix, matrix.getScaleX(), matrix.getSkewY(), matrix.getSkewX(), matrix.getScaleY(), 0.0, 0.0);
|
||||
+ cairo_matrix_init_scale(&ctMatrix, 1.0, 1.0);
|
||||
+
|
||||
+ // We need to ensure that the font options match for hinting, as generateMetrics()
|
||||
+ // uses the fScaledFont which uses these font options
|
||||
+ cairo_font_options_t *fontOptions = cairo_font_options_create();
|
||||
+
|
||||
+ FT_Int32 loadFlags = FT_LOAD_DEFAULT;
|
||||
+
|
||||
+ if (SkMask::kBW_Format == fRec.fMaskFormat) {
|
||||
+ // See http://code.google.com/p/chromium/issues/detail?id=43252#c24
|
||||
+ loadFlags = FT_LOAD_TARGET_MONO;
|
||||
+ if (fRec.getHinting() == SkPaint::kNo_Hinting) {
|
||||
+ cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_NONE);
|
||||
+ loadFlags = FT_LOAD_NO_HINTING;
|
||||
+ }
|
||||
+ } else {
|
||||
+ switch (fRec.getHinting()) {
|
||||
+ case SkPaint::kNo_Hinting:
|
||||
+ loadFlags = FT_LOAD_NO_HINTING;
|
||||
+ cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_NONE);
|
||||
+ break;
|
||||
+ case SkPaint::kSlight_Hinting:
|
||||
+ loadFlags = FT_LOAD_TARGET_LIGHT; // This implies FORCE_AUTOHINT
|
||||
+ cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_SLIGHT);
|
||||
+ break;
|
||||
+ case SkPaint::kNormal_Hinting:
|
||||
+ cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_MEDIUM);
|
||||
+ if (fRec.fFlags & SkScalerContext::kAutohinting_Flag) {
|
||||
+ loadFlags = FT_LOAD_FORCE_AUTOHINT;
|
||||
+ }
|
||||
+ break;
|
||||
+ case SkPaint::kFull_Hinting:
|
||||
+ cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_FULL);
|
||||
+ if (fRec.fFlags & SkScalerContext::kAutohinting_Flag) {
|
||||
+ loadFlags = FT_LOAD_FORCE_AUTOHINT;
|
||||
+ }
|
||||
+ if (isLCD(fRec)) {
|
||||
+ if (SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag)) {
|
||||
+ loadFlags = FT_LOAD_TARGET_LCD_V;
|
||||
+ } else {
|
||||
+ loadFlags = FT_LOAD_TARGET_LCD;
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ SkDebugf("---------- UNKNOWN hinting %d\n", fRec.getHinting());
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fScaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctMatrix, fontOptions);
|
||||
+
|
||||
+ if ((fRec.fFlags & SkScalerContext::kEmbeddedBitmapText_Flag) == 0) {
|
||||
+ loadFlags |= FT_LOAD_NO_BITMAP;
|
||||
+ }
|
||||
+
|
||||
+ // Always using FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH to get correct
|
||||
+ // advances, as fontconfig and cairo do.
|
||||
+ // See http://code.google.com/p/skia/issues/detail?id=222.
|
||||
+ loadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
|
||||
+
|
||||
+ fLoadGlyphFlags = loadFlags;
|
||||
+}
|
||||
+
|
||||
+SkScalerContext_CairoFT::~SkScalerContext_CairoFT()
|
||||
+{
|
||||
+ cairo_scaled_font_destroy(fScaledFont);
|
||||
+}
|
||||
+
|
||||
+unsigned SkScalerContext_CairoFT::generateGlyphCount()
|
||||
+{
|
||||
+ CairoLockedFTFace faceLock(fScaledFont);
|
||||
+ return faceLock.getFace()->num_glyphs;
|
||||
+}
|
||||
+
|
||||
+uint16_t SkScalerContext_CairoFT::generateCharToGlyph(SkUnichar uniChar)
|
||||
+{
|
||||
+ CairoLockedFTFace faceLock(fScaledFont);
|
||||
+ return SkToU16(FT_Get_Char_Index(faceLock.getFace(), uniChar));
|
||||
+}
|
||||
+
|
||||
+void SkScalerContext_CairoFT::generateAdvance(SkGlyph* glyph)
|
||||
+{
|
||||
+ generateMetrics(glyph);
|
||||
+}
|
||||
+
|
||||
+void SkScalerContext_CairoFT::generateMetrics(SkGlyph* glyph)
|
||||
+{
|
||||
+ SkASSERT(fScaledFont != NULL);
|
||||
+ cairo_text_extents_t extents;
|
||||
+ cairo_glyph_t cairoGlyph = { glyph->getGlyphID(fBaseGlyphCount), 0.0, 0.0 };
|
||||
+ cairo_scaled_font_glyph_extents(fScaledFont, &cairoGlyph, 1, &extents);
|
||||
+
|
||||
+ glyph->fAdvanceX = SkDoubleToFixed(extents.x_advance);
|
||||
+ glyph->fAdvanceY = SkDoubleToFixed(extents.y_advance);
|
||||
+ glyph->fWidth = SkToU16(SkScalarCeil(extents.width));
|
||||
+ glyph->fHeight = SkToU16(SkScalarCeil(extents.height));
|
||||
+ glyph->fLeft = SkToS16(SkScalarCeil(extents.x_bearing));
|
||||
+ glyph->fTop = SkToS16(SkScalarCeil(extents.y_bearing));
|
||||
+ glyph->fLsbDelta = 0;
|
||||
+ glyph->fRsbDelta = 0;
|
||||
+}
|
||||
+
|
||||
+void SkScalerContext_CairoFT::generateImage(const SkGlyph& glyph)
|
||||
+{
|
||||
+ SkASSERT(fScaledFont != NULL);
|
||||
+ CairoLockedFTFace faceLock(fScaledFont);
|
||||
+ FT_Face face = faceLock.getFace();
|
||||
+
|
||||
+ FT_Error err = FT_Load_Glyph(face, glyph.getGlyphID(fBaseGlyphCount), fLoadGlyphFlags);
|
||||
+
|
||||
+ if (err != 0) {
|
||||
+ memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ generateGlyphImage(face, glyph);
|
||||
+}
|
||||
+
|
||||
+void SkScalerContext_CairoFT::generatePath(const SkGlyph& glyph, SkPath* path)
|
||||
+{
|
||||
+ SkASSERT(fScaledFont != NULL);
|
||||
+ CairoLockedFTFace faceLock(fScaledFont);
|
||||
+ FT_Face face = faceLock.getFace();
|
||||
+
|
||||
+ SkASSERT(&glyph && path);
|
||||
+
|
||||
+ uint32_t flags = fLoadGlyphFlags;
|
||||
+ flags |= FT_LOAD_NO_BITMAP; // ignore embedded bitmaps so we're sure to get the outline
|
||||
+ flags &= ~FT_LOAD_RENDER; // don't scan convert (we just want the outline)
|
||||
+
|
||||
+ FT_Error err = FT_Load_Glyph(face, glyph.getGlyphID(fBaseGlyphCount), flags);
|
||||
+
|
||||
+ if (err != 0) {
|
||||
+ path->reset();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ generateGlyphPath(face, path);
|
||||
+}
|
||||
+
|
||||
+void SkScalerContext_CairoFT::generateFontMetrics(SkPaint::FontMetrics* mx,
|
||||
+ SkPaint::FontMetrics* my)
|
||||
+{
|
||||
+ SkDEBUGCODE(SkDebugf("SkScalerContext_CairoFT::generateFontMetrics unimplemented\n"));
|
||||
+}
|
||||
+
|
||||
+SkUnichar SkScalerContext_CairoFT::generateGlyphToChar(uint16_t glyph)
|
||||
+{
|
||||
+ SkASSERT(fScaledFont != NULL);
|
||||
+ CairoLockedFTFace faceLock(fScaledFont);
|
||||
+ FT_Face face = faceLock.getFace();
|
||||
+
|
||||
+ FT_UInt glyphIndex;
|
||||
+ SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
|
||||
+ while (glyphIndex != 0) {
|
||||
+ if (glyphIndex == glyph) {
|
||||
+ return charCode;
|
||||
+ }
|
||||
+ charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef SK_BUILD_FOR_ANDROID
|
||||
+SkTypeface* SkAndroidNextLogicalTypeface(SkFontID currFontID,
|
||||
+ SkFontID origFontID) {
|
||||
+ return NULL;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+///////////////////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+#include "SkFontMgr.h"
|
||||
+
|
||||
+SkFontMgr* SkFontMgr::Factory() {
|
||||
+ // todo
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,27 @@
|
||||
From: George Wright <gw@gwright.org.uk>
|
||||
Date: Thu, 25 Apr 2013 20:40:12 -0400
|
||||
Subject: Bug 848491 - Re-apply Bug 777614 - Add our SkUserConfig.h
|
||||
|
||||
|
||||
diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h
|
||||
index 63fc90d..c965e91 100644
|
||||
--- a/gfx/skia/include/config/SkUserConfig.h
|
||||
+++ b/gfx/skia/include/config/SkUserConfig.h
|
||||
@@ -201,4 +201,14 @@
|
||||
*/
|
||||
//#define SK_SUPPORT_GPU 1
|
||||
|
||||
+/* Don't dither 32bit gradients, to match what the canvas test suite expects.
|
||||
+ */
|
||||
+#define SK_DISABLE_DITHER_32BIT_GRADIENT
|
||||
+
|
||||
+/* Don't include stdint.h on windows as it conflicts with our build system.
|
||||
+ */
|
||||
+#ifdef SK_BUILD_FOR_WIN32
|
||||
+ #define SK_IGNORE_STDINT_DOT_H
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,168 @@
|
||||
From: George Wright <gw@gwright.org.uk>
|
||||
Date: Thu, 25 Apr 2013 20:47:06 -0400
|
||||
Subject: Bug 848491 - Re-apply bug 687188 - Expand the gradient cache by 2 to store 0/1 colour stop values for clamping.
|
||||
|
||||
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkGradientShader.cpp b/gfx/skia/src/effects/gradients/SkGradientShader.cpp
|
||||
index 684355d..27a9c46 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkGradientShader.cpp
|
||||
+++ b/gfx/skia/src/effects/gradients/SkGradientShader.cpp
|
||||
@@ -453,15 +453,15 @@ const uint16_t* SkGradientShaderBase::getCache16() const {
|
||||
|
||||
const SkPMColor* SkGradientShaderBase::getCache32() const {
|
||||
if (fCache32 == NULL) {
|
||||
- // double the count for dither entries
|
||||
- const int entryCount = kCache32Count * 4;
|
||||
+ // double the count for dither entries, and have an extra two entries for clamp values
|
||||
+ const int entryCount = kCache32Count * 4 + 2;
|
||||
const size_t allocSize = sizeof(SkPMColor) * entryCount;
|
||||
|
||||
if (NULL == fCache32PixelRef) {
|
||||
fCache32PixelRef = SkNEW_ARGS(SkMallocPixelRef,
|
||||
(NULL, allocSize, NULL));
|
||||
}
|
||||
- fCache32 = (SkPMColor*)fCache32PixelRef->getAddr();
|
||||
+ fCache32 = (SkPMColor*)fCache32PixelRef->getAddr() + 1;
|
||||
if (fColorCount == 2) {
|
||||
Build32bitCache(fCache32, fOrigColors[0], fOrigColors[1],
|
||||
kCache32Count, fCacheAlpha);
|
||||
@@ -484,7 +484,7 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
|
||||
SkMallocPixelRef* newPR = SkNEW_ARGS(SkMallocPixelRef,
|
||||
(NULL, allocSize, NULL));
|
||||
SkPMColor* linear = fCache32; // just computed linear data
|
||||
- SkPMColor* mapped = (SkPMColor*)newPR->getAddr(); // storage for mapped data
|
||||
+ SkPMColor* mapped = (SkPMColor*)newPR->getAddr() + 1; // storage for mapped data
|
||||
SkUnitMapper* map = fMapper;
|
||||
for (int i = 0; i < kCache32Count; i++) {
|
||||
int index = map->mapUnit16((i << 8) | i) >> 8;
|
||||
@@ -495,9 +495,21 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
|
||||
}
|
||||
fCache32PixelRef->unref();
|
||||
fCache32PixelRef = newPR;
|
||||
- fCache32 = (SkPMColor*)newPR->getAddr();
|
||||
+ fCache32 = (SkPMColor*)newPR->getAddr() + 1;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Write the clamp colours into the first and last entries of fCache32
|
||||
+ fCache32[kCache32ClampLower] = SkPackARGB32(fCacheAlpha,
|
||||
+ SkColorGetR(fOrigColors[0]),
|
||||
+ SkColorGetG(fOrigColors[0]),
|
||||
+ SkColorGetB(fOrigColors[0]));
|
||||
+
|
||||
+ fCache32[kCache32ClampUpper] = SkPackARGB32(fCacheAlpha,
|
||||
+ SkColorGetR(fOrigColors[fColorCount - 1]),
|
||||
+ SkColorGetG(fOrigColors[fColorCount - 1]),
|
||||
+ SkColorGetB(fOrigColors[fColorCount - 1]));
|
||||
+
|
||||
return fCache32;
|
||||
}
|
||||
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
|
||||
index 729ce4e..2cb6a9d 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
|
||||
+++ b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
|
||||
@@ -86,6 +86,9 @@ public:
|
||||
/// if dithering is disabled.
|
||||
kDitherStride32 = kCache32Count,
|
||||
kDitherStride16 = kCache16Count,
|
||||
+
|
||||
+ kCache32ClampLower = -1,
|
||||
+ kCache32ClampUpper = kCache32Count * 4
|
||||
};
|
||||
|
||||
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkLinearGradient.cpp b/gfx/skia/src/effects/gradients/SkLinearGradient.cpp
|
||||
index e0f216c..40ab918 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkLinearGradient.cpp
|
||||
+++ b/gfx/skia/src/effects/gradients/SkLinearGradient.cpp
|
||||
@@ -127,6 +127,17 @@ void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx,
|
||||
SkPMColor* SK_RESTRICT dstC,
|
||||
const SkPMColor* SK_RESTRICT cache,
|
||||
int toggle, int count) {
|
||||
+ if (proc == clamp_tileproc) {
|
||||
+ // No need to lerp or dither for clamp values
|
||||
+ if (fx < 0) {
|
||||
+ sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampLower], count);
|
||||
+ return;
|
||||
+ } else if (fx > 0xffff) {
|
||||
+ sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampUpper], count);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// We're a vertical gradient, so no change in a span.
|
||||
// If colors change sharply across the gradient, dithering is
|
||||
// insufficient (it subsamples the color space) and we need to lerp.
|
||||
@@ -154,10 +165,7 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
|
||||
range.init(fx, dx, count, 0, SkGradientShaderBase::kCache32Count - 1);
|
||||
|
||||
if ((count = range.fCount0) > 0) {
|
||||
- sk_memset32_dither(dstC,
|
||||
- cache[toggle + range.fV0],
|
||||
- cache[next_dither_toggle(toggle) + range.fV0],
|
||||
- count);
|
||||
+ sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampLower], count);
|
||||
dstC += count;
|
||||
}
|
||||
if ((count = range.fCount1) > 0) {
|
||||
@@ -176,10 +184,7 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
|
||||
}
|
||||
}
|
||||
if ((count = range.fCount2) > 0) {
|
||||
- sk_memset32_dither(dstC,
|
||||
- cache[toggle + range.fV1],
|
||||
- cache[next_dither_toggle(toggle) + range.fV1],
|
||||
- count);
|
||||
+ sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampUpper], count);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp b/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp
|
||||
index abd974b..601fff4 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp
|
||||
+++ b/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp
|
||||
@@ -124,10 +124,14 @@ static void twopoint_clamp(TwoPtRadial* rec, SkPMColor* SK_RESTRICT dstC,
|
||||
if (TwoPtRadial::DontDrawT(t)) {
|
||||
*dstC++ = 0;
|
||||
} else {
|
||||
- SkFixed index = SkClampMax(t, 0xFFFF);
|
||||
- SkASSERT(index <= 0xFFFF);
|
||||
- *dstC++ = cache[toggle +
|
||||
- (index >> SkGradientShaderBase::kCache32Shift)];
|
||||
+ if (t < 0) {
|
||||
+ *dstC++ = cache[SkGradientShaderBase::kCache32ClampLower];
|
||||
+ } else if (t > 0xFFFF) {
|
||||
+ *dstC++ = cache[SkGradientShaderBase::kCache32ClampUpper];
|
||||
+ } else {
|
||||
+ SkASSERT(t <= 0xFFFF);
|
||||
+ *dstC++ = cache[t >> SkGradientShaderBase::kCache32Shift];
|
||||
+ }
|
||||
}
|
||||
toggle = next_dither_toggle(toggle);
|
||||
}
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp b/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp
|
||||
index f70b67d..ec2ae75 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp
|
||||
+++ b/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp
|
||||
@@ -120,9 +120,14 @@ void shadeSpan_twopoint_clamp(SkScalar fx, SkScalar dx,
|
||||
for (; count > 0; --count) {
|
||||
SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
|
||||
fOneOverTwoA, posRoot);
|
||||
- SkFixed index = SkClampMax(t, 0xFFFF);
|
||||
- SkASSERT(index <= 0xFFFF);
|
||||
- *dstC++ = cache[index >> SkGradientShaderBase::kCache32Shift];
|
||||
+ if (t < 0) {
|
||||
+ *dstC++ = cache[SkGradientShaderBase::kCache32ClampLower];
|
||||
+ } else if (t > 0xFFFF) {
|
||||
+ *dstC++ = cache[SkGradientShaderBase::kCache32ClampUpper];
|
||||
+ } else {
|
||||
+ SkASSERT(t <= 0xFFFF);
|
||||
+ *dstC++ = cache[t >> SkGradientShaderBase::kCache32Shift];
|
||||
+ }
|
||||
fx += dx;
|
||||
fy += dy;
|
||||
b += db;
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,35 @@
|
||||
From: George Wright <gw@gwright.org.uk>
|
||||
Date: Thu, 25 Apr 2013 20:49:45 -0400
|
||||
Subject: Bug 848491 - Re-apply 759683 - Handle compilers that don't support SSSE3 intrinsics
|
||||
|
||||
|
||||
diff --git a/gfx/skia/src/opts/opts_check_SSE2.cpp b/gfx/skia/src/opts/opts_check_SSE2.cpp
|
||||
index 6370058..18f68d6 100644
|
||||
--- a/gfx/skia/src/opts/opts_check_SSE2.cpp
|
||||
+++ b/gfx/skia/src/opts/opts_check_SSE2.cpp
|
||||
@@ -86,9 +86,13 @@ static inline bool hasSSSE3() {
|
||||
#else
|
||||
|
||||
static inline bool hasSSSE3() {
|
||||
+#if defined(SK_BUILD_SSSE3)
|
||||
int cpu_info[4] = { 0 };
|
||||
getcpuid(1, cpu_info);
|
||||
return (cpu_info[2] & 0x200) != 0;
|
||||
+#else
|
||||
+ return false;
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -104,7 +108,7 @@ static bool cachedHasSSSE3() {
|
||||
|
||||
void SkBitmapProcState::platformProcs() {
|
||||
if (cachedHasSSSE3()) {
|
||||
-#if !defined(SK_BUILD_FOR_ANDROID)
|
||||
+#if !defined(SK_BUILD_FOR_ANDROID) && defined(SK_BUILD_SSSE3)
|
||||
// Disable SSSE3 optimization for Android x86
|
||||
if (fSampleProc32 == S32_opaque_D32_filter_DX) {
|
||||
fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3;
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,23 @@
|
||||
From: George Wright <gw@gwright.org.uk>
|
||||
Date: Thu, 25 Apr 2013 20:52:32 -0400
|
||||
Subject: Bug 848491 - Re-apply bug 751418 - Add our own GrUserConfig
|
||||
|
||||
|
||||
diff --git a/gfx/skia/include/gpu/GrUserConfig.h b/gfx/skia/include/gpu/GrUserConfig.h
|
||||
index 11d4feb..77ab850 100644
|
||||
--- a/gfx/skia/include/gpu/GrUserConfig.h
|
||||
+++ b/gfx/skia/include/gpu/GrUserConfig.h
|
||||
@@ -43,6 +43,10 @@
|
||||
*/
|
||||
//#define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
|
||||
|
||||
+/*
|
||||
+ * This allows us to set a callback to be called before each GL call to ensure
|
||||
+ * that our context is set correctly
|
||||
+ */
|
||||
#define GR_GL_PER_GL_FUNC_CALLBACK 1
|
||||
|
||||
#endif
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,22 @@
|
||||
From: George Wright <gw@gwright.org.uk>
|
||||
Date: Thu, 25 Apr 2013 20:55:02 -0400
|
||||
Subject: Bug 848491 - Re-apply bug 817356 - Patch Skia to recognize uppercase PPC/PPC64.
|
||||
|
||||
|
||||
diff --git a/gfx/skia/include/core/SkPreConfig.h b/gfx/skia/include/core/SkPreConfig.h
|
||||
index 11cb223..7e95b99 100644
|
||||
--- a/gfx/skia/include/core/SkPreConfig.h
|
||||
+++ b/gfx/skia/include/core/SkPreConfig.h
|
||||
@@ -99,7 +99,8 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
|
||||
- #if defined (__ppc__) || defined(__ppc64__)
|
||||
+ #if defined (__ppc__) || defined(__PPC__) || defined(__ppc64__) \
|
||||
+ || defined(__PPC64__)
|
||||
#define SK_CPU_BENDIAN
|
||||
#else
|
||||
#define SK_CPU_LENDIAN
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,39 @@
|
||||
From: George Wright <gwright@mozilla.com>
|
||||
Date: Thu, 20 Jun 2013 09:21:21 -0400
|
||||
Subject: Bug 848491 - Re-apply bug 795538 - Ensure we use the correct colour (and alpha) for the clamp values r=mattwoodrow
|
||||
|
||||
|
||||
diff --git a/gfx/skia/src/effects/gradients/SkGradientShader.cpp b/gfx/skia/src/effects/gradients/SkGradientShader.cpp
|
||||
index 27a9c46..ce077b5 100644
|
||||
--- a/gfx/skia/src/effects/gradients/SkGradientShader.cpp
|
||||
+++ b/gfx/skia/src/effects/gradients/SkGradientShader.cpp
|
||||
@@ -500,15 +500,17 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
|
||||
}
|
||||
|
||||
// Write the clamp colours into the first and last entries of fCache32
|
||||
- fCache32[kCache32ClampLower] = SkPackARGB32(fCacheAlpha,
|
||||
- SkColorGetR(fOrigColors[0]),
|
||||
- SkColorGetG(fOrigColors[0]),
|
||||
- SkColorGetB(fOrigColors[0]));
|
||||
-
|
||||
- fCache32[kCache32ClampUpper] = SkPackARGB32(fCacheAlpha,
|
||||
- SkColorGetR(fOrigColors[fColorCount - 1]),
|
||||
- SkColorGetG(fOrigColors[fColorCount - 1]),
|
||||
- SkColorGetB(fOrigColors[fColorCount - 1]));
|
||||
+ fCache32[kCache32ClampLower] = SkPremultiplyARGBInline(SkMulDiv255Round(SkColorGetA(fOrigColors[0]),
|
||||
+ fCacheAlpha),
|
||||
+ SkColorGetR(fOrigColors[0]),
|
||||
+ SkColorGetG(fOrigColors[0]),
|
||||
+ SkColorGetB(fOrigColors[0]));
|
||||
+
|
||||
+ fCache32[kCache32ClampUpper] = SkPremultiplyARGBInline(SkMulDiv255Round(SkColorGetA(fOrigColors[fColorCount - 1]),
|
||||
+ fCacheAlpha),
|
||||
+ SkColorGetR(fOrigColors[fColorCount - 1]),
|
||||
+ SkColorGetG(fOrigColors[fColorCount - 1]),
|
||||
+ SkColorGetB(fOrigColors[fColorCount - 1]));
|
||||
|
||||
return fCache32;
|
||||
}
|
||||
--
|
||||
1.7.11.7
|
||||
|
Loading…
Reference in New Issue
Block a user