summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-01-26 14:25:09 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-01-26 14:25:09 (GMT)
commita5bf01a04d8f18182e9d453ba36facddffc3ba99 (patch)
treef6175d889631d1096c8a095d4c0b692a05a6d995 /src/openvg
parenta16d9ed3f202147b6c315d5e2008c08a3ad909b6 (diff)
downloadQt-a5bf01a04d8f18182e9d453ba36facddffc3ba99.zip
Qt-a5bf01a04d8f18182e9d453ba36facddffc3ba99.tar.gz
Qt-a5bf01a04d8f18182e9d453ba36facddffc3ba99.tar.bz2
Compile for S60
Make the OpenVG code for QStaticText compile.
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpaintengine_vg.cpp30
-rw-r--r--src/openvg/qpaintengine_vg_p.h3
2 files changed, 19 insertions, 14 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 9088d66..0ef93b3 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -50,7 +50,6 @@
#endif
#include <QtCore/qvarlengtharray.h>
#include <QtGui/private/qdrawhelper_p.h>
-#include <QtGui/private/qtextureglyphcache_p.h>
#include <QtGui/private/qtextengine_p.h>
#include <QtGui/private/qfontengine_p.h>
#include <QtGui/private/qpainterpath_p.h>
@@ -87,7 +86,8 @@ public:
QVGFontGlyphCache();
~QVGFontGlyphCache();
- void cacheGlyphs(QVGPaintEnginePrivate *d, QFontEngine *fontEngine, glyph_t *g, int count);
+ void cacheGlyphs(QVGPaintEnginePrivate *d, QFontEngine *fontEngine, const glyph_t *g, int count);
+
void setScaleFromText(const QFont &font, QFontEngine *fontEngine);
VGFont font;
@@ -3142,9 +3142,9 @@ void QVGFontGlyphCache::setScaleFromText(const QFont &font, QFontEngine *fontEng
scaleX = scaleY = static_cast<VGfloat>(pixelSize / emSquare);
}
-void QVGFontGlyphCache::cacheGlyphs
- (QVGPaintEnginePrivate *d, QFontEngine *fontEngine,
- glyph_t *g, int count);
+void QVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
+ QFontEngine *fontEngine,
+ const glyph_t *g, int count)
{
VGfloat origin[2];
VGfloat escapement[2];
@@ -3233,7 +3233,8 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
ti.fontEngine->getGlyphPositions
(ti.glyphs, matrix, ti.flags, glyphs, positions);
- drawCachedGlyphs(glyphs.size(), glyphs.data(), positions.data(), ti.font, ti.fontEngine, p);
+ if (!drawCachedGlyphs(glyphs.size(), glyphs.data(), ti.font(), ti.fontEngine, p))
+ QPaintEngineEx::drawTextItem(p, textItem);
#else
// OpenGL 1.0 does not have support for VGFont and glyphs,
// so fall back to the default Qt path stroking algorithm.
@@ -3241,15 +3242,17 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
#endif
}
-void QVGPaintengine::drawStaticText(QStaticTextItem *textItem)
+void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
{
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->font, textItem->fontEngine,
QPointF(0, 0));
}
- void QVGPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font,
+ bool QVGPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font,
QFontEngine *fontEngine, const QPointF &p)
{
+ Q_D(QVGPaintEngine);
+
// Find the glyph cache for this font.
QVGFontCache::ConstIterator it = d->fontCache.constFind(fontEngine);
QVGFontGlyphCache *glyphCache;
@@ -3259,9 +3262,8 @@ void QVGPaintengine::drawStaticText(QStaticTextItem *textItem)
glyphCache = new QVGFontGlyphCache();
if (glyphCache->font == VG_INVALID_HANDLE) {
qWarning("QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine");
- delete glyphCache;
- QPaintEngineEx::drawTextItem(p, textItem);
- return;
+ delete glyphCache;
+ return false;
}
glyphCache->setScaleFromText(font, fontEngine);
d->fontCache.insert(fontEngine, glyphCache);
@@ -3280,7 +3282,7 @@ void QVGPaintengine::drawStaticText(QStaticTextItem *textItem)
d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, glyphTransform);
// Add the glyphs from the text item into the glyph cache.
- glyphCache->cacheGlyphs(d, fontEngine, glyphs.constData(), glyphs.size());
+ glyphCache->cacheGlyphs(d, fontEngine, glyphs, numGlyphs);
// Set the glyph drawing origin.
VGfloat origin[2];
@@ -3299,8 +3301,10 @@ void QVGPaintengine::drawStaticText(QStaticTextItem *textItem)
// Draw the glyphs. We need to fill with the brush associated with
// the Qt pen, not the Qt brush.
d->ensureBrush(state()->pen.brush());
- vgDrawGlyphs(glyphCache->font, numGlyphs, (VGuint*)glyphs.data(),
+ vgDrawGlyphs(glyphCache->font, numGlyphs, (VGuint*)glyphs,
NULL, NULL, VG_FILL_PATH, VG_TRUE);
+
+ return true;
}
void QVGPaintEngine::setState(QPainterState *s)
diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h
index c70e1c1..3f73fed 100644
--- a/src/openvg/qpaintengine_vg_p.h
+++ b/src/openvg/qpaintengine_vg_p.h
@@ -54,6 +54,7 @@
//
#include <QtGui/private/qpaintengineex_p.h>
+#include <QtGui/private/qtextureglyphcache_p.h>
QT_BEGIN_NAMESPACE
@@ -140,7 +141,7 @@ public:
void drawTextItem(const QPointF &p, const QTextItem &textItem);
void drawStaticTextItem(QStaticTextItem *staticTextItem);
- void drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font,
+ bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font,
QFontEngine *fontEngine, const QPointF &p);
void setState(QPainterState *s);