From e71b9fb4658991bd509c784b98410af221583dd5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 1 Jun 2020 22:54:10 +0200 Subject: QPainterPrivate: use NSDMI, outline ctor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a drive-by, make the ctor explicit. Change-Id: I4c0c597e4b6e96e800017c90acced33bbccd1d10 Reviewed-by: MÃ¥rten Nordheim --- src/gui/painting/qpainter.cpp | 6 ++++++ src/gui/painting/qpainter_p.h | 27 +++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index eb51e9cc24..6a0d431a50 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -218,6 +218,12 @@ void QPainterPrivate::checkEmulation() } +QPainterPrivate::QPainterPrivate(QPainter *painter) + : q_ptr(painter), txinv(0), inDestructor(false) +{ + +} + QPainterPrivate::~QPainterPrivate() { delete emulationEngine; diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index c9caca7901..c369922756 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -194,17 +194,11 @@ class QPainterPrivate { Q_DECLARE_PUBLIC(QPainter) public: - QPainterPrivate(QPainter *painter) - : q_ptr(painter), d_ptrs(nullptr), state(nullptr), dummyState(nullptr), txinv(0), inDestructor(false), d_ptrs_size(0), - refcount(1), device(nullptr), original_device(nullptr), helper_device(nullptr), engine(nullptr), emulationEngine(nullptr), - extended(nullptr) - { - } - + explicit QPainterPrivate(QPainter *painter); ~QPainterPrivate(); QPainter *q_ptr; - QPainterPrivate **d_ptrs; + QPainterPrivate **d_ptrs = nullptr; std::unique_ptr state; template @@ -218,8 +212,8 @@ public: QTransform invMatrix; uint txinv:1; uint inDestructor : 1; - uint d_ptrs_size; - uint refcount; + uint d_ptrs_size = 0; + uint refcount = 1; enum DrawOperation { StrokeDraw = 0x1, FillDraw = 0x2, @@ -265,9 +259,10 @@ public: void detachPainterPrivate(QPainter *q); void initFrom(const QPaintDevice *device); - QPaintDevice *device; - QPaintDevice *original_device; - QPaintDevice *helper_device; + QPaintDevice *device = nullptr; + QPaintDevice *original_device = nullptr; + QPaintDevice *helper_device = nullptr; + struct QPaintEngineDestructor { void operator()(QPaintEngine *pe) const noexcept { @@ -275,10 +270,10 @@ public: delete pe; } }; - std::unique_ptr engine; - QEmulationPaintEngine *emulationEngine; - QPaintEngineEx *extended; + + QEmulationPaintEngine *emulationEngine = nullptr; + QPaintEngineEx *extended = nullptr; QBrush colorBrush; // for fill with solid color }; -- cgit v1.2.3