Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qpainter.cpp

    r651 r769  
    709709        if (penBrush.style() == Qt::TexturePattern)
    710710            penTextureAlpha = qHasPixmapTexture(penBrush)
    711                               ? penBrush.texture().hasAlpha()
     711                              ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha()
    712712                              : penBrush.textureImage().hasAlphaChannel();
    713713        bool brushTextureAlpha = false;
    714         if (s->brush.style() == Qt::TexturePattern)
     714        if (s->brush.style() == Qt::TexturePattern) {
    715715            brushTextureAlpha = qHasPixmapTexture(s->brush)
    716                                 ? s->brush.texture().hasAlpha()
     716                                ? (s->brush.texture().depth() > 1) && s->brush.texture().hasAlpha()
    717717                                : s->brush.textureImage().hasAlphaChannel();
     718        }
    718719        if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha)
    719720             || (s->brush.style() == Qt::TexturePattern && brushTextureAlpha))
     
    19871988
    19881989    Note that only the states the underlying paint engine changes will be reset
    1989     to their respective default states. If, for example, the OpenGL polygon
    1990     mode is changed by the user inside a beginNativePaint()/endNativePainting()
    1991     block, it will not be reset to the default state by endNativePainting().
    1992 
    1993     Here is an example that shows intermixing of painter commands
    1994     and raw OpenGL commands:
     1990    to their respective default states. The states we reset may change from
     1991    release to release. The following states are currently reset in the OpenGL
     1992    2 engine:
     1993
     1994    \list
     1995    \i blending is disabled
     1996    \i the depth, stencil and scissor tests are disabled
     1997    \i the active texture unit is reset to 0
     1998    \i the depth mask, depth function and the clear depth are reset to their
     1999    default values
     2000    \i the stencil mask, stencil operation and stencil function are reset to
     2001    their default values
     2002     \i the current color is reset to solid white
     2003    \endlist
     2004
     2005    If, for example, the OpenGL polygon mode is changed by the user inside a
     2006    beginNativePaint()/endNativePainting() block, it will not be reset to the
     2007    default state by endNativePainting(). Here is an example that shows
     2008    intermixing of painter commands and raw OpenGL commands:
    19952009
    19962010    \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21
     
    57605774        gf.chars = engine.layoutData->string.unicode() + si.position;
    57615775        gf.num_chars = engine.length(item);
    5762         gf.width = si.width;
     5776        if (engine.forceJustification) {
     5777            for (int j=0; j<gf.glyphs.numGlyphs; ++j)
     5778                gf.width += gf.glyphs.effectiveAdvance(j);
     5779        } else {
     5780            gf.width = si.width;
     5781        }
    57635782        gf.logClusters = engine.logClusters(&si);
    57645783
    57655784        drawTextItem(QPointF(x.toReal(), p.y()), gf);
    57665785
    5767         x += si.width;
     5786        x += gf.width;
    57685787    }
    57695788}
     
    77887807            QTextLine line = textLayout.lineAt(i);
    77897808
     7809            qreal advance = textLayout.engine()->lines[i].textAdvance.toReal();
    77907810            if (tf & Qt::AlignRight)
    7791                 xoff = r.width() - line.naturalTextWidth();
     7811                xoff = r.width() - advance;
    77927812            else if (tf & Qt::AlignHCenter)
    7793                 xoff = (r.width() - line.naturalTextWidth())/2;
     7813                xoff = (r.width() - advance)/2;
    77947814
    77957815            line.draw(painter, QPointF(r.x() + xoff + line.x(), r.y() + yoff));
Note: See TracChangeset for help on using the changeset viewer.