summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_blitter_p.h
blob: 5e93ef4e3af95068d67794b575a02dfb4680fca5 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef QPIXMAP_BLITTER_P_H
#define QPIXMAP_BLITTER_P_H

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

class QImageBlitter : public QBlittable
{
public:
    QImageBlitter(const QImage &img)
        : QBlittable(img.rect(),0), image(img)
    {
    }

    void fillRect(const QRectF &, const QColor &)
    {
        //should never be called
    }
    void drawPixmap(const QRectF &, const QPixmap &, const QRectF &)
    {
        //should never be called
    }

    QImage *lock()
    {
        return &image;
    }

    void unlock()
    {
    }

private:
    QImage image;
};

class QBlittablePixmapData : public QPixmapData
{
public:
    QBlittablePixmapData(PixelType type);
    ~QBlittablePixmapData();

    QBlittable *blittable() const { return m_blittable; }

    void resize(int width, int height);
    int metric(QPaintDevice::PaintDeviceMetric metric) const;
    void fill(const QColor &color);
    QImage *buffer();
    QImage toImage();
    bool hasAlphaChannel();
    void fromImage(const QImage &image, Qt::ImageConversionFlags flags);

    QPaintEngine *paintEngine() const;

protected:
    QBlitterPaintEngine *m_engine;
    QBlittable *m_blittable;
};

#endif // QPIXMAP_BLITTER_P_H