mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 11:22:58 +00:00
QPixmapData cleanup
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
31ba0c3283
commit
f3cea47976
3 changed files with 11 additions and 19 deletions
|
@ -418,7 +418,7 @@ void QX11PixmapData::fromImage(const QImage &img,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uint(w) >= 32768 || uint(h) >= 32768) {
|
if (w >= 32768 || h >= 32768) {
|
||||||
w = h = 0;
|
w = h = 0;
|
||||||
is_null = true;
|
is_null = true;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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),
|
: w(0),
|
||||||
h(0),
|
h(0),
|
||||||
d(0),
|
d(0),
|
||||||
|
@ -247,11 +247,7 @@ void QPixmapData::setSerialNumber(int serNo)
|
||||||
|
|
||||||
QImage QPixmapData::toImage(const QRect &rect) const
|
QImage QPixmapData::toImage(const QRect &rect) const
|
||||||
{
|
{
|
||||||
QImage image = toImage();
|
return toImage().copy(rect);
|
||||||
if (rect.isNull())
|
|
||||||
return image;
|
|
||||||
|
|
||||||
return image.copy(rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage* QPixmapData::buffer()
|
QImage* QPixmapData::buffer()
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
};
|
};
|
||||||
enum ClassId { RasterClass, X11Class };
|
enum ClassId { RasterClass, X11Class };
|
||||||
|
|
||||||
QPixmapData(PixelType pixelType, int classId);
|
QPixmapData(PixelType pixelType, ClassId classId);
|
||||||
virtual ~QPixmapData();
|
virtual ~QPixmapData();
|
||||||
|
|
||||||
virtual QPixmapData *createCompatiblePixmapData() const;
|
virtual QPixmapData *createCompatiblePixmapData() const;
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
inline int serialNumber() const { return ser_no; }
|
inline int serialNumber() const { return ser_no; }
|
||||||
|
|
||||||
inline PixelType pixelType() const { return type; }
|
inline PixelType pixelType() const { return type; }
|
||||||
inline ClassId classId() const { return static_cast<ClassId>(id); }
|
inline ClassId classId() const { return id; }
|
||||||
|
|
||||||
virtual QImage* buffer();
|
virtual QImage* buffer();
|
||||||
|
|
||||||
|
@ -108,19 +108,15 @@ public:
|
||||||
inline int depth() const { return d; }
|
inline int depth() const { return d; }
|
||||||
inline bool isNull() const { return is_null; }
|
inline bool isNull() const { return is_null; }
|
||||||
inline qint64 cacheKey() const {
|
inline qint64 cacheKey() const {
|
||||||
int classKey = id;
|
return ((static_cast<qint64>(id) << 56)
|
||||||
if (classKey >= 1024)
|
| (static_cast<qint64>(ser_no) << 32)
|
||||||
classKey = -(classKey >> 10);
|
| (static_cast<qint64>(detach_no)));
|
||||||
return ((((qint64) classKey) << 56)
|
|
||||||
| (((qint64) ser_no) << 32)
|
|
||||||
| ((qint64) detach_no));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static QPixmapData *create(int w, int h, PixelType type);
|
static QPixmapData *create(int w, int h, PixelType type);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void setSerialNumber(int serNo);
|
void setSerialNumber(int serNo);
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
@ -136,7 +132,7 @@ private:
|
||||||
int detach_no;
|
int detach_no;
|
||||||
|
|
||||||
PixelType type;
|
PixelType type;
|
||||||
int id;
|
ClassId id;
|
||||||
int ser_no;
|
int ser_no;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue