summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-04-06 16:34:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-11 10:46:19 +0200
commit7be255156feb7636a5cca5c4fe78f42879ffe69b (patch)
tree0255287041af5b79cb437e7d9003cd4c9a179dfc /src/gui
parent5dc506ad841685c8404c085bd8cf9c5442518897 (diff)
Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.
Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/image/qpnghandler.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp6
-rw-r--r--src/gui/text/qfontengine_qpa.cpp2
-rw-r--r--src/gui/text/qfontengine_qpf.cpp2
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp4
-rw-r--r--src/gui/text/qglyphrun.cpp4
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp2
9 files changed, 16 insertions, 14 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 91726f194b..180ab61ef9 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -51,6 +51,8 @@
#include <QtGui/qcolor.h>
#include <QtGui/qevent.h>
+#include <stdlib.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -216,7 +218,7 @@ public:
// quint64 alertHigh : 1;
State() {
- qMemSet(this, 0, sizeof(State));
+ memset(this, 0, sizeof(State));
}
};
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 7acad067b5..c3ae0a41da 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -184,7 +184,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz
if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
// Workaround for certain malformed PNGs that lack the final crc bytes
uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
- qMemCopy(data, endcrc, 4);
+ memcpy(data, endcrc, 4);
in->seek(in->size());
return;
}
@@ -664,7 +664,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt
return;
png_textp text_ptr = new png_text[text.size()];
- qMemSet(text_ptr, 0, text.size() * sizeof(png_text));
+ memset(text_ptr, 0, text.size() * sizeof(png_text));
QMap<QString, QString>::ConstIterator it = text.constBegin();
int i = 0;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 849955100b..97b0f91c26 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5594,9 +5594,9 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
QVarLengthArray<QFixed, 128> advances(glyphCount);
QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount);
QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount);
- qMemSet(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
- qMemSet(advances.data(), 0, advances.size() * sizeof(QFixed));
- qMemSet(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
+ memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
+ memset(advances.data(), 0, advances.size() * sizeof(QFixed));
+ memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
textItem.glyphs.numGlyphs = glyphCount;
textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray));
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index d12e2d651c..bf0cfd1404 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -612,7 +612,7 @@ void QPAGenerator::writeGMap()
const int numBytes = glyphCount * sizeof(quint32);
qint64 pos = buffer.size();
buffer.resize(pos + numBytes);
- qMemSet(buffer.data() + pos, 0xff, numBytes);
+ memset(buffer.data() + pos, 0xff, numBytes);
dev->seek(pos + numBytes);
}
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 64596ebaf5..23f263b0bd 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -1120,7 +1120,7 @@ void QPFGenerator::writeGMap()
const int numBytes = glyphCount * sizeof(quint32);
qint64 pos = buffer.size();
buffer.resize(pos + numBytes);
- qMemSet(buffer.data() + pos, 0xff, numBytes);
+ memset(buffer.data() + pos, 0xff, numBytes);
dev->seek(pos + numBytes);
}
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index 0f21ae8a1e..4843d7f12e 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -247,7 +247,7 @@ bool QFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *len
return false;
}
- qMemCopy(buffer, tableData, tableSize);
+ memcpy(buffer, tableData, tableSize);
m_directWriteFontFace->ReleaseFontTable(tableContext);
return true;
@@ -597,7 +597,7 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t,
int size = width * height * 3;
if (size > 0) {
BYTE *alphaValues = new BYTE[size];
- qMemSet(alphaValues, size, 0);
+ memset(alphaValues, size, 0);
hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
&rect,
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 813e0a804a..673dd8f03b 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -221,7 +221,7 @@ QVector<quint32> QGlyphRun::glyphIndexes() const
return d->glyphIndexes;
} else {
QVector<quint32> indexes(d->glyphIndexDataSize);
- qMemCopy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
+ memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
return indexes;
}
}
@@ -247,7 +247,7 @@ QVector<QPointF> QGlyphRun::positions() const
return d->glyphPositions;
} else {
QVector<QPointF> glyphPositions(d->glyphPositionDataSize);
- qMemCopy(glyphPositions.data(), d->glyphPositionData,
+ memcpy(glyphPositions.data(), d->glyphPositionData,
d->glyphPositionDataSize * sizeof(QPointF));
return glyphPositions;
}
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 5cdd563a33..3bd4d88872 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -504,7 +504,7 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph
int numGlyphs = glyphIndexes.size();
QVarLengthGlyphLayoutArray glyphs(numGlyphs);
- qMemCopy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
+ memcpy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
d->fontEngine->recalcAdvances(&glyphs, 0);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 7d366275a3..c5c6b2e621 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1000,7 +1000,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
kerningEnabled = this->font(si).d->kerning;
HB_ShaperItem entire_shaper_item;
- qMemSet(&entire_shaper_item, 0, sizeof(entire_shaper_item));
+ memset(&entire_shaper_item, 0, sizeof(entire_shaper_item));
entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData());
entire_shaper_item.stringLength = layoutData->string.length();
entire_shaper_item.item.script = (HB_Script)si.analysis.script;