[arch-commits] Commit in qt5-webengine/repos (8 files)

Jan Steffens heftig at archlinux.org
Wed Sep 20 06:39:53 UTC 2017


    Date: Wednesday, September 20, 2017 @ 06:39:52
  Author: heftig
Revision: 305891

archrelease: copy trunk to testing-i686, testing-x86_64

Added:
  qt5-webengine/repos/testing-i686/
  qt5-webengine/repos/testing-i686/PKGBUILD
    (from rev 305890, qt5-webengine/trunk/PKGBUILD)
  qt5-webengine/repos/testing-i686/clip-ft-glyph.diff
    (from rev 305890, qt5-webengine/trunk/clip-ft-glyph.diff)
  qt5-webengine/repos/testing-i686/harmony-fix.diff
    (from rev 305890, qt5-webengine/trunk/harmony-fix.diff)
  qt5-webengine/repos/testing-x86_64/
  qt5-webengine/repos/testing-x86_64/PKGBUILD
    (from rev 305890, qt5-webengine/trunk/PKGBUILD)
  qt5-webengine/repos/testing-x86_64/clip-ft-glyph.diff
    (from rev 305890, qt5-webengine/trunk/clip-ft-glyph.diff)
  qt5-webengine/repos/testing-x86_64/harmony-fix.diff
    (from rev 305890, qt5-webengine/trunk/harmony-fix.diff)

-----------------------------------+
 testing-i686/PKGBUILD             |   56 ++++++++++++
 testing-i686/clip-ft-glyph.diff   |  162 ++++++++++++++++++++++++++++++++++++
 testing-i686/harmony-fix.diff     |   69 +++++++++++++++
 testing-x86_64/PKGBUILD           |   56 ++++++++++++
 testing-x86_64/clip-ft-glyph.diff |  162 ++++++++++++++++++++++++++++++++++++
 testing-x86_64/harmony-fix.diff   |   69 +++++++++++++++
 6 files changed, 574 insertions(+)

