Platform support/Windows classes: Use member initialization

Use C++ 11 member initialization in value-type structs.

Task-number: QTBUG-51673
Change-Id: Ic45ab21c738ec7b7d526e30a1de2e19206da89ed
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Friedemann Kleint 2016-11-24 15:48:57 +01:00
parent 5ea88ae239
commit fa4fb4ccf7
6 changed files with 22 additions and 41 deletions

View File

@ -591,12 +591,7 @@ namespace {
*/
QWindowsFontEngineData::QWindowsFontEngineData()
: clearTypeEnabled(false)
, fontSmoothingGamma(QWindowsFontDatabase::fontSmoothingGamma())
#if !defined(QT_NO_DIRECTWRITE)
, directWriteFactory(0)
, directWriteGdiInterop(0)
#endif
: fontSmoothingGamma(QWindowsFontDatabase::fontSmoothingGamma())
{
// from qapplication_win.cpp
UINT result = 0;

View File

@ -74,12 +74,12 @@ public:
uint pow_gamma[256];
bool clearTypeEnabled;
bool clearTypeEnabled = false;
qreal fontSmoothingGamma;
HDC hdc;
HDC hdc = 0;
#if !defined(QT_NO_DIRECTWRITE)
IDWriteFactory *directWriteFactory;
IDWriteGdiInterop *directWriteGdiInterop;
IDWriteFactory *directWriteFactory = nullptr;
IDWriteGdiInterop *directWriteGdiInterop = nullptr;
#endif
};

View File

@ -248,21 +248,9 @@ QWindowsFontEngine::QWindowsFontEngine(const QString &name,
: QFontEngine(Win),
m_fontEngineData(fontEngineData),
_name(name),
hfont(0),
m_logfont(lf),
ttf(0),
hasOutline(0),
cmap(0),
cmapSize(0),
lbearing(SHRT_MIN),
rbearing(SHRT_MIN),
x_height(-1),
synthesized_flags(-1),
lineWidth(-1),
widthCache(0),
widthCacheSize(0),
designAdvances(0),
designAdvancesSize(0)
hasOutline(0)
{
qCDebug(lcQpaFonts) << __FUNCTION__ << name << lf.lfHeight;
hfont = CreateFontIndirect(&m_logfont);

View File

@ -145,29 +145,29 @@ private:
const QString _name;
QString uniqueFamilyName;
HFONT hfont;
HFONT hfont = 0;
const LOGFONT m_logfont;
uint ttf : 1;
uint hasOutline : 1;
uint hasUnreliableOutline : 1;
uint cffTable : 1;
TEXTMETRIC tm;
const unsigned char *cmap;
int cmapSize;
const unsigned char *cmap = nullptr;
int cmapSize = 0;
QByteArray cmapTable;
mutable qreal lbearing;
mutable qreal rbearing;
mutable qreal lbearing = SHRT_MIN;
mutable qreal rbearing = SHRT_MIN;
QFixed designToDevice;
int unitsPerEm;
QFixed x_height;
int unitsPerEm = 0;
QFixed x_height = -1;
FaceId _faceId;
mutable int synthesized_flags;
mutable QFixed lineWidth;
mutable unsigned char *widthCache;
mutable uint widthCacheSize;
mutable QFixed *designAdvances;
mutable int designAdvancesSize;
mutable int synthesized_flags = -1;
mutable QFixed lineWidth = -1;
mutable unsigned char *widthCache = nullptr;
mutable uint widthCacheSize = 0;
mutable QFixed *designAdvances = nullptr;
mutable int designAdvancesSize = 0;
};
class QWindowsMultiFontEngine : public QFontEngineMulti

View File

@ -110,9 +110,7 @@ static inline HBITMAP createDIB(HDC hdc, int width, int height,
QWindowsNativeImage::QWindowsNativeImage(int width, int height,
QImage::Format format) :
m_hdc(createDC()),
m_bitmap(0),
m_null_bitmap(0)
m_hdc(createDC())
{
if (width != 0 && height != 0) {
uchar *bits;

View File

@ -80,8 +80,8 @@ private:
const HDC m_hdc;
QImage m_image;
HBITMAP m_bitmap;
HBITMAP m_null_bitmap;
HBITMAP m_bitmap = 0;
HBITMAP m_null_bitmap = 0;
};
QT_END_NAMESPACE