summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/image/qpixmap_s60.cpp3
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp6
-rw-r--r--src/gui/text/qfontengine_s60.cpp46
-rw-r--r--src/gui/text/qfontengine_s60_p.h3
-rw-r--r--src/openvg/qvg_symbian.cpp3
-rw-r--r--src/s60installs/qt.iby6
-rw-r--r--src/s60installs/qtdemoapps.iby15
-rw-r--r--src/s60installs/s60installs.pro1
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp11
9 files changed, 63 insertions, 31 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 47249d9873..b7c8acb81b 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -968,11 +968,12 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
if (needsCopy) {
TSize size = sourceBitmap->SizeInPixels();
+ int bytesPerLine = sourceBitmap->ScanLineLength(size.iWidth, displayMode);
QSymbianBitmapDataAccess da;
da.beginDataAccess(sourceBitmap);
uchar *bytes = (uchar*)sourceBitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
+ QImage img = QImage(bytes, size.iWidth, size.iHeight, bytesPerLine, format);
img = img.copy();
da.endDataAccess(sourceBitmap);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 9749244ee8..c92d291fca 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3164,10 +3164,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti)
const TUint8 *glyphBitmapBytes;
TSize glyphBitmapSize;
fe->getCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize);
- const glyph_metrics_t metrics = ti.fontEngine->boundingBox(glyphs[i]);
- const int x = qFloor(positions[i].x + metrics.x + aliasDelta);
- const int y = qFloor(positions[i].y + metrics.y + aliasDelta);
-
+ const int x = qFloor(positions[i].x + tmetrics.HorizBearingX() + aliasDelta);
+ const int y = qFloor(positions[i].y - tmetrics.HorizBearingY() + aliasDelta);
alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight);
}
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 5980f201d3..3705136147 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -41,6 +41,7 @@
#include "qfontengine_s60_p.h"
#include "qtextengine_p.h"
+#include "qendian.h"
#include "qglobal.h"
#include <private/qapplication_p.h>
#include "qimage.h"
@@ -176,6 +177,24 @@ CFont *QSymbianTypeFaceExtras::fontOwner() const
return m_cFont;
}
+QFixed QSymbianTypeFaceExtras::unitsPerEm() const
+{
+ if (m_unitsPerEm.value() != 0)
+ return m_unitsPerEm;
+ const QByteArray head = getSfntTable(MAKE_TAG('h', 'e', 'a', 'd'));
+ const int unitsPerEmOffset = 18;
+ if (head.size() > unitsPerEmOffset + sizeof(quint16)) {
+ const uchar* tableData = reinterpret_cast<const uchar*>(head.constData());
+ const uchar* unitsPerEm = tableData + unitsPerEmOffset;
+ m_unitsPerEm = qFromBigEndian<quint16>(unitsPerEm);
+ } else {
+ // Bitmap font? Corrupt font?
+ // We return -1 and let the QFontEngineS60 return the pixel size.
+ m_unitsPerEm = -1;
+ }
+ return m_unitsPerEm;
+}
+
// duplicated from qfontengine_xyz.cpp
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
@@ -248,6 +267,13 @@ QFontEngineS60::~QFontEngineS60()
releaseFont(m_scaledFont);
}
+QFixed QFontEngineS60::emSquareSize() const
+{
+ const QFixed unitsPerEm = m_extras->unitsPerEm();
+ return unitsPerEm.toInt() == -1 ?
+ QFixed::fromReal(m_originalFontSizeInPixels) : unitsPerEm;
+}
+
bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
{
if (*nglyphs < len) {
@@ -277,10 +303,13 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout
void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
{
Q_UNUSED(flags);
+ TOpenFontCharMetrics metrics;
+ const TUint8 *glyphBitmapBytes;
+ TSize glyphBitmapSize;
for (int i = 0; i < glyphs->numGlyphs; i++) {
- const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]);
- glyphs->advances_x[i] = bbox.xoff;
- glyphs->advances_y[i] = bbox.yoff;
+ getCharacterData(glyphs->glyphs[i], metrics, glyphBitmapBytes, glyphBitmapSize);
+ glyphs->advances_x[i] = metrics.HorizAdvance();
+ glyphs->advances_y[i] = 0;
}
}
@@ -308,6 +337,7 @@ void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions,
parseGlyphPathData(outlineChar, outlineEnd, *path, fontSizeInPixels,
positions[count++].toPointF(), false);
} while(KErrNone == iterator.Next() && count <= nglyphs);
+ iterator.Close();
#else // Q_SYMBIAN_HAS_GLYPHOUTLINE_API
QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags);
#endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API
@@ -359,13 +389,11 @@ glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
const TUint8 *glyphBitmapBytes;
TSize glyphBitmapSize;
getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize);
- TRect glyphBounds;
- metrics.GetHorizBounds(glyphBounds);
const glyph_metrics_t result(
- glyphBounds.iTl.iX,
- glyphBounds.iTl.iY,
- glyphBounds.Width(),
- glyphBounds.Height(),
+ metrics.HorizBearingX(),
+ -metrics.HorizBearingY(),
+ metrics.Width(),
+ metrics.Height(),
metrics.HorizAdvance(),
0
);
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index d05c23c4e0..c65ce55f1b 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -82,11 +82,13 @@ public:
const uchar *cmap() const;
CFont *fontOwner() const;
bool isSymbolCMap() const;
+ QFixed unitsPerEm() const;
private:
CFont* m_cFont;
mutable bool m_symbolCMap;
mutable QByteArray m_cmapTable;
+ mutable QFixed m_unitsPerEm;
#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
COpenFont *m_openFont;
mutable MOpenFontTrueTypeExtension *m_trueTypeExtension;
@@ -99,6 +101,7 @@ public:
QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras);
~QFontEngineS60();
+ QFixed emSquareSize() const;
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const;
diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp
index a9625b2beb..41b35fc22e 100644
--- a/src/openvg/qvg_symbian.cpp
+++ b/src/openvg/qvg_symbian.cpp
@@ -185,10 +185,11 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
QImage::Format format = qt_TDisplayMode2Format(displayMode);
TSize size = bitmap->SizeInPixels();
+ int bytesPerLine = bitmap->ScanLineLength(size.iWidth, displayMode);
bitmap->BeginDataAccess();
uchar *bytes = (uchar*)bitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
+ QImage img = QImage(bytes, size.iWidth, size.iHeight, bytesPerLine, format);
img = img.copy();
bitmap->EndDataAccess();
diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby
index b6cdce915a..4afbf05c5d 100644
--- a/src/s60installs/qt.iby
+++ b/src/s60installs/qt.iby
@@ -53,6 +53,9 @@ file=ABI_DIR\BUILD_DIR\qaudio.dll SHARED_LIB_DIR\qaudio.dll
file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll
file=ABI_DIR\BUILD_DIR\qglgraphicssystem.dll SHARED_LIB_DIR\qglgraphicssystem.dll
+// bearer
+file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll
+
// S60 version compatibility plugins for 5.0 (3.1 and 3.2 devices are never likely to have this in ROM,
// so don't bother including those plugins
file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll
@@ -99,6 +102,9 @@ data=\epoc32\data\qt\qtlibspluginstubs\qaudio.qtplugin resource\qt\plugins\audio
data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin
data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin
+// bearer stub
+data=\epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin
+
// Stub sis file
data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis
data=ZSYSTEM\install\qtwebkit_stub.sis System\Install\qtwebkit_stub.sis
diff --git a/src/s60installs/qtdemoapps.iby b/src/s60installs/qtdemoapps.iby
deleted file mode 100644
index d888135d8c..0000000000
--- a/src/s60installs/qtdemoapps.iby
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef QTDEMOAPPS_IBY
-#define QTDEMOAPPS_IBY
-
-// A subset of Qt demo & example applications
-
-// Note that star requires OpenVG and the Qt OpenVG paint engine
-S60_APP_EXE(star)
-S60_APP_RESOURCE(star)
-data=\epoc32\data\Z\private\10003a3f\import\Apps\star_reg.rsc \private\10003a3f\import\apps\star_reg.rsc
-
-S60_APP_EXE(wiggly)
-S60_APP_RESOURCE(wiggly)
-data=\epoc32\data\Z\private\10003a3f\import\Apps\wiggly_reg.rsc \private\10003a3f\import\apps\wiggly_reg.rsc
-
-#endif // QTDEMOAPPS_IBY
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index c73ed06f17..d63b97cc35 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -200,5 +200,4 @@ symbian: {
}
BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)"
- BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)"
}
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 24cbb21ae4..fdf83118a4 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1160,6 +1160,8 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data()
const int smallHeight = 20;
const int largeWidth = 240;
const int largeHeight = 320;
+ const int notAlignedWidth = 250;
+ const int notAlignedHeight = 250;
// Indexed Color Formats - Disabled since images seem to be blank -> no palette?
// QTest::newRow("EGray2 small") << EGray2 << smallWidth << smallHeight << QColor(Qt::black);
@@ -1172,14 +1174,19 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data()
// Direct Color Formats
QTest::newRow("EColor4K small") << EColor4K << smallWidth << smallHeight << QColor(Qt::red);
QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red);
+ QTest::newRow("EColor4K not aligned") << EColor4K << notAlignedWidth << notAlignedHeight << QColor(Qt::red);
QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green);
QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green);
+ QTest::newRow("EColor64K not aligned") << EColor64K << notAlignedWidth << notAlignedHeight << QColor(Qt::green);
QTest::newRow("EColor16M small") << EColor16M << smallWidth << smallHeight << QColor(Qt::yellow);
QTest::newRow("EColor16M big") << EColor16M << largeWidth << largeHeight << QColor(Qt::yellow);
+ QTest::newRow("EColor16M not aligned") << EColor16M << notAlignedWidth << notAlignedHeight << QColor(Qt::yellow);
QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red);
QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red);
+ QTest::newRow("EColor16MU not aligned") << EColor16MU << notAlignedWidth << notAlignedHeight << QColor(Qt::red);
QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0);
QTest::newRow("EColor16MA big opaque") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0);
+ QTest::newRow("EColor16MA not aligned opaque") << EColor16MA << notAlignedWidth << notAlignedHeight << QColor(255, 255, 0);
// Semi-transparent Colors - Disabled for now, since the QCOMPARE fails, but visually confirmed to work
// QTest::newRow("EColor16MA small semi") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 127);
@@ -1237,6 +1244,10 @@ void tst_QPixmap::fromSymbianCFbsBitmap()
QColor actualColor(image.pixel(1, 1));
QCOMPARE(actualColor, color);
+
+ QImage shouldBe(pixmap.width(), pixmap.height(), image.format());
+ shouldBe.fill(color.rgba());
+ QCOMPARE(image, shouldBe);
}
__UHEAP_MARKEND;