Copied: qt5-webengine/repos/testing-i686/PKGBUILD (from rev 305890, qt5-webengine/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD	                        (rev 0)
+++ testing-i686/PKGBUILD	2017-09-20 06:39:52 UTC (rev 305891)
@@ -0,0 +1,56 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Andrea Scarpino <andrea at archlinux.org>
+
+pkgname=qt5-webengine
+_qtver=5.9.1
+pkgver=${_qtver/-/}
+pkgrel=4
+arch=('i686' 'x86_64')
+url='http://qt-project.org/'
+license=('LGPL3' 'LGPL2.1' 'BSD')
+pkgdesc='Provides support for web applications using the Chromium browser project'
+depends=('qt5-webchannel' 'qt5-location' 'libxcomposite' 'libxrandr' 'pciutils' 'libxss' 'libvpx' 
+         'libevent' 'libsrtp' 'snappy' 'nss' 'protobuf' 'libxslt' 'libxdamage' 'minizip' 'ffmpeg')
+         # namcap note: libxdamage is needed for nvidia users
+makedepends=('python2' 'git' 'gperf' 'jsoncpp' 'ninja')
+groups=('qt' 'qt5')
+_pkgfqn="${pkgname/5-/}-opensource-src-${_qtver}"
+source=("http://download.qt.io/official_releases/qt/${pkgver%.*}/${_qtver}/submodules/${_pkgfqn}.tar.xz"
+         clip-ft-glyph.diff harmony-fix.diff)
+sha256sums=('f6a37eeb9188474a16d29ede498fce959396ab80329a0a83eaeb925251686401'
+            'd5e5580a96ecc4a66ce12dde0737c1ed5cb31017a6ec488ffe372192ed893e1b'
+            '2c309c0f6978e6a399422319b5034b01881d5526cf48b2ee5fcc7f418029a344')
+
+prepare() {
+  mkdir -p build
+
+  # Hack to force using python2
+  mkdir -p bin
+  ln -s /usr/bin/python2 bin/python
+
+  cd ${_pkgfqn}
+
+  # FreeType 2.8.1
+  patch -d src/3rdparty/chromium/third_party -Np3 < ../clip-ft-glyph.diff
+  patch -Np1 -i ../harmony-fix.diff
+}
+
+build() {
+  cd build
+
+  export PATH="$srcdir/bin:$PATH"
+  qmake CONFIG+="proprietary-codecs" WEBENGINE_CONFIG+="use_proprietary_codecs use_system_ffmpeg use_system_icu" ../${_pkgfqn}
+  make
+}
+
+package() {
+  cd build
+  make INSTALL_ROOT="$pkgdir" install
+
+  # Drop QMAKE_PRL_BUILD_DIR because reference the build dir
+  find "$pkgdir/usr/lib" -type f -name '*.prl' \
+    -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
+
+  install -Dm644 "$srcdir"/${_pkgfqn}/src/3rdparty/chromium/LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE.chromium
+}

Copied: qt5-webengine/repos/testing-i686/clip-ft-glyph.diff (from rev 305890, qt5-webengine/trunk/clip-ft-glyph.diff)
===================================================================
--- testing-i686/clip-ft-glyph.diff	                        (rev 0)
+++ testing-i686/clip-ft-glyph.diff	2017-09-20 06:39:52 UTC (rev 305891)
@@ -0,0 +1,162 @@
+# HG changeset patch
+# User Lee Salzman <lsalzman at mozilla.com>
+# Date 1504120456 14400
+#      Wed Aug 30 15:14:16 2017 -0400
+# Node ID 708d52f954b6d7ca2497fcb5b5084c6483300e89
+# Parent  33224536ce20d942576cd4b9ffb350d6dce397bc
+clip FreeType glyph bitmap to mask in Skia
+
+MozReview-Commit-ID: 9NqLj9SkHFo
+
+diff --git a/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp b/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
+--- a/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
++++ b/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
+@@ -390,65 +390,131 @@ void SkScalerContext_FreeType_Base::gene
+     const SkMatrix& bitmapTransform)
+ {
+     const bool doBGR = SkToBool(fRec.fFlags & SkScalerContext::kLCD_BGROrder_Flag);
+     const bool doVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag);
+ 
+     switch ( face->glyph->format ) {
+         case FT_GLYPH_FORMAT_OUTLINE: {
+             FT_Outline* outline = &face->glyph->outline;
+-            FT_BBox     bbox;
+-            FT_Bitmap   target;
+ 
+             int dx = 0, dy = 0;
+             if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) {
+                 dx = SkFixedToFDot6(glyph.getSubXFixed());
+                 dy = SkFixedToFDot6(glyph.getSubYFixed());
+                 // negate dy since freetype-y-goes-up and skia-y-goes-down
+                 dy = -dy;
+             }
+-            FT_Outline_Get_CBox(outline, &bbox);
+-            /*
+-                what we really want to do for subpixel is
+-                    offset(dx, dy)
+-                    compute_bounds
+-                    offset(bbox & !63)
+-                but that is two calls to offset, so we do the following, which
+-                achieves the same thing with only one offset call.
+-            */
+-            FT_Outline_Translate(outline, dx - ((bbox.xMin + dx) & ~63),
+-                                          dy - ((bbox.yMin + dy) & ~63));
++
++            memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
+ 
+             if (SkMask::kLCD16_Format == glyph.fMaskFormat) {
++                FT_Outline_Translate(outline, dx, dy);
+                 FT_Error err = FT_Render_Glyph(face->glyph, doVert ? FT_RENDER_MODE_LCD_V :
+                                                                      FT_RENDER_MODE_LCD);
+                 if (err) {
+                     SK_TRACEFTR(err, "Could not render glyph.");
+-                    sk_bzero(glyph.fImage, glyph.computeImageSize());
+                     return;
+                 }
++
+                 SkMask mask;
+                 glyph.toMask(&mask);
++#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
++                memset(mask.fImage, 0x80, mask.fBounds.height() * mask.fRowBytes);
++#endif
++                FT_GlyphSlotRec& ftGlyph = *face->glyph;
++
++                if (!SkIRect::Intersects(mask.fBounds,
++                                         SkIRect::MakeXYWH( ftGlyph.bitmap_left,
++                                                           -ftGlyph.bitmap_top,
++                                                            ftGlyph.bitmap.width,
++                                                            ftGlyph.bitmap.rows)))
++                {
++                    return;
++                }
++
++                // If the FT_Bitmap extent is larger, discard bits of the bitmap outside the mask.
++                // If the SkMask extent is larger, shrink mask to fit bitmap (clearing discarded).
++                unsigned char* origBuffer = ftGlyph.bitmap.buffer;
++                // First align the top left (origin).
++                if (-ftGlyph.bitmap_top < mask.fBounds.fTop) {
++                    int32_t topDiff = mask.fBounds.fTop - (-ftGlyph.bitmap_top);
++                    ftGlyph.bitmap.buffer += ftGlyph.bitmap.pitch * topDiff;
++                    ftGlyph.bitmap.rows -= topDiff;
++                    ftGlyph.bitmap_top = -mask.fBounds.fTop;
++                }
++                if (ftGlyph.bitmap_left < mask.fBounds.fLeft) {
++                    int32_t leftDiff = mask.fBounds.fLeft - ftGlyph.bitmap_left;
++                    ftGlyph.bitmap.buffer += leftDiff;
++                    ftGlyph.bitmap.width -= leftDiff;
++                    ftGlyph.bitmap_left = mask.fBounds.fLeft;
++                }
++                if (mask.fBounds.fTop < -ftGlyph.bitmap_top) {
++                    mask.fImage += mask.fRowBytes * (-ftGlyph.bitmap_top - mask.fBounds.fTop);
++                    mask.fBounds.fTop = -ftGlyph.bitmap_top;
++                }
++                if (mask.fBounds.fLeft < ftGlyph.bitmap_left) {
++                    mask.fImage += sizeof(uint16_t) * (ftGlyph.bitmap_left - mask.fBounds.fLeft);
++                    mask.fBounds.fLeft = ftGlyph.bitmap_left;
++                }
++                // Origins aligned, clean up the width and height.
++                int ftVertScale = (doVert ? 3 : 1);
++                int ftHoriScale = (doVert ? 1 : 3);
++                if (mask.fBounds.height() * ftVertScale < SkToInt(ftGlyph.bitmap.rows)) {
++                    ftGlyph.bitmap.rows = mask.fBounds.height() * ftVertScale;
++                }
++                if (mask.fBounds.width() * ftHoriScale < SkToInt(ftGlyph.bitmap.width)) {
++                    ftGlyph.bitmap.width = mask.fBounds.width() * ftHoriScale;
++                }
++                if (SkToInt(ftGlyph.bitmap.rows) < mask.fBounds.height() * ftVertScale) {
++                    mask.fBounds.fBottom = mask.fBounds.fTop + ftGlyph.bitmap.rows / ftVertScale;
++                }
++                if (SkToInt(ftGlyph.bitmap.width) < mask.fBounds.width() * ftHoriScale) {
++                    mask.fBounds.fRight = mask.fBounds.fLeft + ftGlyph.bitmap.width / ftHoriScale;
++                }
+                 if (fPreBlend.isApplicable()) {
+-                    copyFT2LCD16<true>(face->glyph->bitmap, mask, doBGR,
++                    copyFT2LCD16<true>(ftGlyph.bitmap, mask, doBGR,
+                                        fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
+                 } else {
+-                    copyFT2LCD16<false>(face->glyph->bitmap, mask, doBGR,
++                    copyFT2LCD16<false>(ftGlyph.bitmap, mask, doBGR,
+                                         fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
+                 }
++                // Restore the buffer pointer so FreeType can properly free it.
++                ftGlyph.bitmap.buffer = origBuffer;
+             } else {
++                FT_BBox     bbox;
++                FT_Bitmap   target;
++                FT_Outline_Get_CBox(outline, &bbox);
++                /*
++                    what we really want to do for subpixel is
++                        offset(dx, dy)
++                        compute_bounds
++                        offset(bbox & !63)
++                    but that is two calls to offset, so we do the following, which
++                    achieves the same thing with only one offset call.
++                */
++                FT_Outline_Translate(outline, dx - ((bbox.xMin + dx) & ~63),
++                                              dy - ((bbox.yMin + dy) & ~63));
++
+                 target.width = glyph.fWidth;
+                 target.rows = glyph.fHeight;
+                 target.pitch = glyph.rowBytes();
+                 target.buffer = reinterpret_cast<uint8_t*>(glyph.fImage);
+                 target.pixel_mode = compute_pixel_mode( (SkMask::Format)fRec.fMaskFormat);
+                 target.num_grays = 256;
+ 
+-                memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
+                 FT_Outline_Get_Bitmap(face->glyph->library, outline, &target);
++#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
++                for (int y = 0; y < glyph.fHeight; ++y) {
++                    for (int x = 0; x < glyph.fWidth; ++x) {
++                        uint8_t& a = ((uint8_t*)glyph.fImage)[(glyph.rowBytes() * y) + x];
++                        a = SkTMax<uint8_t>(a, 0x20);
++                    }
++                }
++#endif
+             }
+         } break;
+ 
+         case FT_GLYPH_FORMAT_BITMAP: {
+             FT_Pixel_Mode pixel_mode = static_cast<FT_Pixel_Mode>(face->glyph->bitmap.pixel_mode);
+             SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
+ 
+             // Assume that the other formats do not exist.

Copied: qt5-webengine/repos/testing-i686/harmony-fix.diff (from rev 305890, qt5-webengine/trunk/harmony-fix.diff)
===================================================================
--- testing-i686/harmony-fix.diff	                        (rev 0)
+++ testing-i686/harmony-fix.diff	2017-09-20 06:39:52 UTC (rev 305891)
@@ -0,0 +1,69 @@
+diff -u -r qtwebengine-opensource-src-5.9.1/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp qtwebengine-opensource-src-5.9.1-ftfixes/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
+--- qtwebengine-opensource-src-5.9.1/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp	2017-09-19 17:38:43.659642835 +0200
++++ qtwebengine-opensource-src-5.9.1-ftfixes/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp	2017-09-19 17:38:50.492991631 +0200
+@@ -80,7 +80,7 @@
+ 
+ class FreeTypeLibrary : SkNoncopyable {
+ public:
+-    FreeTypeLibrary() : fLibrary(nullptr), fIsLCDSupported(false), fLCDExtra(0) {
++    FreeTypeLibrary() : fLibrary(nullptr) {
+         if (FT_New_Library(&gFTMemory, &fLibrary)) {
+             return;
+         }
+@@ -90,8 +90,6 @@
+         // Default { 0x10, 0x40, 0x70, 0x40, 0x10 } adds up to 0x110, simulating ink spread.
+         // SetLcdFilter must be called before SetLcdFilterWeights.
+         if (FT_Library_SetLcdFilter(fLibrary, FT_LCD_FILTER_DEFAULT) == 0) {
+-            fIsLCDSupported = true;
+-            fLCDExtra = 2; //Using a filter adds one full pixel to each side.
+ 
+ #ifdef SK_FONTHOST_FREETYPE_USE_NORMAL_LCD_FILTER
+             // Adds to 0x110 simulating ink spread, but provides better results than default.
+@@ -124,13 +122,9 @@
+     }
+ 
+     FT_Library library() { return fLibrary; }
+-    bool isLCDSupported() { return fIsLCDSupported; }
+-    int lcdExtra() { return fLCDExtra; }
+ 
+ private:
+     FT_Library fLibrary;
+-    bool fIsLCDSupported;
+-    int fLCDExtra;
+ 
+     // FT_Library_SetLcdFilterWeights was introduced in FreeType 2.4.0.
+     // The following platforms provide FreeType of at least 2.4.0.
+@@ -633,17 +627,6 @@
+         rec->fTextSize = SkIntToScalar(1 << 14);
+     }
+ 
+-    if (isLCD(*rec)) {
+-        // TODO: re-work so that FreeType is set-up and selected by the SkFontMgr.
+-        SkAutoMutexAcquire ama(gFTMutex);
+-        ref_ft_library();
+-        if (!gFTLibrary->isLCDSupported()) {
+-            // If the runtime Freetype library doesn't support LCD, disable it here.
+-            rec->fMaskFormat = SkMask::kA8_Format;
+-        }
+-        unref_ft_library();
+-    }
+-
+     SkPaint::Hinting h = rec->getHinting();
+     if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) {
+         // collapse full->normal hinting if we're not doing LCD
+@@ -1046,11 +1029,11 @@
+ void SkScalerContext_FreeType::updateGlyphIfLCD(SkGlyph* glyph) {
+     if (isLCD(fRec)) {
+         if (fLCDIsVert) {
+-            glyph->fHeight += gFTLibrary->lcdExtra();
+-            glyph->fTop -= gFTLibrary->lcdExtra() >> 1;
++            glyph->fHeight += 2;
++            glyph->fTop -= 1;
+         } else {
+-            glyph->fWidth += gFTLibrary->lcdExtra();
+-            glyph->fLeft -= gFTLibrary->lcdExtra() >> 1;
++            glyph->fWidth += 2;
++            glyph->fLeft -= 1;
+         }
+     }
+ }

Copied: qt5-webengine/repos/testing-x86_64/PKGBUILD (from rev 305890, qt5-webengine/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD	                        (rev 0)
+++ testing-x86_64/PKGBUILD	2017-09-20 06:39:52 UTC (rev 305891)
@@ -0,0 +1,56 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Andrea Scarpino <andrea at archlinux.org>
+
+pkgname=qt5-webengine
+_qtver=5.9.1
+pkgver=${_qtver/-/}
+pkgrel=4
+arch=('i686' 'x86_64')
+url='http://qt-project.org/'
+license=('LGPL3' 'LGPL2.1' 'BSD')
+pkgdesc='Provides support for web applications using the Chromium browser project'
+depends=('qt5-webchannel' 'qt5-location' 'libxcomposite' 'libxrandr' 'pciutils' 'libxss' 'libvpx' 
+         'libevent' 'libsrtp' 'snappy' 'nss' 'protobuf' 'libxslt' 'libxdamage' 'minizip' 'ffmpeg')
+         # namcap note: libxdamage is needed for nvidia users
+makedepends=('python2' 'git' 'gperf' 'jsoncpp' 'ninja')
+groups=('qt' 'qt5')
+_pkgfqn="${pkgname/5-/}-opensource-src-${_qtver}"
+source=("http://download.qt.io/official_releases/qt/${pkgver%.*}/${_qtver}/submodules/${_pkgfqn}.tar.xz"
+         clip-ft-glyph.diff harmony-fix.diff)
+sha256sums=('f6a37eeb9188474a16d29ede498fce959396ab80329a0a83eaeb925251686401'
+            'd5e5580a96ecc4a66ce12dde0737c1ed5cb31017a6ec488ffe372192ed893e1b'
+            '2c309c0f6978e6a399422319b5034b01881d5526cf48b2ee5fcc7f418029a344')
+
+prepare() {
+  mkdir -p build
+
+  # Hack to force using python2
+  mkdir -p bin
+  ln -s /usr/bin/python2 bin/python
+
+  cd ${_pkgfqn}
+
+  # FreeType 2.8.1
+  patch -d src/3rdparty/chromium/third_party -Np3 < ../clip-ft-glyph.diff
+  patch -Np1 -i ../harmony-fix.diff
+}
+
+build() {
+  cd build
+
+  export PATH="$srcdir/bin:$PATH"
+  qmake CONFIG+="proprietary-codecs" WEBENGINE_CONFIG+="use_proprietary_codecs use_system_ffmpeg use_system_icu" ../${_pkgfqn}
+  make
+}
+
+package() {
+  cd build
+  make INSTALL_ROOT="$pkgdir" install
+
+  # Drop QMAKE_PRL_BUILD_DIR because reference the build dir
+  find "$pkgdir/usr/lib" -type f -name '*.prl' \
+    -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
+
+  install -Dm644 "$srcdir"/${_pkgfqn}/src/3rdparty/chromium/LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE.chromium
+}

Copied: qt5-webengine/repos/testing-x86_64/clip-ft-glyph.diff (from rev 305890, qt5-webengine/trunk/clip-ft-glyph.diff)
===================================================================
--- testing-x86_64/clip-ft-glyph.diff	                        (rev 0)
+++ testing-x86_64/clip-ft-glyph.diff	2017-09-20 06:39:52 UTC (rev 305891)
@@ -0,0 +1,162 @@
+# HG changeset patch
+# User Lee Salzman <lsalzman at mozilla.com>
+# Date 1504120456 14400
+#      Wed Aug 30 15:14:16 2017 -0400
+# Node ID 708d52f954b6d7ca2497fcb5b5084c6483300e89
+# Parent  33224536ce20d942576cd4b9ffb350d6dce397bc
+clip FreeType glyph bitmap to mask in Skia
+
+MozReview-Commit-ID: 9NqLj9SkHFo
+
+diff --git a/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp b/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
+--- a/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
++++ b/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
+@@ -390,65 +390,131 @@ void SkScalerContext_FreeType_Base::gene
+     const SkMatrix& bitmapTransform)
+ {
+     const bool doBGR = SkToBool(fRec.fFlags & SkScalerContext::kLCD_BGROrder_Flag);
+     const bool doVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag);
+ 
+     switch ( face->glyph->format ) {
+         case FT_GLYPH_FORMAT_OUTLINE: {
+             FT_Outline* outline = &face->glyph->outline;
+-            FT_BBox     bbox;
+-            FT_Bitmap   target;
+ 
+             int dx = 0, dy = 0;
+             if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) {
+                 dx = SkFixedToFDot6(glyph.getSubXFixed());
+                 dy = SkFixedToFDot6(glyph.getSubYFixed());
+                 // negate dy since freetype-y-goes-up and skia-y-goes-down
+                 dy = -dy;
+             }
+-            FT_Outline_Get_CBox(outline, &bbox);
+-            /*
+-                what we really want to do for subpixel is
+-                    offset(dx, dy)
+-                    compute_bounds
+-                    offset(bbox & !63)
+-                but that is two calls to offset, so we do the following, which
+-                achieves the same thing with only one offset call.
+-            */
+-            FT_Outline_Translate(outline, dx - ((bbox.xMin + dx) & ~63),
+-                                          dy - ((bbox.yMin + dy) & ~63));
++
++            memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
+ 
+             if (SkMask::kLCD16_Format == glyph.fMaskFormat) {
++                FT_Outline_Translate(outline, dx, dy);
+                 FT_Error err = FT_Render_Glyph(face->glyph, doVert ? FT_RENDER_MODE_LCD_V :
+                                                                      FT_RENDER_MODE_LCD);
+                 if (err) {
+                     SK_TRACEFTR(err, "Could not render glyph.");
+-                    sk_bzero(glyph.fImage, glyph.computeImageSize());
+                     return;
+                 }
++
+                 SkMask mask;
+                 glyph.toMask(&mask);
++#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
++                memset(mask.fImage, 0x80, mask.fBounds.height() * mask.fRowBytes);
++#endif
++                FT_GlyphSlotRec& ftGlyph = *face->glyph;
++
++                if (!SkIRect::Intersects(mask.fBounds,
++                                         SkIRect::MakeXYWH( ftGlyph.bitmap_left,
++                                                           -ftGlyph.bitmap_top,
++                                                            ftGlyph.bitmap.width,
++                                                            ftGlyph.bitmap.rows)))
++                {
++                    return;
++                }
++
++                // If the FT_Bitmap extent is larger, discard bits of the bitmap outside the mask.
++                // If the SkMask extent is larger, shrink mask to fit bitmap (clearing discarded).
++                unsigned char* origBuffer = ftGlyph.bitmap.buffer;
++                // First align the top left (origin).
++                if (-ftGlyph.bitmap_top < mask.fBounds.fTop) {
++                    int32_t topDiff = mask.fBounds.fTop - (-ftGlyph.bitmap_top);
++                    ftGlyph.bitmap.buffer += ftGlyph.bitmap.pitch * topDiff;
++                    ftGlyph.bitmap.rows -= topDiff;
++                    ftGlyph.bitmap_top = -mask.fBounds.fTop;
++                }
++                if (ftGlyph.bitmap_left < mask.fBounds.fLeft) {
++                    int32_t leftDiff = mask.fBounds.fLeft - ftGlyph.bitmap_left;
++                    ftGlyph.bitmap.buffer += leftDiff;
++                    ftGlyph.bitmap.width -= leftDiff;
++                    ftGlyph.bitmap_left = mask.fBounds.fLeft;
++                }
++                if (mask.fBounds.fTop < -ftGlyph.bitmap_top) {
++                    mask.fImage += mask.fRowBytes * (-ftGlyph.bitmap_top - mask.fBounds.fTop);
++                    mask.fBounds.fTop = -ftGlyph.bitmap_top;
++                }
++                if (mask.fBounds.fLeft < ftGlyph.bitmap_left) {
++                    mask.fImage += sizeof(uint16_t) * (ftGlyph.bitmap_left - mask.fBounds.fLeft);
++                    mask.fBounds.fLeft = ftGlyph.bitmap_left;
++                }
++                // Origins aligned, clean up the width and height.
++                int ftVertScale = (doVert ? 3 : 1);
++                int ftHoriScale = (doVert ? 1 : 3);
++                if (mask.fBounds.height() * ftVertScale < SkToInt(ftGlyph.bitmap.rows)) {
++                    ftGlyph.bitmap.rows = mask.fBounds.height() * ftVertScale;
++                }
++                if (mask.fBounds.width() * ftHoriScale < SkToInt(ftGlyph.bitmap.width)) {
++                    ftGlyph.bitmap.width = mask.fBounds.width() * ftHoriScale;
++                }
++                if (SkToInt(ftGlyph.bitmap.rows) < mask.fBounds.height() * ftVertScale) {
++                    mask.fBounds.fBottom = mask.fBounds.fTop + ftGlyph.bitmap.rows / ftVertScale;
++                }
++                if (SkToInt(ftGlyph.bitmap.width) < mask.fBounds.width() * ftHoriScale) {
++                    mask.fBounds.fRight = mask.fBounds.fLeft + ftGlyph.bitmap.width / ftHoriScale;
++                }
+                 if (fPreBlend.isApplicable()) {
+-                    copyFT2LCD16<true>(face->glyph->bitmap, mask, doBGR,
++                    copyFT2LCD16<true>(ftGlyph.bitmap, mask, doBGR,
+                                        fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
+                 } else {
+-                    copyFT2LCD16<false>(face->glyph->bitmap, mask, doBGR,
++                    copyFT2LCD16<false>(ftGlyph.bitmap, mask, doBGR,
+                                         fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
+                 }
++                // Restore the buffer pointer so FreeType can properly free it.
++                ftGlyph.bitmap.buffer = origBuffer;
+             } else {
++                FT_BBox     bbox;
++                FT_Bitmap   target;
++                FT_Outline_Get_CBox(outline, &bbox);
++                /*
++                    what we really want to do for subpixel is
++                        offset(dx, dy)
++                        compute_bounds
++                        offset(bbox & !63)
++                    but that is two calls to offset, so we do the following, which
++                    achieves the same thing with only one offset call.
++                */
++                FT_Outline_Translate(outline, dx - ((bbox.xMin + dx) & ~63),
++                                              dy - ((bbox.yMin + dy) & ~63));
++
+                 target.width = glyph.fWidth;
+                 target.rows = glyph.fHeight;
+                 target.pitch = glyph.rowBytes();
+                 target.buffer = reinterpret_cast<uint8_t*>(glyph.fImage);
+                 target.pixel_mode = compute_pixel_mode( (SkMask::Format)fRec.fMaskFormat);
+                 target.num_grays = 256;
+ 
+-                memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
+                 FT_Outline_Get_Bitmap(face->glyph->library, outline, &target);
++#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
++                for (int y = 0; y < glyph.fHeight; ++y) {
++                    for (int x = 0; x < glyph.fWidth; ++x) {
++                        uint8_t& a = ((uint8_t*)glyph.fImage)[(glyph.rowBytes() * y) + x];
++                        a = SkTMax<uint8_t>(a, 0x20);
++                    }
++                }
++#endif
+             }
+         } break;
+ 
+         case FT_GLYPH_FORMAT_BITMAP: {
+             FT_Pixel_Mode pixel_mode = static_cast<FT_Pixel_Mode>(face->glyph->bitmap.pixel_mode);
+             SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
+ 
+             // Assume that the other formats do not exist.

Copied: qt5-webengine/repos/testing-x86_64/harmony-fix.diff (from rev 305890, qt5-webengine/trunk/harmony-fix.diff)
===================================================================
--- testing-x86_64/harmony-fix.diff	                        (rev 0)
+++ testing-x86_64/harmony-fix.diff	2017-09-20 06:39:52 UTC (rev 305891)
@@ -0,0 +1,69 @@
+diff -u -r qtwebengine-opensource-src-5.9.1/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp qtwebengine-opensource-src-5.9.1-ftfixes/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
+--- qtwebengine-opensource-src-5.9.1/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp	2017-09-19 17:38:43.659642835 +0200
++++ qtwebengine-opensource-src-5.9.1-ftfixes/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp	2017-09-19 17:38:50.492991631 +0200
+@@ -80,7 +80,7 @@
+ 
+ class FreeTypeLibrary : SkNoncopyable {
+ public:
+-    FreeTypeLibrary() : fLibrary(nullptr), fIsLCDSupported(false), fLCDExtra(0) {
++    FreeTypeLibrary() : fLibrary(nullptr) {
+         if (FT_New_Library(&gFTMemory, &fLibrary)) {
+             return;
+         }
+@@ -90,8 +90,6 @@
+         // Default { 0x10, 0x40, 0x70, 0x40, 0x10 } adds up to 0x110, simulating ink spread.
+         // SetLcdFilter must be called before SetLcdFilterWeights.
+         if (FT_Library_SetLcdFilter(fLibrary, FT_LCD_FILTER_DEFAULT) == 0) {
+-            fIsLCDSupported = true;
+-            fLCDExtra = 2; //Using a filter adds one full pixel to each side.
+ 
+ #ifdef SK_FONTHOST_FREETYPE_USE_NORMAL_LCD_FILTER
+             // Adds to 0x110 simulating ink spread, but provides better results than default.
+@@ -124,13 +122,9 @@
+     }
+ 
+     FT_Library library() { return fLibrary; }
+-    bool isLCDSupported() { return fIsLCDSupported; }
+-    int lcdExtra() { return fLCDExtra; }
+ 
+ private:
+     FT_Library fLibrary;
+-    bool fIsLCDSupported;
+-    int fLCDExtra;
+ 
+     // FT_Library_SetLcdFilterWeights was introduced in FreeType 2.4.0.
+     // The following platforms provide FreeType of at least 2.4.0.
+@@ -633,17 +627,6 @@
+         rec->fTextSize = SkIntToScalar(1 << 14);
+     }
+ 
+-    if (isLCD(*rec)) {
+-        // TODO: re-work so that FreeType is set-up and selected by the SkFontMgr.
+-        SkAutoMutexAcquire ama(gFTMutex);
+-        ref_ft_library();
+-        if (!gFTLibrary->isLCDSupported()) {
+-            // If the runtime Freetype library doesn't support LCD, disable it here.
+-            rec->fMaskFormat = SkMask::kA8_Format;
+-        }
+-        unref_ft_library();
+-    }
+-
+     SkPaint::Hinting h = rec->getHinting();
+     if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) {
+         // collapse full->normal hinting if we're not doing LCD
+@@ -1046,11 +1029,11 @@
+ void SkScalerContext_FreeType::updateGlyphIfLCD(SkGlyph* glyph) {
+     if (isLCD(fRec)) {
+         if (fLCDIsVert) {
+-            glyph->fHeight += gFTLibrary->lcdExtra();
+-            glyph->fTop -= gFTLibrary->lcdExtra() >> 1;
++            glyph->fHeight += 2;
++            glyph->fTop -= 1;
+         } else {
+-            glyph->fWidth += gFTLibrary->lcdExtra();
+-            glyph->fLeft -= gFTLibrary->lcdExtra() >> 1;
++            glyph->fWidth += 2;
++            glyph->fLeft -= 1;
+         }
+     }
+ }



More information about the arch-commits mailing list