OSDN Git Service

remove redundant QGlyphLayout::advances_y member
authorIvailo Monev <xakepa10@gmail.com>
Mon, 17 Jan 2022 19:02:31 +0000 (21:02 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 17 Jan 2022 19:02:31 +0000 (21:02 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/painting/qpainterpath.cpp
src/gui/text/qfontengine.cpp
src/gui/text/qfontengine_ft.cpp
src/gui/text/qtextengine.cpp
src/gui/text/qtextengine_p.h

index 7e3736d..44c5f77 100644 (file)
@@ -1096,7 +1096,6 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
     static const bool scriptdetection = true;
     if (scriptdetection) {
         qreal xoffset = 0.0;
-        qreal yoffset = 0.0;
         QUnicodeTables::Script inheritedscript = QUnicodeTables::Common;
         for (int i = 0; i < text.size(); i++) {
             int nglyphs = 1;
@@ -1138,13 +1137,11 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
 
             QGlyphLayoutArray<2> glyphs;
             engine->stringToCMap(textchars, nglyphs, &glyphs, &nglyphs, shaperflags);
-            engine->addOutlineToPath(point.x() + xoffset, point.y() + yoffset, glyphs, this);
+            engine->addOutlineToPath(point.x() + xoffset, point.y(), glyphs, this);
 
             xoffset += glyphs.advances_x[0].toReal();
-            yoffset += glyphs.advances_y[0].toReal();
             if (nglyphs == 2) {
                 xoffset += glyphs.advances_x[1].toReal();
-                yoffset += glyphs.advances_y[1].toReal();
             }
             Q_ASSERT(nglyphs < 3);
         }
index d8d0a06..3cc09a6 100644 (file)
@@ -114,7 +114,6 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
                 positions[current].y = ypos + glyphs.offsets[i].y;
                 glyphs_out[current] = glyphs.glyphs[i];
                 xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
-                ypos += glyphs.advances_y[i];
                 ++current;
             }
             ++i;
@@ -130,7 +129,6 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
                 positions[current].y = QFixed::fromReal(gpos.y());
                 glyphs_out[current] = glyphs.glyphs[i];
                 xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
-                ypos += glyphs.advances_y[i];
                 ++current;
             }
             ++i;
@@ -351,7 +349,6 @@ bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs,
     for (int i = 0; i < len; i++) {
         glyphs->glyphs[i] = 0;
         glyphs->advances_x[i] = _size;
-        glyphs->advances_y[i] = 0;
     }
 
     *nglyphs = len;
@@ -363,7 +360,6 @@ void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
 {
     for (int i = 0; i < glyphs->numGlyphs; i++) {
         glyphs->advances_x[i] = _size;
-        glyphs->advances_y[i] = 0;
     }
 }
 
@@ -433,10 +429,8 @@ void QFontEngineBox::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, in
         g.glyphs[i] = glyphs[i];
         if (i < nGlyphs - 1) {
             g.advances_x[i] = positions[i+1].x - positions[i].x;
-            g.advances_y[i] = positions[i+1].y - positions[i].y;
         } else {
             g.advances_x[i] = QFixed::fromReal(maxCharWidth());
-            g.advances_y[i] = 0;
         }
     }
 
@@ -446,7 +440,6 @@ void QFontEngineBox::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, in
         glyph_metrics_t metrics = boundingBox(g.glyphs[i]);
         if (metrics.width.value() == 0 || metrics.height.value() == 0) {
             advanceX += g.advances_x[i];
-            advanceY += g.advances_y[i];
             continue;
         }
 
@@ -459,7 +452,6 @@ void QFontEngineBox::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, in
         path->closeSubpath();
 
         advanceX += g.advances_x[i];
-        advanceY += g.advances_y[i];
     }
 }
 
index ffbe033..9b7e206 100644 (file)
@@ -634,7 +634,6 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlag
                                        : QFixed::fromFixed(metric->horiadvance);
         if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
             glyphs->advances_x[i] = glyphs->advances_x[i].round();
-        glyphs->advances_y[i] = 0;
     }
 }
 
index 218c4ef..a4a7622 100644 (file)
@@ -773,7 +773,6 @@ void QGlyphLayout::grow(char *address, int totalGlyphs)
         // move the existing data
         memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(HB_GlyphAttributes));
         memmove(newLayout.justifications, oldLayout.justifications, numGlyphs * sizeof(QGlyphJustification));
-        memmove(newLayout.advances_y, oldLayout.advances_y, numGlyphs * sizeof(QFixed));
         memmove(newLayout.advances_x, oldLayout.advances_x, numGlyphs * sizeof(QFixed));
         memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(HB_Glyph));
     }
index bb5eb09..6fde7a7 100644 (file)
@@ -115,7 +115,6 @@ struct QGlyphLayout
     QFixedPoint *offsets; // 8 bytes per element
     HB_Glyph *glyphs; // 4 bytes per element
     QFixed *advances_x; // 4 bytes per element
-    QFixed *advances_y; // 4 bytes per element
     QGlyphJustification *justifications; // 4 bytes per element
     HB_GlyphAttributes *attributes; // 2 bytes per element
 
@@ -131,8 +130,6 @@ struct QGlyphLayout
         offset += totalGlyphs * sizeof(HB_Glyph);
         advances_x = reinterpret_cast<QFixed *>(address + offset);
         offset += totalGlyphs * sizeof(QFixed);
-        advances_y = reinterpret_cast<QFixed *>(address + offset);
-        offset += totalGlyphs * sizeof(QFixed);
         justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
         offset += totalGlyphs * sizeof(QGlyphJustification);
         attributes = reinterpret_cast<HB_GlyphAttributes *>(address + offset);
@@ -143,7 +140,6 @@ struct QGlyphLayout
         QGlyphLayout copy = *this;
         copy.glyphs += position;
         copy.advances_x += position;
-        copy.advances_y += position;
         copy.offsets += position;
         copy.justifications += position;
         copy.attributes += position;
@@ -156,7 +152,7 @@ struct QGlyphLayout
 
     static inline int spaceNeededForGlyphLayout(int totalGlyphs) {
         return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
-                + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
+                + sizeof(QFixed) + sizeof(QFixedPoint)
                 + sizeof(QGlyphJustification));
     }
 
@@ -174,7 +170,6 @@ struct QGlyphLayout
             memset(offsets + first, 0, num * sizeof(QFixedPoint));
             memset(glyphs + first, 0, num * sizeof(HB_Glyph));
             memset(advances_x + first, 0, num * sizeof(QFixed));
-            memset(advances_y + first, 0, num * sizeof(QFixed));
             memset(justifications + first, 0, num * sizeof(QGlyphJustification));
             memset(attributes + first, 0, num * sizeof(HB_GlyphAttributes));
         }
@@ -219,7 +214,7 @@ public:
 
 private:
     void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
-                + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
+                + sizeof(QFixed) + sizeof(QFixedPoint)
                 + sizeof(QGlyphJustification)))
                     / QT_POINTER_SIZE + 1];
 };