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());
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;
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;
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);
}
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;
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;
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: