Changeset 769 for trunk/src/gui/painting/qpainter.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/painting/qpainter.cpp
r651 r769 709 709 if (penBrush.style() == Qt::TexturePattern) 710 710 penTextureAlpha = qHasPixmapTexture(penBrush) 711 ? penBrush.texture().hasAlpha()711 ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() 712 712 : penBrush.textureImage().hasAlphaChannel(); 713 713 bool brushTextureAlpha = false; 714 if (s->brush.style() == Qt::TexturePattern) 714 if (s->brush.style() == Qt::TexturePattern) { 715 715 brushTextureAlpha = qHasPixmapTexture(s->brush) 716 ? s->brush.texture().hasAlpha()716 ? (s->brush.texture().depth() > 1) && s->brush.texture().hasAlpha() 717 717 : s->brush.textureImage().hasAlphaChannel(); 718 } 718 719 if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha) 719 720 || (s->brush.style() == Qt::TexturePattern && brushTextureAlpha)) … … 1987 1988 1988 1989 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: 1995 2009 1996 2010 \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21 … … 5760 5774 gf.chars = engine.layoutData->string.unicode() + si.position; 5761 5775 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 } 5763 5782 gf.logClusters = engine.logClusters(&si); 5764 5783 5765 5784 drawTextItem(QPointF(x.toReal(), p.y()), gf); 5766 5785 5767 x += si.width;5786 x += gf.width; 5768 5787 } 5769 5788 } … … 7788 7807 QTextLine line = textLayout.lineAt(i); 7789 7808 7809 qreal advance = textLayout.engine()->lines[i].textAdvance.toReal(); 7790 7810 if (tf & Qt::AlignRight) 7791 xoff = r.width() - line.naturalTextWidth();7811 xoff = r.width() - advance; 7792 7812 else if (tf & Qt::AlignHCenter) 7793 xoff = (r.width() - line.naturalTextWidth())/2;7813 xoff = (r.width() - advance)/2; 7794 7814 7795 7815 line.draw(painter, QPointF(r.x() + xoff + line.x(), r.y() + yoff));
Note:
See TracChangeset
for help on using the changeset viewer.