diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index ecfe7ba35..c39307b43 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -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; diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 98ebfe40f..70230251a 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -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() diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 67c8a62fa..bd9827f65 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -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(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(id) << 56) + | (static_cast(ser_no) << 32) + | (static_cast(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