From 8511ed8bc29cabc6ef337c152cd0f2fb30d817a1 Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Sun, 22 Jan 2012 16:35:52 +0100 Subject: Remove Symbian specific code from QtGui. Change-Id: I103abb545d1a5deed7d40c0b50fc3eff0c89d622 Reviewed-by: Lars Knoll --- src/gui/image/image.pri | 7 +- src/gui/image/qpixmap.cpp | 9 +- src/gui/image/qvolatileimagedata_symbian.cpp | 474 --------------------------- src/gui/kernel/qevent.cpp | 4 +- src/gui/text/qfont.cpp | 2 +- src/gui/text/qfontdatabase.cpp | 8 - src/gui/text/qrawfont.cpp | 2 +- src/gui/text/text.pri | 20 -- src/plugins/imageformats/gif/gif.pro | 2 - src/plugins/imageformats/ico/ico.pro | 2 - src/plugins/imageformats/mng/mng.pro | 6 - src/plugins/imageformats/tiff/tiff.pro | 2 - 12 files changed, 5 insertions(+), 533 deletions(-) delete mode 100644 src/gui/image/qvolatileimagedata_symbian.cpp (limited to 'src') diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index b8eb546ba5..54ae01faa1 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -48,12 +48,7 @@ SOURCES += \ SOURCES += image/qpixmap_qpa.cpp win32: SOURCES += image/qpixmap_win.cpp -!symbian|contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2) { - SOURCES += image/qvolatileimagedata.cpp -} -else { - SOURCES += image/qvolatileimagedata_symbian.cpp -} +SOURCES += image/qvolatileimagedata.cpp # Built-in image format support HEADERS += \ diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 9c08296baa..b4f1b15b37 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1253,8 +1253,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) screen. Alternatively, if no manipulation is desired, the image file can be loaded directly into a QPixmap. On Windows, the QPixmap class also supports conversion between \c HBITMAP and - QPixmap. On Symbian, the QPixmap class also supports conversion - between CFbsBitmap and QPixmap. + QPixmap. QPixmap provides a collection of functions that can be used to obtain a variety of information about the pixmap. In addition, @@ -1362,12 +1361,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) to the QPixmap, and returns the HICON handle. The fromWinHICON() function returns a QPixmap that is equivalent to the given icon. - In addition, on Symbian, the QPixmap class supports conversion to - and from CFbsBitmap: the toSymbianCFbsBitmap() function creates - CFbsBitmap equivalent to the QPixmap, based on given mode and returns - a CFbsBitmap object. The fromSymbianCFbsBitmap() function returns a - QPixmap that is equivalent to the given bitmap and given mode. - \section1 Pixmap Transformations QPixmap supports a number of functions for creating a new pixmap diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp deleted file mode 100644 index 41dd4bd55d..0000000000 --- a/src/gui/image/qvolatileimagedata_symbian.cpp +++ /dev/null @@ -1,474 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qvolatileimagedata_p.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static CFbsBitmap *rasterizeBitmap(CFbsBitmap *bitmap, TDisplayMode newMode) -{ - if (!bitmap) { - return 0; - } - QScopedPointer newBitmap(new CFbsBitmap); - if (newBitmap->Create(bitmap->SizeInPixels(), newMode) != KErrNone) { - qWarning("QVolatileImage: Failed to create new bitmap"); - return 0; - } - CFbsBitmapDevice *bitmapDevice = 0; - CFbsBitGc *bitmapGc = 0; - QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(newBitmap.data())); - QScopedPointer bitmapDevicePtr(bitmapDevice); - QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); - bitmapGc->Activate(bitmapDevice); - bitmapGc->BitBlt(TPoint(), bitmap); - delete bitmapGc; - return newBitmap.take(); -} - -static inline TDisplayMode format2TDisplayMode(QImage::Format format) -{ - TDisplayMode mode; - switch (format) { - case QImage::Format_MonoLSB: - mode = EGray2; - break; - case QImage::Format_Indexed8: - mode = EColor256; - break; - case QImage::Format_RGB444: - mode = EColor4K; - break; - case QImage::Format_RGB16: - mode = EColor64K; - break; - case QImage::Format_RGB888: - mode = EColor16M; - break; - case QImage::Format_RGB32: - mode = EColor16MU; - break; - case QImage::Format_ARGB32: - mode = EColor16MA; - break; - case QImage::Format_ARGB32_Premultiplied: - mode = Q_SYMBIAN_ECOLOR16MAP; - break; - default: - mode = ENone; - break; - } - return mode; -} - -static CFbsBitmap *imageToBitmap(const QImage &image) -{ - if (image.isNull()) { - return 0; - } - CFbsBitmap *bitmap = new CFbsBitmap; - if (bitmap->Create(TSize(image.width(), image.height()), - format2TDisplayMode(image.format())) == KErrNone) { - bitmap->BeginDataAccess(); - uchar *dptr = reinterpret_cast(bitmap->DataAddress()); - int bmpLineLen = bitmap->DataStride(); - int imgLineLen = image.bytesPerLine(); - if (bmpLineLen == imgLineLen) { - qMemCopy(dptr, image.constBits(), image.byteCount()); - } else { - int len = qMin(bmpLineLen, imgLineLen); - const uchar *sptr = image.constBits(); - for (int y = 0; y < image.height(); ++y) { - qMemCopy(dptr, sptr, len); - dptr += bmpLineLen; - sptr += imgLineLen; - } - } - bitmap->EndDataAccess(); - } else { - qWarning("QVolatileImage: Failed to create source bitmap"); - delete bitmap; - bitmap = 0; - } - return bitmap; -} - -static CFbsBitmap *copyData(const QVolatileImageData &source) -{ - source.beginDataAccess(); - CFbsBitmap *bmp = imageToBitmap(source.image); - source.endDataAccess(); - return bmp; -} - -static CFbsBitmap *convertData(const QVolatileImageData &source, QImage::Format newFormat) -{ - source.beginDataAccess(); - QImage img = source.image.convertToFormat(newFormat); - CFbsBitmap *bmp = imageToBitmap(img); - source.endDataAccess(); - return bmp; -} - -static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap) -{ - CFbsBitmap *bitmap = new CFbsBitmap; - if (bitmap->Duplicate(sourceBitmap.Handle()) != KErrNone) { - qWarning("QVolatileImage: Failed to duplicate source bitmap"); - delete bitmap; - bitmap = 0; - } - return bitmap; -} - -static CFbsBitmap *createBitmap(int w, int h, QImage::Format format) -{ - CFbsBitmap *bitmap = new CFbsBitmap; - if (bitmap->Create(TSize(w, h), format2TDisplayMode(format)) != KErrNone) { - qWarning("QVolatileImage: Failed to create source bitmap %d,%d (%d)", w, h, format); - delete bitmap; - bitmap = 0; - } - return bitmap; -} - -static inline bool bitmapNeedsCopy(CFbsBitmap *bitmap) -{ - bool needsCopy = bitmap->IsCompressedInRAM(); -#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE - needsCopy |= (bitmap->ExtendedBitmapType() != KNullUid); -#endif - return needsCopy; -} - -static bool cleanup_function_registered = false; -static QVolatileImageData *firstImageData = 0; - -static void cleanup() -{ - if (RFbsSession::GetSession()) { - QVolatileImageData *imageData = firstImageData; - while (imageData) { - imageData->release(); - imageData = imageData->next; - } - } -} - -static void ensureCleanup() -{ - // Destroy all underlying bitmaps in a post routine to prevent panics. - // This is a must because CFbsBitmap destructor needs the fbs session, - // that was used to create the bitmap, to be open still. - if (!cleanup_function_registered) { - qAddPostRoutine(cleanup); - cleanup_function_registered = true; - } -} - -static void registerImageData(QVolatileImageData *imageData) -{ - ensureCleanup(); - imageData->next = firstImageData; - if (firstImageData) { - firstImageData->prev = imageData; - } - firstImageData = imageData; -} - -static void unregisterImageData(QVolatileImageData *imageData) -{ - if (imageData->prev) { - imageData->prev->next = imageData->next; - } else { - firstImageData = imageData->next; - } - if (imageData->next) { - imageData->next->prev = imageData->prev; - } -} - -QVolatileImageData::QVolatileImageData() - : next(0), prev(0), bitmap(0), pengine(0) -{ - registerImageData(this); -} - -QVolatileImageData::QVolatileImageData(int w, int h, QImage::Format format) - : next(0), prev(0), bitmap(0), pengine(0) -{ - registerImageData(this); - bitmap = createBitmap(w, h, format); - updateImage(); -} - -QVolatileImageData::QVolatileImageData(const QImage &sourceImage) - : next(0), prev(0), bitmap(0), pengine(0) -{ - registerImageData(this); - image = sourceImage; - // The following is not mandatory, but we do it here to have a bitmap - // created always in order to reduce local heap usage. - ensureBitmap(); -} - -QVolatileImageData::QVolatileImageData(void *nativeImage, void *nativeMask) - : next(0), prev(0), bitmap(0), pengine(0) -{ - registerImageData(this); - if (nativeImage) { - CFbsBitmap *source = static_cast(nativeImage); - CFbsBitmap *mask = static_cast(nativeMask); - initWithBitmap(source); - if (mask) { - applyMask(mask); - } - } -} - -QVolatileImageData::QVolatileImageData(const QVolatileImageData &other) -{ - bitmap = 0; - pengine = 0; - next = prev = 0; - registerImageData(this); - if (!other.image.isNull()) { - bitmap = copyData(other); - updateImage(); - } -} - -QVolatileImageData::~QVolatileImageData() -{ - release(); - unregisterImageData(this); -} - -void QVolatileImageData::release() -{ - delete bitmap; - bitmap = 0; - delete pengine; - pengine = 0; -} - -void QVolatileImageData::beginDataAccess() const -{ - if (bitmap) { - bitmap->BeginDataAccess(); - } -} - -void QVolatileImageData::endDataAccess(bool readOnly) const -{ - if (bitmap) { - bitmap->EndDataAccess(readOnly); - } -} - -bool QVolatileImageData::ensureFormat(QImage::Format format) -{ - if (image.isNull()) { - return false; - } - if (image.format() != format) { - CFbsBitmap *newBitmap = convertData(*this, format); - if (newBitmap && newBitmap != bitmap) { - delete bitmap; - bitmap = newBitmap; - updateImage(); - } else { - return false; - } - } - return true; -} - -void *QVolatileImageData::duplicateNativeImage() const -{ - const_cast(this)->ensureBitmap(); - if (bitmap) { - if (bitmap->DisplayMode() == EColor16M) { - // slow path: needs rgb swapping - beginDataAccess(); - QImage tmp = image.rgbSwapped(); - endDataAccess(true); - return imageToBitmap(tmp); - } else if (bitmap->DisplayMode() == EGray2) { - // slow path: needs inverting pixels - beginDataAccess(); - QImage tmp = image.copy(); - endDataAccess(true); - tmp.invertPixels(); - return imageToBitmap(tmp); - } else { - // fast path: just duplicate the bitmap - return duplicateBitmap(*bitmap); - } - } - return 0; -} - -void QVolatileImageData::updateImage() -{ - if (bitmap) { - TSize size = bitmap->SizeInPixels(); - beginDataAccess(); - // Use existing buffer, no copy. The data address never changes so it - // is enough to do this whenever we have a new CFbsBitmap. N.B. never - // use const uchar* here, that would create a read-only image data which - // would make a copy in detach() even when refcount is 1. - image = QImage(reinterpret_cast(bitmap->DataAddress()), - size.iWidth, size.iHeight, bitmap->DataStride(), - qt_TDisplayMode2Format(bitmap->DisplayMode())); - endDataAccess(true); - } else { - image = QImage(); - } -} - -void QVolatileImageData::initWithBitmap(CFbsBitmap *source) -{ - bool needsCopy = bitmapNeedsCopy(source); - if (source->DisplayMode() == EColor16M) { - // EColor16M is BGR - CFbsBitmap *unswappedBmp = source; - if (needsCopy) { - unswappedBmp = rasterizeBitmap(source, source->DisplayMode()); - } - unswappedBmp->BeginDataAccess(); - TSize sourceSize = unswappedBmp->SizeInPixels(); - QImage img((uchar *) unswappedBmp->DataAddress(), - sourceSize.iWidth, sourceSize.iHeight, unswappedBmp->DataStride(), - qt_TDisplayMode2Format(unswappedBmp->DisplayMode())); - img = img.rgbSwapped(); - unswappedBmp->EndDataAccess(true); - bitmap = imageToBitmap(img); - if (needsCopy) { - delete unswappedBmp; - } - } else if (needsCopy) { - // Rasterize extended and compressed bitmaps. - bitmap = rasterizeBitmap(source, EColor16MAP); - } else if (source->DisplayMode() == EGray2) { - // The pixels will be inverted, must make a copy. - bitmap = rasterizeBitmap(source, source->DisplayMode()); - } else { - // Efficient path: no pixel data copying. Just duplicate. This of course - // means the original bitmap's data may get modified, but that's fine - // and is in accordance with the QPixmap::fromSymbianCFbsBitmap() docs. - bitmap = duplicateBitmap(*source); - } - updateImage(); - if (bitmap && bitmap->DisplayMode() == EGray2) { - // Symbian thinks set pixels are white/transparent, Qt thinks they are - // foreground/solid. Invert mono bitmaps so that masks work correctly. - beginDataAccess(); - image.invertPixels(); - endDataAccess(); - } -} - -void QVolatileImageData::applyMask(CFbsBitmap *mask) -{ - ensureFormat(QImage::Format_ARGB32_Premultiplied); - bool destroyMask = false; - if (bitmapNeedsCopy(mask)) { - mask = rasterizeBitmap(mask, EColor16MU); - if (!mask) { - return; - } - destroyMask = true; - } - mask->BeginDataAccess(); - TSize maskSize = mask->SizeInPixels(); - QImage maskImg((const uchar *) mask->DataAddress(), maskSize.iWidth, maskSize.iHeight, - mask->DataStride(), qt_TDisplayMode2Format(mask->DisplayMode())); - if (mask->DisplayMode() == EGray2) { - maskImg = maskImg.copy(); - maskImg.invertPixels(); - } - beginDataAccess(); - image.setAlphaChannel(maskImg); - endDataAccess(); - mask->EndDataAccess(true); - ensureImage(); - if (destroyMask) { - delete mask; - } -} - -void QVolatileImageData::ensureImage() -{ - if (bitmap && !image.isNull()) { - QImageData *imaged = image.data_ptr(); - if (imaged->ref != 1 || imaged->ro_data) { - // This is bad, the imagedata got shared somehow. Detach, in order to - // have the next check fail and thus have 'image' recreated. - beginDataAccess(); - image.detach(); - endDataAccess(true); - } - } - if (bitmap && image.constBits() != reinterpret_cast(bitmap->DataAddress())) { - // Should not ever get here. If we do it means that either 'image' has - // been replaced with a copy (e.g. because some QImage API assigned a - // new, regular QImage to *this) or the bitmap's data address changed - // unexpectedly. - qWarning("QVolatileImageData: Ptr mismatch"); - // Recover by recreating the image so that it uses the bitmap as its buffer. - updateImage(); - } -} - -void QVolatileImageData::ensureBitmap() -{ - if (!bitmap && !image.isNull()) { - bitmap = imageToBitmap(image); - updateImage(); - } -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8f94805054..74dc388114 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2743,7 +2743,7 @@ QShowEvent::~QShowEvent() This event is only used to notify the application of a request. It may be safely ignored. - \note This class is currently supported for Mac OS X and Symbian only. + \note This class is currently supported for Mac OS X only. */ QFileOpenEventPrivate::~QFileOpenEventPrivate() @@ -2807,8 +2807,6 @@ QUrl QFileOpenEvent::url() const This is necessary as some files cannot be opened by name, but require specific information stored in this event. - For example, if this QFileOpenEvent contains a request to open a Symbian data caged file, - the QFile could only be opened from the Symbian RFile used in the construction of this event. \since 4.8 */ diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index b747739ad0..eec6e6a86e 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -692,7 +692,7 @@ QFont::QFont() If \a pointSize is zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is - 12 points, except on Symbian where it is 7 points. + 12 points. The \a family name may optionally also include a foundry name, e.g. "Helvetica [Cronyx]". If the \a family is diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7927f5a941..2ef6c00078 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -556,10 +556,6 @@ public: HANDLE handle; bool memoryFont; QVector signatures; -#elif defined(Q_OS_SYMBIAN) - QString temporaryFileName; - TInt screenDeviceFontFileId; - TUid fontStoreFontFileUid; #endif QStringList families; }; @@ -2197,8 +2193,6 @@ bool QFontDatabasePrivate::isApplicationFont(const QString &fileName) \note Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported. - \note On Symbian, the font family names get truncated to a length of 20 characters. - \sa addApplicationFontFromData(), applicationFontFamilies(), removeApplicationFont() */ int QFontDatabase::addApplicationFont(const QString &fileName) @@ -2229,8 +2223,6 @@ int QFontDatabase::addApplicationFont(const QString &fileName) \bold{Note:} Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported. - \note On Symbian, the font family names get truncated to a length of 20 characters. - \sa addApplicationFont(), applicationFontFamilies(), removeApplicationFont() */ int QFontDatabase::addApplicationFontFromData(const QByteArray &fontData) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index d5b85131af..15d0d0ce20 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE also have accessors to some relevant data in the physical font. QRawFont only provides support for the main font technologies: GDI and DirectWrite on Windows - platforms, FreeType on Symbian and Linux platforms and CoreText on Mac OS X. For other + platforms, FreeType on Linux platforms and CoreText on Mac OS X. For other font back-ends, the APIs will be disabled. QRawFont can be constructed in a number of ways: diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index c6bdfbd9c2..a5135cbd85 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -107,25 +107,5 @@ SOURCES += \ HEADERS += \ text/qplatformfontdatabase_qpa.h -symbian { - SOURCES += \ - text/qfont_s60.cpp - contains(QT_CONFIG, freetype) { - SOURCES += \ - text/qfontengine_ft.cpp \ - text/qrawfont_ft.cpp - HEADERS += \ - text/qfontengine_ft_p.h - DEFINES += \ - QT_NO_FONTCONFIG - } else { - SOURCES += \ - text/qfontengine_s60.cpp - HEADERS += \ - text/qfontengine_s60_p.h - } - LIBS += -lfntstr -lecom -} - DEFINES += QT_NO_OPENTYPE INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index b8d260e43c..a4cde20c6f 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -7,5 +7,3 @@ SOURCES += $$PWD/main.cpp DESTDIR = $$QT.gui.plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - -symbian:TARGET.UID3=0x2001E61A diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro index e0109c6a32..c0972fe189 100644 --- a/src/plugins/imageformats/ico/ico.pro +++ b/src/plugins/imageformats/ico/ico.pro @@ -10,5 +10,3 @@ SOURCES += main.cpp \ DESTDIR = $$QT.gui.plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - -symbian:TARGET.UID3=0x2001E616 diff --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro index 72dc506cf9..ad11c496c7 100644 --- a/src/plugins/imageformats/mng/mng.pro +++ b/src/plugins/imageformats/mng/mng.pro @@ -3,12 +3,6 @@ load(qt_plugin) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-mng)" -symbian: { - #Disable warnings in 3rdparty code due to unused variables and arguments - QMAKE_CXXFLAGS.CW += -W nounused - TARGET.UID3=0x2001E619 -} - include(../../../gui/image/qmnghandler.pri) SOURCES += main.cpp diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro index 012c49ecf1..4ad065420a 100644 --- a/src/plugins/imageformats/tiff/tiff.pro +++ b/src/plugins/imageformats/tiff/tiff.pro @@ -9,5 +9,3 @@ SOURCES += main.cpp DESTDIR = $$QT.gui.plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - -symbian:TARGET.UID3=0x2001E617 -- cgit v1.2.3