OSDN Git Service

QPainterPrivate cleanup
authorIvailo Monev <xakepa10@laimg.moc>
Sun, 30 Jun 2019 15:16:00 +0000 (15:16 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sun, 30 Jun 2019 15:16:00 +0000 (15:16 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/painting/qpainter.cpp
src/gui/painting/qpainter_p.h

index 0cba3a0..7c8ad4a 100644 (file)
@@ -1449,7 +1449,7 @@ bool QPainter::begin(QPaintDevice *pd)
 
     d->device = pd;
 
-    d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine) : 0;
+    d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine) : Q_NULLPTR;
 
     // Setup new state...
     Q_ASSERT(!d->state);
@@ -1629,7 +1629,7 @@ bool QPainter::end()
     }
 
     if (d->extended) {
-        d->extended = 0;
+        d->extended = Q_NULLPTR;
     }
 
     qt_cleanup_painter_state(d);
@@ -5119,7 +5119,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
 
     // If we don't have an extended paint engine, or if the painter is projected,
     // we go through standard code path
-    if (d->extended == 0 || !d->state->matrix.isAffine()) {
+    if (d->extended == Q_NULLPTR || !d->state->matrix.isAffine()) {
         staticText_d->paintText(topLeftPosition, this);
         return;
     }
@@ -6198,8 +6198,6 @@ void QPainter::fillRect(const QRect &r, const QBrush &brush)
     setPen(oldPen);
 }
 
-
-
 /*!
     \fn void QPainter::fillRect(const QRect &rectangle, const QColor &color)
     \overload
@@ -7870,11 +7868,6 @@ QPainter::PixmapFragment QPainter::PixmapFragment::create(const QPointF &pos, co
     \sa QPainter::drawPixmapFragments(), QPainter::PixmapFragment
 */
 
-void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation)
-{
-    p->draw_helper(path, operation);
-}
-
 /*! \fn Display *QPaintDevice::x11Display() const
     Use QX11Info::display() instead.
 
index 23c94e8..00db297 100644 (file)
@@ -152,8 +152,10 @@ class QPainterPrivate
     Q_DECLARE_PUBLIC(QPainter)
 public:
     QPainterPrivate(QPainter *painter)
-    : q_ptr(painter), d_ptrs(0), state(0), dummyState(0), txinv(0), inDestructor(false), d_ptrs_size(0),
-        refcount(1), device(0), original_device(0), helper_device(0), engine(0), extended(0)
+    : q_ptr(painter), d_ptrs(Q_NULLPTR), state(Q_NULLPTR), dummyState(Q_NULLPTR), txinv(false),
+        inDestructor(false), d_ptrs_size(0), refcount(1), device(Q_NULLPTR),
+        original_device(Q_NULLPTR), helper_device(Q_NULLPTR), engine(Q_NULLPTR),
+        extended(Q_NULLPTR)
     {
     }
 
@@ -168,14 +170,15 @@ public:
     mutable QPainterDummyState *dummyState;
 
     QTransform invMatrix;
-    uint txinv:1;
-    uint inDestructor : 1;
-    uint d_ptrs_size;
+    bool txinv;
+    bool inDestructor;
+    int d_ptrs_size;
     uint refcount;
 
-    enum DrawOperation { StrokeDraw        = 0x1,
-                         FillDraw          = 0x2,
-                         StrokeAndFillDraw = 0x3
+    enum DrawOperation {
+        StrokeDraw        = 0x1,
+        FillDraw          = 0x2,
+        StrokeAndFillDraw = 0x3
     };
 
     QPainterDummyState *fakeState() const {
@@ -215,8 +218,6 @@ public:
     QBrush colorBrush;          // for fill with solid color
 };
 
-Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation);
-
 QString qt_generate_brush_key(const QBrush &brush);
 
 QT_END_NAMESPACE