summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-09-22 12:55:00 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-09-22 12:55:00 (GMT)
commit9a5a12a5fe5bdf848756ddad20dabe288a6873de (patch)
tree4116fe2b23d8689f7f10688d338c7fc8abe46b1e /src/gui/painting
parent0d446ec758aacd131f2da0fa67a081fd93cff898 (diff)
parentb7ba409b0dabd382876310a6c110a96cf0e3c6bf (diff)
downloadQt-9a5a12a5fe5bdf848756ddad20dabe288a6873de.zip
Qt-9a5a12a5fe5bdf848756ddad20dabe288a6873de.tar.gz
Qt-9a5a12a5fe5bdf848756ddad20dabe288a6873de.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/gui/painting/qtextureglyphcache_p.h src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbezier.cpp41
-rw-r--r--src/gui/painting/qprintengine_ps.cpp1
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp20
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h6
4 files changed, 18 insertions, 50 deletions
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 2a9b31a..54c81ba 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -293,36 +293,6 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse
return Ok;
}
-static inline QLineF qline_shifted(const QPointF &p1, const QPointF &p2, qreal offset)
-{
- QLineF l(p1, p2);
- QLineF ln = l.normalVector().unitVector();
- l.translate(ln.dx() * offset, ln.dy() * offset);
- return l;
-}
-
-static bool qbezier_is_line(QPointF *points, int pointCount)
-{
- Q_ASSERT(pointCount > 2);
-
- qreal dx13 = points[2].x() - points[0].x();
- qreal dy13 = points[2].y() - points[0].y();
-
- qreal dx12 = points[1].x() - points[0].x();
- qreal dy12 = points[1].y() - points[0].y();
-
- if (pointCount == 3) {
- return qFuzzyCompare(dx12 * dy13, dx13 * dy12);
- } else if (pointCount == 4) {
- qreal dx14 = points[3].x() - points[0].x();
- qreal dy14 = points[3].y() - points[0].y();
-
- return (qFuzzyCompare(dx12 * dy13, dx13 * dy12) && qFuzzyCompare(dx12 * dy14, dx14 * dy12));
- }
-
- return false;
-}
-
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
{
int map[4];
@@ -353,17 +323,6 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr
if (np == 1)
return Discard;
- // We need to specialcase lines of 3 or 4 points due to numerical
- // instability in intersections below
- if (np > 2 && qbezier_is_line(points, np)) {
- if (points[0] == points[np-1])
- return Discard;
-
- QLineF l = qline_shifted(points[0], points[np-1], offset);
- *shifted = QBezier::fromPoints(l.p1(), l.pointAt(qreal(0.33)), l.pointAt(qreal(0.66)), l.p2());
- return Ok;
- }
-
QRectF b = orig->bounds();
if (np == 4 && b.width() < .1*offset && b.height() < .1*offset) {
qreal l = (orig->x1 - orig->x2)*(orig->x1 - orig->x2) +
diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp
index 28e9a7a..ca694ae 100644
--- a/src/gui/painting/qprintengine_ps.cpp
+++ b/src/gui/painting/qprintengine_ps.cpp
@@ -64,7 +64,6 @@
#include "qbitmap.h"
#include "qregion.h"
#include "qimagewriter.h"
-#include <private/qunicodetables_p.h>
#include <private/qpainterpath_p.h>
#include <qdebug.h>
#include <private/qdrawhelper_p.h>
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index e992bb2..2bb8cce 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -47,10 +47,6 @@
#include "private/qnativeimage_p.h"
#include "private/qfontengine_ft_p.h"
-#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH
-#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256
-#endif
-
QT_BEGIN_NAMESPACE
// #define CACHE_DEBUG
@@ -212,10 +208,18 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2);
if (m_cx + c.w > m_w) {
- // no room on the current line, start new glyph strip
- m_cx = 0;
- m_cy += m_currentRowHeight + paddingDoubled;
- m_currentRowHeight = 0; // New row
+ int new_width = m_w*2;
+ while (new_width < m_cx + c.w)
+ new_width *= 2;
+ if (new_width <= maxTextureWidth()) {
+ resizeTextureData(new_width, m_h);
+ m_w = new_width;
+ } else {
+ // no room on the current line, start new glyph strip
+ m_cx = 0;
+ m_cy += m_currentRowHeight + paddingDoubled;
+ m_currentRowHeight = 0; // New row
+ }
}
c.x = m_cx;
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 4131003..82aaf0d 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -64,6 +64,10 @@
# undef m_type
#endif
+#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH
+#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256
+#endif
+
struct glyph_metrics_t;
typedef unsigned int glyph_t;
@@ -132,6 +136,8 @@ public:
inline bool isNull() const { return m_h == 0; }
QHash<GlyphAndSubPixelPosition, Coord> coords;
+ virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; }
+ virtual int maxTextureHeight() const { return 32768; }
QImage textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const;