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/painting/qtextureglyphcache.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8989               ti.descent.toReal());
    9090#endif
    91         int glyph_width = metrics.width.ceil().toInt() + margin * 2;
    92         int glyph_height = metrics.height.ceil().toInt() + margin * 2;
     91        int glyph_width = metrics.width.ceil().toInt();
     92        int glyph_height = metrics.height.ceil().toInt();
    9393        if (glyph_height == 0 || glyph_width == 0)
    9494            continue;
    95 
     95        glyph_width += margin * 2 + 4;
     96        glyph_height += margin * 2 + 4;
    9697        // align to 8-bit boundary
    9798        if (m_type == QFontEngineGlyphCache::Raster_Mono)
     
    101102                    glyph_width,
    102103                    glyph_height, // texture coords
    103                     metrics.x.truncate(),
     104                    metrics.x.truncate(),
    104105                    -metrics.y.truncate() }; // baseline for horizontal scripts
    105106
     
    155156
    156157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
    157198}
    158199
     
    189230int QImageTextureGlyphCache::glyphMargin() const
    190231{
    191 #ifdef Q_WS_MAC
    192     return 2;
     232#if
     233    return ;
    193234#else
    194235    return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
     
    198239void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g)
    199240{
    200     QImage mask;
    201 #if defined(Q_WS_X11)
    202     if (m_transform.type() > QTransform::TxTranslate) {
    203         QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None;
    204         switch (m_type) {
    205         case Raster_RGBMask:
    206             format = QFontEngineFT::Format_A32; break;
    207         case Raster_A8:
    208             format = QFontEngineFT::Format_A8; break;
    209         case Raster_Mono:
    210             format = QFontEngineFT::Format_Mono; break;
    211         };
    212 
    213         QFontEngineFT *ft = static_cast<QFontEngineFT*> (m_current_textitem->fontEngine);
    214         QFontEngineFT::QGlyphSet *gset = ft->loadTransformedGlyphSet(m_transform);
    215 
    216         if (gset && ft->loadGlyphs(gset, &g, 1, format)) {
    217             QFontEngineFT::Glyph *glyph = gset->glyph_data.value(g);
    218             const int bytesPerLine = (format == QFontEngineFT::Format_Mono ? ((glyph->width + 31) & ~31) >> 3
    219                                : (glyph->width + 3) & ~3);
    220             mask = QImage(glyph->data, glyph->width, glyph->height, bytesPerLine, m_image.format());
    221         }
    222     } else
    223 #endif
    224     if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
    225         mask = m_current_textitem->fontEngine->alphaRGBMapForGlyph(g, glyphMargin(), m_transform);
    226     else
    227         mask = m_current_textitem->fontEngine->alphaMapForGlyph(g, m_transform);
     241    QImage mask = textureMapForGlyph(g);
    228242
    229243#ifdef CACHE_DEBUG
Note: See TracChangeset for help on using the changeset viewer.