Fix deprecation warnings

Switch to QImage::sizeInBytes for huge QImage support.

Change-Id: I0145f204dd2db6670e199c320fff9064b4a97ef4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2017-07-11 10:54:18 +02:00
parent ecac1aeb29
commit 9423be1f19
4 changed files with 8 additions and 8 deletions

View File

@ -471,7 +471,7 @@ inline void QImage::setNumColors(int n)
inline int QImage::numBytes() const
{
return byteCount();
return int(sizeInBytes());
}
#endif

View File

@ -130,7 +130,7 @@ CGImageRef QImage::toCGImage() const
auto deleter = [](void *image, const void *, size_t)
{ delete static_cast<QImage *>(image); };
QCFType<CGDataProviderRef> dataProvider =
CGDataProviderCreateWithData(new QImage(*this), bits(), byteCount(), deleter);
CGDataProviderCreateWithData(new QImage(*this), bits(), sizeInBytes(), deleter);
QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);

View File

@ -539,7 +539,7 @@ void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags f
Visual *visual = (Visual *)xinfo.visual();
XImage *xi = 0;
bool trucol = (visual->c_class >= TrueColor);
int nbytes = image.byteCount();
size_t nbytes = image.sizeInBytes();
uchar *newbits= 0;
#if QT_CONFIG(xrender)
@ -1125,7 +1125,7 @@ void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags f
}
p = newbits;
for (int i = 0; i < nbytes; i++) { // translate pixels
for (size_t i = 0; i < nbytes; i++) { // translate pixels
*p = pix[*p];
p++;
}

View File

@ -2541,8 +2541,8 @@ void tst_QImage::inplaceRgbSwapped()
QImage dataSwapped;
{
QVERIFY(!orig.isNull());
volatileData = new uchar[orig.byteCount()];
memcpy(volatileData, orig.constBits(), orig.byteCount());
volatileData = new uchar[orig.sizeInBytes()];
memcpy(volatileData, orig.constBits(), orig.sizeInBytes());
QImage dataImage;
if (rw)
@ -2653,8 +2653,8 @@ void tst_QImage::inplaceMirrored()
QImage dataSwapped;
{
QVERIFY(!orig.isNull());
volatileData = new uchar[orig.byteCount()];
memcpy(volatileData, orig.constBits(), orig.byteCount());
volatileData = new uchar[orig.sizeInBytes()];
memcpy(volatileData, orig.constBits(), orig.sizeInBytes());
QImage dataImage;
if (rw)