diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-05 15:07:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-05 15:07:36 (GMT) |
commit | c6ac9fe2e8d219bb9694efaf5b25ec5108fb8fa6 (patch) | |
tree | 917da74f21248a79c2479d5cbe3ba869ea00ff96 /src | |
parent | 8d5c19f024c55fca61c9cb343180e9db9d79929a (diff) | |
parent | 647b3395e41827c232fa9203ee0590da2b6d257a (diff) | |
download | Qt-c6ac9fe2e8d219bb9694efaf5b25ec5108fb8fa6.zip Qt-c6ac9fe2e8d219bb9694efaf5b25ec5108fb8fa6.tar.gz Qt-c6ac9fe2e8d219bb9694efaf5b25ec5108fb8fa6.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix for torn off menus that were way too big
Compile fix for Windows Mobile and OpenGLES2
Fixed failure to store certain image formats as jpeg
Fixa few warnings on mingw
Added QImage::bitPlaneCount().
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/phonon/ds9/backendnode.cpp | 2 | ||||
-rw-r--r-- | src/gui/egl/qegl_wince.cpp | 3 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 55 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 9 | ||||
-rw-r--r-- | src/plugins/imageformats/jpeg/qjpeghandler.cpp | 20 |
6 files changed, 77 insertions, 13 deletions
diff --git a/src/3rdparty/phonon/ds9/backendnode.cpp b/src/3rdparty/phonon/ds9/backendnode.cpp index 3afcafa..737ab7b 100644 --- a/src/3rdparty/phonon/ds9/backendnode.cpp +++ b/src/3rdparty/phonon/ds9/backendnode.cpp @@ -67,7 +67,7 @@ namespace Phonon if (info.pGraph) { HRESULT hr = info.pGraph->RemoveFilter(filter); - if (hr == VFW_E_NOT_STOPPED && m_mediaObject) { + if (FAILED(hr) && m_mediaObject) { m_mediaObject->ensureStopped(); hr = info.pGraph->RemoveFilter(filter); diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index c07b20b..2d08805 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -53,8 +53,7 @@ QT_BEGIN_NAMESPACE EGLNativeDisplayType QEgl::nativeDisplay() { - HWND win = (static_cast<QWidget*>(device))->winId(); - HDC myDc = GetDC(win); + HDC myDc = GetDC(0); if (!myDc) { qWarning("QEglContext::nativeDisplay(): WinCE display is not open"); return EGL_DEFAULT_DISPLAY; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6bcf72b..94307de 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -480,9 +480,12 @@ bool QImageData::checkForAlphaPixels() const \row \o Low-level information \o + The depth() function returns the depth of the image. The supported - depths are 1 (monochrome), 8 and 32 (for more information see the - \l {QImage#Image Formats}{Image Formats} section). + depths are 1 (monochrome), 8, 16, 24 and 32 bits. The + bitPlaneCount() function tells how many of those bits that are + used. For more information see the + \l {QImage#Image Formats}{Image Formats} section. The format(), bytesPerLine(), and byteCount() functions provide low-level information about the data stored in the image. @@ -707,7 +710,7 @@ bool QImageData::checkForAlphaPixels() const packed with the less significant bit (LSB) first. \value Format_Indexed8 The image is stored using 8-bit indexes - into a colormap. + into a colormap. \value Format_RGB32 The image is stored using a 32-bit RGB format (0xffRRGGBB). @@ -1580,12 +1583,12 @@ QRect QImage::rect() const /*! Returns the depth of the image. - The image depth is the number of bits used to encode a single + The image depth is the number of bits used to store a single pixel, also called bits per pixel (bpp). The supported depths are 1, 8, 16, 24 and 32. - \sa convertToFormat(), {QImage#Image Formats}{Image Formats}, + \sa bitPlaneCount(), convertToFormat(), {QImage#Image Formats}{Image Formats}, {QImage#Image Information}{Image Information} */ @@ -5848,6 +5851,48 @@ bool QImage::hasAlphaChannel() const } +/*! + \since 4.7 + Returns the number of bit planes in the image. + + The number of bit planes is the number of bits of color and + transparency information for each pixel. This is different from + (i.e. smaller than) the depth when the image format contains + unused bits. + + \sa depth(), format(), {QImage#Image Formats}{Image Formats} +*/ +int QImage::bitPlaneCount() const +{ + if (!d) + return 0; + int bpc = 0; + switch (d->format) { + case QImage::Format_Invalid: + break; + case QImage::Format_RGB32: + bpc = 24; + break; + case QImage::Format_RGB666: + bpc = 18; + break; + case QImage::Format_RGB555: + bpc = 15; + break; + case QImage::Format_ARGB8555_Premultiplied: + bpc = 23; + break; + case QImage::Format_RGB444: + bpc = 12; + break; + default: + bpc = depthForFormat(d->format); + break; + } + return bpc; +} + + #ifdef QT3_SUPPORT #if defined(Q_WS_X11) QT_BEGIN_INCLUDE_NAMESPACE diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index dd13782..896061f 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -169,6 +169,7 @@ public: QT_DEPRECATED int numColors() const; #endif int colorCount() const; + int bitPlaneCount() const; QRgb color(int i) const; void setColor(int i, QRgb c); diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 9a4916e..ebc05d9 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -260,9 +260,6 @@ void QMenuPrivate::updateActionRects() const icone = style->pixelMetric(QStyle::PM_SmallIconSize, &opt, q); const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, q); const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q); - - const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width(); - const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin)); const int tearoffHeight = tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0; //for compatability now - will have to refactor this away.. @@ -336,7 +333,7 @@ void QMenuPrivate::updateActionRects() const if (!sz.isEmpty()) { - max_column_width = qMax(min_column_width, qMax(max_column_width, sz.width())); + max_column_width = qMax(max_column_width, sz.width()); //wrapping if (!scroll && y+sz.height()+vmargin > dh - (deskFw * 2)) { @@ -350,6 +347,10 @@ void QMenuPrivate::updateActionRects() const } max_column_width += tabWidth; //finally add in the tab width + const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width(); + const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin)); + max_column_width = qMax(min_column_width, max_column_width); + //calculate position const int base_y = vmargin + fw + topmargin + diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 3555b21..6eed824 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -562,11 +562,29 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device) free_in_buffer = max_buf; } +static bool can_write_format(QImage::Format fmt) +{ + switch (fmt) { + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + case QImage::Format_Indexed8: + case QImage::Format_RGB888: + case QImage::Format_RGB32: + case QImage::Format_ARGB32: + case QImage::Format_ARGB32_Premultiplied: + return true; + break; + default: + break; + } + return false; +} static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality) { bool success = false; - const QImage image = sourceImage; + const QImage image = can_write_format(sourceImage.format()) ? + sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888); const QVector<QRgb> cmap = image.colorTable(); struct jpeg_compress_struct cinfo; |