tpopela / rpms / chromium

Forked from rpms/chromium 6 years ago
Clone

Blame chromium-70.0.3538.77-harfbuzz2-fix.patch

3558506
From 7ae38170a117e909bb28e1470842b68de3501197 Mon Sep 17 00:00:00 2001
3558506
From: Mike Gilbert <floppymaster@gmail.com>
3558506
Date: Sun, 21 Oct 2018 10:06:53 -0400
3558506
Subject: [PATCH] blink: add 'const' modifier for harfbuzz hb_codepoint_t
3558506
 pointers
3558506
3558506
This resolves a build failure against harfbuzz 2.0.
3558506
3558506
Based on a patch by Alexandre Fierreira.
3558506
3558506
Bug: https://bugs.gentoo.org/669034
3558506
---
3558506
 .../renderer/platform/fonts/shaping/harfbuzz_face.cc     | 2 +-
3558506
 .../renderer/platform/fonts/skia/skia_text_metrics.cc    | 9 +++++++--
3558506
 .../renderer/platform/fonts/skia/skia_text_metrics.h     | 2 +-
3558506
 3 files changed, 9 insertions(+), 4 deletions(-)
3558506
3558506
diff --git a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
3558506
index 8e7d91ca371f..e279a5876cb3 100644
3558506
--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
3558506
+++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
3558506
@@ -139,7 +139,7 @@ static hb_position_t HarfBuzzGetGlyphHorizontalAdvance(hb_font_t* hb_font,
3558506
 static void HarfBuzzGetGlyphHorizontalAdvances(hb_font_t* font,
3558506
                                                void* font_data,
3558506
                                                unsigned count,
3558506
-                                               hb_codepoint_t* first_glyph,
3558506
+                                               const hb_codepoint_t* first_glyph,
3558506
                                                unsigned int glyph_stride,
3558506
                                                hb_position_t* first_advance,
3558506
                                                unsigned int advance_stride,
3558506
diff --git a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.cc b/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.cc
3558506
index 77ec6209fab9..9f9070921448 100644
3558506
--- a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.cc
3558506
+++ b/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.cc
3558506
@@ -18,6 +18,11 @@ T* advance_by_byte_size(T* p, unsigned byte_size) {
3558506
   return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(p) + byte_size);
3558506
 }
3558506
 
3558506
+template <class T>
3558506
+T* advance_by_byte_size_const(T* p, unsigned byte_size) {
3558506
+  return reinterpret_cast<T*>(reinterpret_cast<const uint8_t*>(p) + byte_size);
3558506
+}
3558506
+
3558506
 }  // namespace
3558506
 
3558506
 SkiaTextMetrics::SkiaTextMetrics(const SkPaint* paint) : paint_(paint) {
3558506
@@ -39,7 +44,7 @@ void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(hb_codepoint_t codepoint,
3558506
 }
3558506
 
3558506
 void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count,
3558506
-                                               hb_codepoint_t* glyphs,
3558506
+                                               const hb_codepoint_t* glyphs,
3558506
                                                unsigned glyph_stride,
3558506
                                                hb_position_t* advances,
3558506
                                                unsigned advance_stride) {
3558506
@@ -48,7 +53,7 @@ void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count,
3558506
   // array that copy them to a regular array.
3558506
   Vector<Glyph, 256> glyph_array(count);
3558506
   for (unsigned i = 0; i < count;
3558506
-       i++, glyphs = advance_by_byte_size(glyphs, glyph_stride)) {
3558506
+       i++, glyphs = advance_by_byte_size_const(glyphs, glyph_stride)) {
3558506
     glyph_array[i] = *glyphs;
3558506
   }
3558506
   Vector<SkScalar, 256> sk_width_array(count);
3558506
diff --git a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h b/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h
3558506
index 787d8af0375a..3bc4407c641b 100644
3558506
--- a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h
3558506
+++ b/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h
3558506
@@ -19,7 +19,7 @@ class SkiaTextMetrics final {
3558506
 
3558506
   void GetGlyphWidthForHarfBuzz(hb_codepoint_t, hb_position_t* width);
3558506
   void GetGlyphWidthForHarfBuzz(unsigned count,
3558506
-                                hb_codepoint_t* first_glyph,
3558506
+                                const hb_codepoint_t* first_glyph,
3558506
                                 unsigned glyph_stride,
3558506
                                 hb_position_t* first_advance,
3558506
                                 unsigned advance_stride);
3558506
-- 
3558506
2.19.1
3558506