summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qwindowsurface_rasterblittable.cpp
blob: 56a79bafc8ae0d60fcf207e2721ea83d9981acc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "qwindowsurface_rasterblittable_p.h"

#include <private/qpaintengine_blitter_p.h>
#include <private/qpixmap_blitter_p.h>

QRasterBlittableWindowSurface::QRasterBlittableWindowSurface(QWidget *widget)
    : QRasterWindowSurface(widget),
        m_currentImage(0),
        m_blittable(0),
        m_pmData(new QBlittablePixmapData(QPixmapData::PixmapType)),
        m_pixmap(new QPixmap(m_pmData))
{
}

QPaintDevice *QRasterBlittableWindowSurface::paintDevice()
{
    QPaintDevice *device = QRasterWindowSurface::paintDevice();
    if (m_currentImage != device) {
        if (device->devType() == QInternal::Image) {
            m_currentImage = static_cast<QImage *>(device);
            m_blittable = createBlittable(m_currentImage);
            m_pmData->setBlittable(m_blittable);
        }
    }
    return m_pixmap;
}