summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-09-18 11:33:10 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-09-18 11:33:10 (GMT)
commitc78dabc55943b76479f7a84bae146f52cbc7bbbf (patch)
tree5ea4392cf14c1126c82603b9ee614c384f28bd9e /src/gui/text
parent6454aca1b273daa2e54a77f83e1f6d4bae83427d (diff)
downloadQt-c78dabc55943b76479f7a84bae146f52cbc7bbbf.zip
Qt-c78dabc55943b76479f7a84bae146f52cbc7bbbf.tar.gz
Qt-c78dabc55943b76479f7a84bae146f52cbc7bbbf.tar.bz2
Introduce native Symbian bitmap support to QPixmap
This is done to reduce heap consumption and to give a possibility to share bitmaps across process. QPixmap maps to Symbian CFbsBitmap which is stored in Symbian font and bitmap server. Reviewed-by: Jason Barron
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont_s60.cpp9
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp10
-rw-r--r--src/gui/text/qfontengine_s60.cpp15
3 files changed, 23 insertions, 11 deletions
diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp
index 30e00ff..277d88f 100644
--- a/src/gui/text/qfont_s60.cpp
+++ b/src/gui/text/qfont_s60.cpp
@@ -41,7 +41,7 @@
#include "qfont.h"
#include "qt_s60_p.h"
-#include <private/qwindowsurface_s60_p.h>
+#include "qpixmap_s60_p.h"
#include "qmutex.h"
QT_BEGIN_NAMESPACE
@@ -57,14 +57,17 @@ QString QFont::lastResortFamily() const
QMutexLocker locker(lastResortFamilyMutex());
static QString family;
if (family.isEmpty()) {
- QS60WindowSurface::unlockBitmapHeap();
+
+ QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
+
CFont *font;
const TInt err = S60->screenDevice()->GetNearestFontInTwips(font, TFontSpec());
Q_ASSERT(err == KErrNone);
const TFontSpec spec = font->FontSpecInTwips();
family = QString((const QChar *)spec.iTypeface.iName.Ptr(), spec.iTypeface.iName.Length());
S60->screenDevice()->ReleaseFont(font);
- QS60WindowSurface::lockBitmapHeap();
+
+ lock.relock();
}
return family;
#else
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index e1a2c47..1a6bb11 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -45,9 +45,9 @@
#include "qfontengine_s60_p.h"
#include "qabstractfileengine.h"
#include "qdesktopservices.h"
+#include "qpixmap_s60_p.h"
#include "qt_s60_p.h"
#include "qendian.h"
-#include <private/qwindowsurface_s60_p.h>
#include <private/qcore_symbian_p.h>
#if defined(QT_NO_FREETYPE)
#include <OPENFONT.H>
@@ -217,7 +217,8 @@ static void initializeDb()
if (!db->s60Store)
db->s60Store = new QFontDatabaseS60StoreImplementation;
- QS60WindowSurface::unlockBitmapHeap();
+ QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
+
const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
Q_ASSERT(store);
@@ -271,8 +272,11 @@ static void initializeDb()
}
QS60Data::screenDevice()->ReleaseFont(font);
}
+
Q_ASSERT(fontAdded);
- QS60WindowSurface::lockBitmapHeap();
+
+ lock.relock();
+
#else // defined(QT_NO_FREETYPE)
QDir dir(QDesktopServices::storageLocation(QDesktopServices::FontsLocation));
dir.setNameFilters(QStringList() << QLatin1String("*.ttf")
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index ab2506c..88ae8f6 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -43,9 +43,9 @@
#include "qtextengine_p.h"
#include "qglobal.h"
#include <private/qapplication_p.h>
-#include <private/qwindowsurface_s60_p.h>
#include "qimage.h"
#include "qt_s60_p.h"
+#include "qpixmap_s60_p.h"
#include <e32base.h>
#include <e32std.h>
@@ -136,7 +136,9 @@ QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Exte
QFontEngine::fontDef = request;
m_fontSizeInPixels = (request.pixelSize >= 0)?
request.pixelSize:pointsToPixels(request.pointSize);
- QS60WindowSurface::unlockBitmapHeap();
+
+ QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
+
m_textRenderBitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new
const TSize bitmapSize(1, 1); // It is just a dummy bitmap that I need to keep the font alive (or maybe not)
qt_symbian_throwIfError(m_textRenderBitmap->Create(bitmapSize, EGray256));
@@ -151,12 +153,14 @@ QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Exte
const TInt errorCode = m_textRenderBitmapDevice->GetNearestFontInPixels(m_font, fontSpec);
Q_ASSERT(errorCode == 0);
m_textRenderBitmapGc->UseFont(m_font);
- QS60WindowSurface::lockBitmapHeap();
+
+ lock.relock();
}
QFontEngineS60::~QFontEngineS60()
{
- QS60WindowSurface::unlockBitmapHeap();
+ QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
+
m_textRenderBitmapGc->DiscardFont();
delete m_textRenderBitmapGc;
m_textRenderBitmapGc = NULL;
@@ -165,7 +169,8 @@ QFontEngineS60::~QFontEngineS60()
m_textRenderBitmapDevice = NULL;
delete m_textRenderBitmap;
m_textRenderBitmap = NULL;
- QS60WindowSurface::lockBitmapHeap();
+
+ lock.relock();
}
bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const