mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
remove redundant QGlyphLayout::advances_y member
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
28a0fa4522
commit
31ff2625cd
5 changed files with 3 additions and 21 deletions
|
@ -1096,7 +1096,6 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
|
||||||
static const bool scriptdetection = true;
|
static const bool scriptdetection = true;
|
||||||
if (scriptdetection) {
|
if (scriptdetection) {
|
||||||
qreal xoffset = 0.0;
|
qreal xoffset = 0.0;
|
||||||
qreal yoffset = 0.0;
|
|
||||||
QUnicodeTables::Script inheritedscript = QUnicodeTables::Common;
|
QUnicodeTables::Script inheritedscript = QUnicodeTables::Common;
|
||||||
for (int i = 0; i < text.size(); i++) {
|
for (int i = 0; i < text.size(); i++) {
|
||||||
int nglyphs = 1;
|
int nglyphs = 1;
|
||||||
|
@ -1138,13 +1137,11 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
|
||||||
|
|
||||||
QGlyphLayoutArray<2> glyphs;
|
QGlyphLayoutArray<2> glyphs;
|
||||||
engine->stringToCMap(textchars, nglyphs, &glyphs, &nglyphs, shaperflags);
|
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();
|
xoffset += glyphs.advances_x[0].toReal();
|
||||||
yoffset += glyphs.advances_y[0].toReal();
|
|
||||||
if (nglyphs == 2) {
|
if (nglyphs == 2) {
|
||||||
xoffset += glyphs.advances_x[1].toReal();
|
xoffset += glyphs.advances_x[1].toReal();
|
||||||
yoffset += glyphs.advances_y[1].toReal();
|
|
||||||
}
|
}
|
||||||
Q_ASSERT(nglyphs < 3);
|
Q_ASSERT(nglyphs < 3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,6 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
|
||||||
positions[current].y = ypos + glyphs.offsets[i].y;
|
positions[current].y = ypos + glyphs.offsets[i].y;
|
||||||
glyphs_out[current] = glyphs.glyphs[i];
|
glyphs_out[current] = glyphs.glyphs[i];
|
||||||
xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
|
xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
|
||||||
ypos += glyphs.advances_y[i];
|
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
|
@ -130,7 +129,6 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
|
||||||
positions[current].y = QFixed::fromReal(gpos.y());
|
positions[current].y = QFixed::fromReal(gpos.y());
|
||||||
glyphs_out[current] = glyphs.glyphs[i];
|
glyphs_out[current] = glyphs.glyphs[i];
|
||||||
xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
|
xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
|
||||||
ypos += glyphs.advances_y[i];
|
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
|
@ -351,7 +349,6 @@ bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs,
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
glyphs->glyphs[i] = 0;
|
glyphs->glyphs[i] = 0;
|
||||||
glyphs->advances_x[i] = _size;
|
glyphs->advances_x[i] = _size;
|
||||||
glyphs->advances_y[i] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*nglyphs = len;
|
*nglyphs = len;
|
||||||
|
@ -363,7 +360,6 @@ void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
|
||||||
{
|
{
|
||||||
for (int i = 0; i < glyphs->numGlyphs; i++) {
|
for (int i = 0; i < glyphs->numGlyphs; i++) {
|
||||||
glyphs->advances_x[i] = _size;
|
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];
|
g.glyphs[i] = glyphs[i];
|
||||||
if (i < nGlyphs - 1) {
|
if (i < nGlyphs - 1) {
|
||||||
g.advances_x[i] = positions[i+1].x - positions[i].x;
|
g.advances_x[i] = positions[i+1].x - positions[i].x;
|
||||||
g.advances_y[i] = positions[i+1].y - positions[i].y;
|
|
||||||
} else {
|
} else {
|
||||||
g.advances_x[i] = QFixed::fromReal(maxCharWidth());
|
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]);
|
glyph_metrics_t metrics = boundingBox(g.glyphs[i]);
|
||||||
if (metrics.width.value() == 0 || metrics.height.value() == 0) {
|
if (metrics.width.value() == 0 || metrics.height.value() == 0) {
|
||||||
advanceX += g.advances_x[i];
|
advanceX += g.advances_x[i];
|
||||||
advanceY += g.advances_y[i];
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +452,6 @@ void QFontEngineBox::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, in
|
||||||
path->closeSubpath();
|
path->closeSubpath();
|
||||||
|
|
||||||
advanceX += g.advances_x[i];
|
advanceX += g.advances_x[i];
|
||||||
advanceY += g.advances_y[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -634,7 +634,6 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlag
|
||||||
: QFixed::fromFixed(metric->horiadvance);
|
: QFixed::fromFixed(metric->horiadvance);
|
||||||
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
|
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
|
||||||
glyphs->advances_x[i] = glyphs->advances_x[i].round();
|
glyphs->advances_x[i] = glyphs->advances_x[i].round();
|
||||||
glyphs->advances_y[i] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -773,7 +773,6 @@ void QGlyphLayout::grow(char *address, int totalGlyphs)
|
||||||
// move the existing data
|
// move the existing data
|
||||||
memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(HB_GlyphAttributes));
|
memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(HB_GlyphAttributes));
|
||||||
memmove(newLayout.justifications, oldLayout.justifications, numGlyphs * sizeof(QGlyphJustification));
|
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.advances_x, oldLayout.advances_x, numGlyphs * sizeof(QFixed));
|
||||||
memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(HB_Glyph));
|
memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(HB_Glyph));
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,6 @@ struct QGlyphLayout
|
||||||
QFixedPoint *offsets; // 8 bytes per element
|
QFixedPoint *offsets; // 8 bytes per element
|
||||||
HB_Glyph *glyphs; // 4 bytes per element
|
HB_Glyph *glyphs; // 4 bytes per element
|
||||||
QFixed *advances_x; // 4 bytes per element
|
QFixed *advances_x; // 4 bytes per element
|
||||||
QFixed *advances_y; // 4 bytes per element
|
|
||||||
QGlyphJustification *justifications; // 4 bytes per element
|
QGlyphJustification *justifications; // 4 bytes per element
|
||||||
HB_GlyphAttributes *attributes; // 2 bytes per element
|
HB_GlyphAttributes *attributes; // 2 bytes per element
|
||||||
|
|
||||||
|
@ -131,8 +130,6 @@ struct QGlyphLayout
|
||||||
offset += totalGlyphs * sizeof(HB_Glyph);
|
offset += totalGlyphs * sizeof(HB_Glyph);
|
||||||
advances_x = reinterpret_cast<QFixed *>(address + offset);
|
advances_x = reinterpret_cast<QFixed *>(address + offset);
|
||||||
offset += totalGlyphs * sizeof(QFixed);
|
offset += totalGlyphs * sizeof(QFixed);
|
||||||
advances_y = reinterpret_cast<QFixed *>(address + offset);
|
|
||||||
offset += totalGlyphs * sizeof(QFixed);
|
|
||||||
justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
|
justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
|
||||||
offset += totalGlyphs * sizeof(QGlyphJustification);
|
offset += totalGlyphs * sizeof(QGlyphJustification);
|
||||||
attributes = reinterpret_cast<HB_GlyphAttributes *>(address + offset);
|
attributes = reinterpret_cast<HB_GlyphAttributes *>(address + offset);
|
||||||
|
@ -143,7 +140,6 @@ struct QGlyphLayout
|
||||||
QGlyphLayout copy = *this;
|
QGlyphLayout copy = *this;
|
||||||
copy.glyphs += position;
|
copy.glyphs += position;
|
||||||
copy.advances_x += position;
|
copy.advances_x += position;
|
||||||
copy.advances_y += position;
|
|
||||||
copy.offsets += position;
|
copy.offsets += position;
|
||||||
copy.justifications += position;
|
copy.justifications += position;
|
||||||
copy.attributes += position;
|
copy.attributes += position;
|
||||||
|
@ -156,7 +152,7 @@ struct QGlyphLayout
|
||||||
|
|
||||||
static inline int spaceNeededForGlyphLayout(int totalGlyphs) {
|
static inline int spaceNeededForGlyphLayout(int totalGlyphs) {
|
||||||
return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
|
return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
|
||||||
+ sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
|
+ sizeof(QFixed) + sizeof(QFixedPoint)
|
||||||
+ sizeof(QGlyphJustification));
|
+ sizeof(QGlyphJustification));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +170,6 @@ struct QGlyphLayout
|
||||||
memset(offsets + first, 0, num * sizeof(QFixedPoint));
|
memset(offsets + first, 0, num * sizeof(QFixedPoint));
|
||||||
memset(glyphs + first, 0, num * sizeof(HB_Glyph));
|
memset(glyphs + first, 0, num * sizeof(HB_Glyph));
|
||||||
memset(advances_x + first, 0, num * sizeof(QFixed));
|
memset(advances_x + first, 0, num * sizeof(QFixed));
|
||||||
memset(advances_y + first, 0, num * sizeof(QFixed));
|
|
||||||
memset(justifications + first, 0, num * sizeof(QGlyphJustification));
|
memset(justifications + first, 0, num * sizeof(QGlyphJustification));
|
||||||
memset(attributes + first, 0, num * sizeof(HB_GlyphAttributes));
|
memset(attributes + first, 0, num * sizeof(HB_GlyphAttributes));
|
||||||
}
|
}
|
||||||
|
@ -219,7 +214,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
|
void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
|
||||||
+ sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
|
+ sizeof(QFixed) + sizeof(QFixedPoint)
|
||||||
+ sizeof(QGlyphJustification)))
|
+ sizeof(QGlyphJustification)))
|
||||||
/ QT_POINTER_SIZE + 1];
|
/ QT_POINTER_SIZE + 1];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue