From 4f88475a962975ca45994cff9add350344fce4f9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 11 Nov 2016 13:05:13 +0100 Subject: Allow QImage with more than 2GByte of image data Changes internal data-size and pointer calculations to qssize_t. Adds new sizeInBytes() accessor to read byte size, and marks the old one deprecated. Task-number: QTBUG-50912 Change-Id: Idf0c2010542b0ec1c9abef8afd02d6db07f43e6d Reviewed-by: Thiago Macieira --- src/plugins/imageformats/gif/qgifhandler.cpp | 4 ++-- .../eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp | 2 +- src/plugins/platforms/xcb/qxcbimage.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index bae74bf9a1..e0f7f44701 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -354,7 +354,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, (*image) = QImage(swidth, sheight, format); bpl = image->bytesPerLine(); bits = image->bits(); - memset(bits, 0, image->byteCount()); + memset(bits, 0, image->sizeInBytes()); } // Check if the previous attempt to create the image failed. If it @@ -415,7 +415,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, backingstore = QImage(qMax(backingstore.width(), w), qMax(backingstore.height(), h), QImage::Format_RGB32); - memset(backingstore.bits(), 0, backingstore.byteCount()); + memset(backingstore.bits(), 0, backingstore.sizeInBytes()); } const int dest_bpl = backingstore.bytesPerLine(); unsigned char *dest_data = backingstore.bits(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp index 5b779d6732..a3868fdb1d 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp @@ -204,7 +204,7 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window) painter.drawImage(0, 0, *m_cursorImage.image()); painter.end(); - gbm_bo_write(m_bo, cursorImage.constBits(), cursorImage.byteCount()); + gbm_bo_write(m_bo, cursorImage.constBits(), cursorImage.sizeInBytes()); uint32_t handle = gbm_bo_get_handle(m_bo).u32; diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp index f3dfa1916b..8635a03dcb 100644 --- a/src/plugins/platforms/xcb/qxcbimage.cpp +++ b/src/plugins/platforms/xcb/qxcbimage.cpp @@ -225,7 +225,7 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, xcb_image_destroy(xi); return XCB_NONE; } - memcpy(xi->data, img.constBits(), img.byteCount()); + memcpy(xi->data, img.constBits(), img.sizeInBytes()); xcb_pixmap_t pix = xcb_generate_id(conn); xcb_create_pixmap(conn, 32, pix, screen->root(), w, h); -- cgit v1.2.3