src/gui/painting/qtextureglyphcache_p.h
changeset 30 5dc02b23752f
parent 29 b72c6db6890b
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    74 
    74 
    75 class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
    75 class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
    76 {
    76 {
    77 public:
    77 public:
    78     QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
    78     QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
    79         : QFontEngineGlyphCache(matrix, type), m_w(0), m_h(0), m_cx(0), m_cy(0) { }
    79         : QFontEngineGlyphCache(matrix, type), m_current_fontengine(0),
       
    80                                                m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0)
       
    81         { }
    80 
    82 
    81     virtual ~QTextureGlyphCache() { }
    83     virtual ~QTextureGlyphCache() { }
    82 
    84 
    83     struct Coord {
    85     struct Coord {
    84         int x;
    86         int x;
    88 
    90 
    89         int baseLineX;
    91         int baseLineX;
    90         int baseLineY;
    92         int baseLineY;
    91     };
    93     };
    92 
    94 
    93     void populate(const QTextItemInt &ti,
    95     void populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
    94                   const QVarLengthArray<glyph_t> &glyphs,
    96                   const QFixedPoint *positions);
    95                   const QVarLengthArray<QFixedPoint> &positions);
       
    96 
    97 
    97     virtual void createTextureData(int width, int height) = 0;
    98     virtual void createTextureData(int width, int height) = 0;
    98     virtual void resizeTextureData(int width, int height) = 0;
    99     virtual void resizeTextureData(int width, int height) = 0;
    99     virtual int glyphMargin() const { return 0; }
   100     virtual int glyphMargin() const { return 0; }
   100     virtual int glyphPadding() const { return 0; }
   101     virtual int glyphPadding() const { return 0; }
   112     QHash<glyph_t, Coord> coords;
   113     QHash<glyph_t, Coord> coords;
   113 
   114 
   114     QImage textureMapForGlyph(glyph_t g) const;
   115     QImage textureMapForGlyph(glyph_t g) const;
   115 
   116 
   116 protected:
   117 protected:
   117     const QTextItemInt *m_current_textitem;
   118     QFontEngine *m_current_fontengine;
   118 
   119 
   119     int m_w; // image width
   120     int m_w; // image width
   120     int m_h; // image height
   121     int m_h; // image height
   121     int m_cx; // current x
   122     int m_cx; // current x
   122     int m_cy; // current y
   123     int m_cy; // current y
       
   124     int m_currentRowHeight; // Height of last row
   123 };
   125 };
   124 
   126 
   125 
   127 
   126 class QImageTextureGlyphCache : public QTextureGlyphCache
   128 class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache
   127 {
   129 {
   128 public:
   130 public:
   129     QImageTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
   131     QImageTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
   130         : QTextureGlyphCache(type, matrix) { }
   132         : QTextureGlyphCache(type, matrix) { }
   131     virtual int glyphMargin() const;
   133     virtual int glyphMargin() const;