OSDN Git Service

QPaintEngineEx cleanup
authorIvailo Monev <xakepa10@laimg.moc>
Mon, 24 Jun 2019 14:04:48 +0000 (14:04 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Mon, 24 Jun 2019 14:04:48 +0000 (14:04 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/image/qpixmapfilter.cpp
src/gui/painting/qpaintengine_raster.cpp
src/gui/painting/qpaintengineex_p.h

index 5ea88aa..b051a06 100644 (file)
@@ -424,18 +424,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
     if (src.isNull())
         return;
 
-    QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
-        static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
-    QPixmapConvolutionFilter *convolutionFilter = static_cast<QPixmapConvolutionFilter*>(filter);
-    if (convolutionFilter) {
-        convolutionFilter->setConvolutionKernel(d->convolutionKernel, d->kernelWidth, d->kernelHeight);
-        convolutionFilter->d_func()->convoluteAlpha = d->convoluteAlpha;
-        convolutionFilter->draw(painter, p, src, srcRect);
-        return;
-    }
-
-    // falling back to raster implementation
-
+    // raster implementation
     QImage *target = 0;
     if (painter->paintEngine()->paintDevice()->devType() == QInternal::Image) {
         target = static_cast<QImage *>(painter->paintEngine()->paintDevice());
@@ -931,16 +920,6 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
     if (qt_scaleForTransform(painter->transform(), &scale))
         scaledRadius /= scale;
 
-    QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
-        static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
-    QPixmapBlurFilter *blurFilter = static_cast<QPixmapBlurFilter*>(filter);
-    if (blurFilter) {
-        blurFilter->setRadius(scaledRadius);
-        blurFilter->setBlurHints(d->hints);
-        blurFilter->draw(painter, p, src, srcRect);
-        return;
-    }
-
     QImage srcImage;
     QImage destImage;
 
@@ -1100,18 +1079,7 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q
     if (src.isNull())
         return;
 
-    QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
-        static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
-    QPixmapColorizeFilter *colorizeFilter = static_cast<QPixmapColorizeFilter*>(filter);
-    if (colorizeFilter) {
-        colorizeFilter->setColor(d->color);
-        colorizeFilter->setStrength(d->strength);
-        colorizeFilter->draw(painter, dest, src, srcRect);
-        return;
-    }
-
-    // falling back to raster implementation
-
+    // raster implementation
     if (!d->opaque) {
         painter->drawPixmap(dest, src, srcRect);
         return;
@@ -1334,17 +1302,6 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
     if (px.isNull())
         return;
 
-    QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ?
-        static_cast<QPaintEngineEx *>(p->paintEngine())->pixmapFilter(type(), this) : 0;
-    QPixmapDropShadowFilter *dropShadowFilter = static_cast<QPixmapDropShadowFilter*>(filter);
-    if (dropShadowFilter) {
-        dropShadowFilter->setColor(d->color);
-        dropShadowFilter->setBlurRadius(d->radius);
-        dropShadowFilter->setOffset(d->offset);
-        dropShadowFilter->draw(p, pos, px, src);
-        return;
-    }
-
     QImage tmp(px.size(), QImage::Format_ARGB32_Premultiplied);
     tmp.fill(0);
     QPainter tmpPainter(&tmp);
index 1d28b1c..ff34afa 100644 (file)
@@ -3003,7 +3003,7 @@ QRasterBuffer::~QRasterBuffer()
 }
 
 QRasterBuffer::QRasterBuffer()
-    : m_width(0), m_height(0), m_buffer(0)
+    : m_width(0), m_height(0), m_buffer(Q_NULLPTR)
 {
     compositionMode = QPainter::CompositionMode_SourceOver;
     monoDestinationWithClut = false;
@@ -3013,7 +3013,7 @@ QRasterBuffer::QRasterBuffer()
 
 QImage::Format QRasterBuffer::prepare(QImage *image)
 {
-    m_buffer = (uchar *)image->bits();
+    m_buffer = image->bits();
     m_width = qMin(RASTER_COORD_LIMIT, image->width());
     m_height = qMin(RASTER_COORD_LIMIT, image->height());
     bytes_per_pixel = image->depth()/8;
index 7abf14c..370a43a 100644 (file)
@@ -190,13 +190,6 @@ public:
     virtual void beginNativePainting() {}
     virtual void endNativePainting() {}
 
-    // Return a pixmap filter of "type" that can render the parameters
-    // in "prototype".  The returned filter is owned by the engine and
-    // will be destroyed when the engine is destroyed.  The "prototype"
-    // allows the engine to pick different filters based on the parameters
-    // that will be requested, and not just the "type".
-    virtual QPixmapFilter *pixmapFilter(int /*type*/, const QPixmapFilter * /*prototype*/) { return 0; }
-
     virtual bool supportsTransformations(const qreal pixelSize, const QTransform &m) const;
 
 protected: