QQuickTextNode: Nuke some dead code.
This has been commented out since the initial introduction in 2011. I doubt it's actually useful anymore, and if it is, it's in git history regardless. Change-Id: Ife36f423a21d4b12ebca154b4ad14848844e4eef Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
parent
b83b358634
commit
9d58412049
|
@ -84,50 +84,6 @@ QQuickTextNode::~QQuickTextNode()
|
|||
qDeleteAll(m_textures);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void QQuickTextNode::setColor(const QColor &color)
|
||||
{
|
||||
if (m_usePixmapCache) {
|
||||
setUpdateFlag(UpdateNodes);
|
||||
} else {
|
||||
for (QSGNode *childNode = firstChild(); childNode; childNode = childNode->nextSibling()) {
|
||||
if (childNode->subType() == GlyphNodeSubType) {
|
||||
QSGGlyphNode *glyphNode = static_cast<QSGGlyphNode *>(childNode);
|
||||
if (glyphNode->color() == m_color)
|
||||
glyphNode->setColor(color);
|
||||
} else if (childNode->subType() == SolidRectNodeSubType) {
|
||||
QSGSimpleRectNode *solidRectNode = static_cast<QSGSimpleRectNode *>(childNode);
|
||||
if (solidRectNode->color() == m_color)
|
||||
solidRectNode->setColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
void QQuickTextNode::setStyleColor(const QColor &styleColor)
|
||||
{
|
||||
if (m_textStyle != QQuickTextNode::NormalTextStyle) {
|
||||
if (m_usePixmapCache) {
|
||||
setUpdateFlag(UpdateNodes);
|
||||
} else {
|
||||
for (QSGNode *childNode = firstChild(); childNode; childNode = childNode->nextSibling()) {
|
||||
if (childNode->subType() == GlyphNodeSubType) {
|
||||
QSGGlyphNode *glyphNode = static_cast<QSGGlyphNode *>(childNode);
|
||||
if (glyphNode->color() == m_styleColor)
|
||||
glyphNode->setColor(styleColor);
|
||||
} else if (childNode->subType() == SolidRectNodeSubType) {
|
||||
QSGSimpleRectNode *solidRectNode = static_cast<QSGSimpleRectNode *>(childNode);
|
||||
if (solidRectNode->color() == m_styleColor)
|
||||
solidRectNode->setColor(styleColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_styleColor = styleColor;
|
||||
}
|
||||
#endif
|
||||
|
||||
QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
|
||||
QQuickText::TextStyle style, const QColor &styleColor,
|
||||
QSGNode *parentNode)
|
||||
|
@ -312,78 +268,4 @@ void QQuickTextNode::deleteContent()
|
|||
m_textures.clear();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void QQuickTextNode::updateNodes()
|
||||
{
|
||||
return;
|
||||
deleteContent();
|
||||
if (m_text.isEmpty())
|
||||
return;
|
||||
|
||||
if (m_usePixmapCache) {
|
||||
// ### gunnar: port properly
|
||||
// QPixmap pixmap = generatedPixmap();
|
||||
// if (pixmap.isNull())
|
||||
// return;
|
||||
|
||||
// QSGImageNode *pixmapNode = m_context->createImageNode();
|
||||
// pixmapNode->setRect(pixmap.rect());
|
||||
// pixmapNode->setSourceRect(pixmap.rect());
|
||||
// pixmapNode->setOpacity(m_opacity);
|
||||
// pixmapNode->setClampToEdge(true);
|
||||
// pixmapNode->setLinearFiltering(m_linearFiltering);
|
||||
|
||||
// appendChildNode(pixmapNode);
|
||||
} else {
|
||||
if (m_text.isEmpty())
|
||||
return;
|
||||
|
||||
// Implement styling by drawing text several times at slight shifts. shiftForStyle
|
||||
// contains the sequence of shifted positions at which to draw the text. All except
|
||||
// the last will be drawn with styleColor.
|
||||
QList<QPointF> shiftForStyle;
|
||||
switch (m_textStyle) {
|
||||
case OutlineTextStyle:
|
||||
// ### Should be made faster by implementing outline material
|
||||
shiftForStyle << QPointF(-1, 0);
|
||||
shiftForStyle << QPointF(0, -1);
|
||||
shiftForStyle << QPointF(1, 0);
|
||||
shiftForStyle << QPointF(0, 1);
|
||||
break;
|
||||
case SunkenTextStyle:
|
||||
shiftForStyle << QPointF(0, -1);
|
||||
break;
|
||||
case RaisedTextStyle:
|
||||
shiftForStyle << QPointF(0, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
shiftForStyle << QPointF(0, 0); // Regular position
|
||||
while (!shiftForStyle.isEmpty()) {
|
||||
QPointF shift = shiftForStyle.takeFirst();
|
||||
|
||||
// Use styleColor for all but last shift
|
||||
if (m_richText) {
|
||||
QColor overrideColor = shiftForStyle.isEmpty() ? QColor() : m_styleColor;
|
||||
|
||||
QTextFrame *textFrame = m_textDocument->rootFrame();
|
||||
QPointF p = m_textDocument->documentLayout()->frameBoundingRect(textFrame).topLeft();
|
||||
|
||||
QTextFrame::iterator it = textFrame->begin();
|
||||
while (!it.atEnd()) {
|
||||
addTextBlock(shift + p, it.currentBlock(), overrideColor);
|
||||
++it;
|
||||
}
|
||||
} else {
|
||||
addTextLayout(shift, m_textLayout, shiftForStyle.isEmpty()
|
||||
? m_color
|
||||
: m_styleColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
Loading…
Reference in New Issue