src/gui/painting/qpainter.cpp
branchRCL_3
changeset 8 3f74d0d4af4c
parent 5 d3bac044e0f0
equal deleted inserted replaced
6:dee5afe5301f 8:3f74d0d4af4c
   706                           || brushStyle == Qt::TexturePattern));
   706                           || brushStyle == Qt::TexturePattern));
   707 
   707 
   708         bool penTextureAlpha = false;
   708         bool penTextureAlpha = false;
   709         if (penBrush.style() == Qt::TexturePattern)
   709         if (penBrush.style() == Qt::TexturePattern)
   710             penTextureAlpha = qHasPixmapTexture(penBrush)
   710             penTextureAlpha = qHasPixmapTexture(penBrush)
   711                               ? penBrush.texture().hasAlpha()
   711                               ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha()
   712                               : penBrush.textureImage().hasAlphaChannel();
   712                               : penBrush.textureImage().hasAlphaChannel();
   713         bool brushTextureAlpha = false;
   713         bool brushTextureAlpha = false;
   714         if (s->brush.style() == Qt::TexturePattern)
   714         if (s->brush.style() == Qt::TexturePattern) {
   715             brushTextureAlpha = qHasPixmapTexture(s->brush)
   715             brushTextureAlpha = qHasPixmapTexture(s->brush)
   716                                 ? s->brush.texture().hasAlpha()
   716                                 ? (s->brush.texture().depth() > 1) && s->brush.texture().hasAlpha()
   717                                 : s->brush.textureImage().hasAlphaChannel();
   717                                 : s->brush.textureImage().hasAlphaChannel();
       
   718         }
   718         if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha)
   719         if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha)
   719              || (s->brush.style() == Qt::TexturePattern && brushTextureAlpha))
   720              || (s->brush.style() == Qt::TexturePattern && brushTextureAlpha))
   720             && !engine->hasFeature(QPaintEngine::MaskedBrush))
   721             && !engine->hasFeature(QPaintEngine::MaskedBrush))
   721             s->emulationSpecifier |= QPaintEngine::MaskedBrush;
   722             s->emulationSpecifier |= QPaintEngine::MaskedBrush;
   722         else
   723         else
  1984     Flushes the painting pipeline and prepares for the user issuing commands
  1985     Flushes the painting pipeline and prepares for the user issuing commands
  1985     directly to the underlying graphics context. Must be followed by a call to
  1986     directly to the underlying graphics context. Must be followed by a call to
  1986     endNativePainting().
  1987     endNativePainting().
  1987 
  1988 
  1988     Note that only the states the underlying paint engine changes will be reset
  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     to their respective default states. The states we reset may change from
  1990     mode is changed by the user inside a beginNativePaint()/endNativePainting()
  1991     release to release. The following states are currently reset in the OpenGL
  1991     block, it will not be reset to the default state by endNativePainting().
  1992     2 engine:
  1992 
  1993 
  1993     Here is an example that shows intermixing of painter commands
  1994     \list
  1994     and raw OpenGL commands:
  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     \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21
  2010     \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21
  1997 
  2011 
  1998     \sa endNativePainting()
  2012     \sa endNativePainting()
  1999 */
  2013 */
  7507         const QWidgetPrivate *widgetPrivate = static_cast<const QWidget *>(device)->d_func();
  7521         const QWidgetPrivate *widgetPrivate = static_cast<const QWidget *>(device)->d_func();
  7508         if (widgetPrivate->redirectDev)
  7522         if (widgetPrivate->redirectDev)
  7509             return widgetPrivate->redirected(offset);
  7523             return widgetPrivate->redirected(offset);
  7510     }
  7524     }
  7511 
  7525 
  7512     if (*globalRedirectionAtomic() == 0)
  7526     if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0)
  7513         return 0;
  7527         return 0;
  7514 
  7528 
  7515     QMutexLocker locker(globalRedirectionsMutex());
  7529     QMutexLocker locker(globalRedirectionsMutex());
  7516     QPaintDeviceRedirectionList *redirections = globalRedirections();
  7530     QPaintDeviceRedirectionList *redirections = globalRedirections();
  7517     Q_ASSERT(redirections != 0);
  7531     Q_ASSERT(redirections != 0);
  7527 }
  7541 }
  7528 
  7542 
  7529 
  7543 
  7530 void qt_painter_removePaintDevice(QPaintDevice *dev)
  7544 void qt_painter_removePaintDevice(QPaintDevice *dev)
  7531 {
  7545 {
  7532     if (*globalRedirectionAtomic() == 0)
  7546     if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0)
  7533         return;
  7547         return;
  7534 
  7548 
  7535     QMutex *mutex = 0;
  7549     QMutex *mutex = 0;
  7536     QT_TRY {
  7550     QT_TRY {
  7537         mutex = globalRedirectionsMutex();
  7551         mutex = globalRedirectionsMutex();