Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/text/qfontengine_p.h

    r125 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5757#include "QtCore/qatomic.h"
    5858#include <QtCore/qvarlengtharray.h>
     59#include <QtCore/QLinkedList>
    5960#include "private/qtextengine_p.h"
    6061#include "private/qfont_p.h"
     
    7172#endif
    7273
    73 #include "qfontengineglyphcache_p.h"
     74#include <private/qfontengineglyphcache_p.h>
    7475
    7576struct glyph_metrics_t;
     
    9495class Q_GUI_EXPORT QFontEngine : public QObject
    9596{
    96     Q_OBJECT
    9797public:
    9898    enum Type {
     
    109109        Mac,
    110110
    111         // Trolltech QWS types
     111        // QWS types
    112112        Freetype,
    113113        QPF1,
    114114        QPF2,
    115115        Proxy,
     116
     117        // S60 types
     118        S60FontEngine, // Cannot be simply called "S60". Reason is qt_s60Data.h
     119
    116120        TestFontEngine = 0x1000
    117121    };
     
    165169    virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
    166170
    167 #if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_PM) && !defined(Q_WS_MAC)
     171#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(Q_WS_PM)
    168172    virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si) = 0;
    169173#endif
     
    179183     * Returns an image indexed_8 with index values ranging from 0=fully transparant to 255=opaque
    180184     */
    181     virtual QImage alphaMapForGlyph(glyph_t) = 0;
     185    virtual QImage alphaMapForGlyph(glyph_t);
    182186    virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
    183187    virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t);
     
    217221
    218222    void setGlyphCache(void *key, QFontEngineGlyphCache *data);
    219     void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data);
    220     QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const;
    221     QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const;
     223    QFontEngineGlyphCache *glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const;
    222224
    223225    static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
     
    232234    mutable HB_FontRec hbFont;
    233235    mutable HB_Face hbFace;
    234 #if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_WS_X11) || defined(Q_WS_QWS)
     236#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM)
    235237    struct KernPair {
    236238        uint left_right;
     
    248250    int glyphFormat;
    249251
     252protected:
     253    static const QVector<QRgb> &grayPalette();
     254
    250255private:
    251     /// remove old entries from the glyph cache. Helper method for the setGlyphCache ones.
    252     void expireGlyphCache();
    253 
    254     GlyphPointerHash m_glyphPointerHash;
    255     GlyphIntHash m_glyphIntHash;
    256     mutable QList<QFontEngineGlyphCache*> m_glyphCacheQueue;
     256    struct GlyphCacheEntry {
     257        void *context;
     258        QFontEngineGlyphCache *cache;
     259        bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; }
     260    };
     261
     262    mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
    257263};
    258264
     
    323329    virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
    324330
    325 #if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_PM) && !defined(Q_WS_MAC)
     331#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(Q_WS_PM)
    326332    void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
    327333#endif
     
    354360};
    355361
    356 class Q_GUI_EXPORT QFontEngineMulti : public QFontEngine
     362class QFontEngineMulti : public QFontEngine
    357363{
    358364public:
     
    390396    { return "Multi"; }
    391397
    392     QFontEngine *engine(int at) const;
     398    QFontEngine *engine(int at) const
     399    {Q_ASSERT(at < engines.size()); return engines.at(at); }
     400
    393401
    394402protected:
     
    441449    virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
    442450    virtual QImage alphaMapForGlyph(glyph_t);
     451    virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t);
    443452    virtual qreal minRightBearing() const;
    444453    virtual qreal minLeftBearing() const;
    445454
    446455
    447 
    448456private:
     457    QImage imageForGlyph(glyph_t glyph, int margin, bool colorful);
    449458    CTFontRef ctfont;
    450459    CGFontRef cgFont;
     
    526535    virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
    527536    virtual QImage alphaMapForGlyph(glyph_t);
     537    virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t);
    528538
    529539private:
     540    QImage imageForGlyph(glyph_t glyph, int margin, bool colorful);
     541
    530542    ATSUFontID fontID;
    531543    QCFType<CGFontRef> cgFont;
     
    615627#endif
    616628
     629#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
     630#   include "private/qfontengine_ft_p.h"
     631#endif
     632
    617633#endif // QFONTENGINE_P_H
Note: See TracChangeset for help on using the changeset viewer.