QPixmapData cleanup

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-06-19 21:58:54 +00:00
parent 31ba0c3283
commit f3cea47976
3 changed files with 11 additions and 19 deletions

View file

@ -418,7 +418,7 @@ void QX11PixmapData::fromImage(const QImage &img,
return;
}
if (uint(w) >= 32768 || uint(h) >= 32768) {
if (w >= 32768 || h >= 32768) {
w = h = 0;
is_null = true;
return;

View file

@ -62,7 +62,7 @@ QPixmapData *QPixmapData::create(int w, int h, PixelType type)
}
QPixmapData::QPixmapData(PixelType pixelType, int objectId)
QPixmapData::QPixmapData(PixelType pixelType, ClassId objectId)
: w(0),
h(0),
d(0),
@ -247,11 +247,7 @@ void QPixmapData::setSerialNumber(int serNo)
QImage QPixmapData::toImage(const QRect &rect) const
{
QImage image = toImage();
if (rect.isNull())
return image;
return image.copy(rect);
return toImage().copy(rect);
}
QImage* QPixmapData::buffer()

View file

@ -63,7 +63,7 @@ public:
};
enum ClassId { RasterClass, X11Class };
QPixmapData(PixelType pixelType, int classId);
QPixmapData(PixelType pixelType, ClassId classId);
virtual ~QPixmapData();
virtual QPixmapData *createCompatiblePixmapData() const;
@ -98,7 +98,7 @@ public:
inline int serialNumber() const { return ser_no; }
inline PixelType pixelType() const { return type; }
inline ClassId classId() const { return static_cast<ClassId>(id); }
inline ClassId classId() const { return id; }
virtual QImage* buffer();
@ -108,19 +108,15 @@ public:
inline int depth() const { return d; }
inline bool isNull() const { return is_null; }
inline qint64 cacheKey() const {
int classKey = id;
if (classKey >= 1024)
classKey = -(classKey >> 10);
return ((((qint64) classKey) << 56)
| (((qint64) ser_no) << 32)
| ((qint64) detach_no));
return ((static_cast<qint64>(id) << 56)
| (static_cast<qint64>(ser_no) << 32)
| (static_cast<qint64>(detach_no)));
}
static QPixmapData *create(int w, int h, PixelType type);
protected:
void setSerialNumber(int serNo);
int w;
int h;
@ -136,12 +132,12 @@ private:
int detach_no;
PixelType type;
int id;
ClassId id;
int ser_no;
};
# define QT_XFORM_TYPE_MSBFIRST 0
# define QT_XFORM_TYPE_LSBFIRST 1
#define QT_XFORM_TYPE_MSBFIRST 0
#define QT_XFORM_TYPE_LSBFIRST 1
extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int);
QT_END_NAMESPACE