Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpainter.cpp File Reference

(7f72a93e874f5e52612983ad3b764f07216bf62e)

#include <memory>
#include <qdebug.h>
#include <qmath.h>
#include <qmutex.h>
#include "qbitmap.h"
#include "qimage.h"
#include "qpaintdevice.h"
#include "qpaintengine.h"
#include "qpainter.h"
#include "qpainter_p.h"
#include "qpainterpath.h"
#include "qpicture.h"
#include "qpixmapcache.h"
#include "qpolygon.h"
#include "qtextlayout.h"
#include "qthread.h"
#include "qvarlengtharray.h"
#include "qstatictext.h"
#include "qglyphrun.h"
#include <qpa/qplatformtheme.h>
#include <qpa/qplatformintegration.h>
#include <private/qfontengine_p.h>
#include <private/qpaintengine_p.h>
#include <private/qemulationpaintengine_p.h>
#include <private/qpainterpath_p.h>
#include <private/qtextengine_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qmath_p.h>
#include <private/qstatictext_p.h>
#include <private/qglyphrun_p.h>
#include <private/qhexstring_p.h>
#include <private/qguiapplication_p.h>
#include <private/qrawfont_p.h>
#include <private/qfont_p.h>
#include "moc_qpainter.cpp"
+ Include dependency graph for qpainter.cpp:

Go to the source code of this file.

Macros

#define QGradient_StretchToDevice   0x10000000
 
#define QPaintEngine_OpaqueBackground   0x40000000
 

Functions

QPixmap qt_pixmapForBrush (int style, bool invert)
 
void qt_format_text (const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString &str, QRectF *brect, int tabstops, int *tabarray, int tabarraylen, QPainter *painter)
 
static void drawTextItemDecoration (QPainter *painter, const QPointF &pos, const QFontEngine *fe, QTextEngine *textEngine, QTextCharFormat::UnderlineStyle underlineStyle, QTextItem::RenderFlags flags, qreal width, const QTextCharFormat &charFormat)
 
static void qt_draw_decoration_for_glyphs (QPainter *painter, const QPointF &decorationPosition, const glyph_t *glyphArray, const QFixedPoint *positions, int glyphCount, QFontEngine *fontEngine, bool underline, bool overline, bool strikeOut)
 
static QGradient::CoordinateMode coordinateMode (const QBrush &brush)
 
bool qHasPixmapTexture (const QBrush &)
 
static bool is_brush_transparent (const QBrush &brush)
 
static bool is_pen_transparent (const QPen &pen)
 
static uint line_emulation (uint emulation)
 
static bool qt_painter_thread_test (int devType, int engineType, const char *what)
 
static bool needsEmulation (const QBrush &brush)
 
static QBrush stretchGradientToUserSpace (const QBrush &brush, const QRectF &boundingRect)
 
bool qt_isExtendedRadialGradient (const QBrush &brush)
 
static void qt_cleanup_painter_state (QPainterPrivate *d)
 
QPainterPath qt_regionToPath (const QRegion &region)
 
static QPointF roundInDeviceCoordinates (const QPointF &p, const QTransform &m)
 
static QPixmap generateWavyPixmap (qreal maxRadius, const QPen &pen)
 
static bool needsResolving (const QBrush &brush)
 
void qt_format_text (const QFont &fnt, const QRectF &_r, int tf, const QString &str, QRectF *brect, int tabstops, int *ta, int tabarraylen, QPainter *painter)
 
void qt_draw_helper (QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation)
 

Macro Definition Documentation

◆ QGradient_StretchToDevice

#define QGradient_StretchToDevice   0x10000000

◆ QPaintEngine_OpaqueBackground

#define QPaintEngine_OpaqueBackground   0x40000000

Function Documentation

◆ coordinateMode()

static QGradient::CoordinateMode coordinateMode ( const QBrush & brush)
inlinestatic

Definition at line 80 of file qpainter.cpp.

References Qt::ConicalGradientPattern, Qt::LinearGradientPattern, QGradient::LogicalMode, and Qt::RadialGradientPattern.

Referenced by QPainterPrivate::drawStretchedGradient(), parseBrushValue(), and QPainterPrivate::updateEmulationSpecifier().

+ Here is the caller graph for this function:

◆ drawTextItemDecoration()

static void drawTextItemDecoration ( QPainter * painter,
const QPointF & pos,
const QFontEngine * fe,
QTextEngine * textEngine,
QTextCharFormat::UnderlineStyle underlineStyle,
QTextItem::RenderFlags flags,
qreal width,
const QTextCharFormat & charFormat )
static

◆ generateWavyPixmap()

static QPixmap generateWavyPixmap ( qreal maxRadius,
const QPen & pen )
static

Definition at line 5913 of file qpainter.cpp.

References QPainter::Antialiasing, QPen::color(), QPixmapCache::find(), QPixmapCache::insert(), QColor::name(), pixmap, qCeil(), qFloor(), qMax(), QPen::setCapStyle(), Qt::SquareCap, Qt::transparent, and QPen::widthF().

Referenced by drawTextItemDecoration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_brush_transparent()

static bool is_brush_transparent ( const QBrush & brush)
inlinestatic

Definition at line 95 of file qpainter.cpp.

References Qt::Dense1Pattern, Qt::DiagCrossPattern, qHasPixmapTexture(), and Qt::TexturePattern.

Referenced by is_pen_transparent(), and QPainterPrivate::updateEmulationSpecifier().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_pen_transparent()

static bool is_pen_transparent ( const QPen & pen)
inlinestatic

Definition at line 107 of file qpainter.cpp.

References QPen::brush(), is_brush_transparent(), Qt::SolidLine, and QPen::style().

Referenced by QPainterPrivate::updateEmulationSpecifier().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ line_emulation()

static uint line_emulation ( uint emulation)
inlinestatic

Definition at line 114 of file qpainter.cpp.

References QPaintEngine::AlphaBlend, QPaintEngine::Antialiasing, QPaintEngine::BrushStroke, QPaintEngine::ConstantOpacity, QPaintEngine::ObjectBoundingModeGradients, QPaintEngine::PrimitiveTransform, QGradient_StretchToDevice, and QPaintEngine_OpaqueBackground.

Referenced by QPainter::drawLines(), QPainter::drawLines(), QPainter::drawPolyline(), and QPainter::drawPolyline().

+ Here is the caller graph for this function:

◆ needsEmulation()

static bool needsEmulation ( const QBrush & brush)
static

Definition at line 154 of file qpainter.cpp.

References QGradient::coordinateMode(), QGradient::LogicalMode, qFuzzyCompare(), qHasPixmapTexture(), and Qt::TexturePattern.

Referenced by QPainterPrivate::checkEmulation(), QPainter::fillPath(), QPainter::fillRect(), QPainter::fillRect(), QPainter::strokePath(), and QWindowsDirect2DPaintEnginePrivate::to_d2d_brush().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ needsResolving()

static bool needsResolving ( const QBrush & brush)
inlinestatic

Definition at line 6571 of file qpainter.cpp.

References Qt::ConicalGradientPattern, Qt::LinearGradientPattern, QGradient::ObjectBoundingMode, QGradient::ObjectMode, and Qt::RadialGradientPattern.

Referenced by QPaintEngineState::brushNeedsResolving(), and QPaintEngineState::penNeedsResolving().

+ Here is the caller graph for this function:

◆ qHasPixmapTexture()

bool qHasPixmapTexture ( const QBrush & brush)
extern

Definition at line 84 of file qbrush.cpp.

References QImage::Format_MonoLSB, QBitmap::fromData(), QPixmapCache::insert(), and qt_patternForBrush().

Referenced by is_brush_transparent(), and needsEmulation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_cleanup_painter_state()

static void qt_cleanup_painter_state ( QPainterPrivate * d)
inlinestatic

Definition at line 1671 of file qpainter.cpp.

References d.

Referenced by QPainter::begin(), and QPainter::end().

+ Here is the caller graph for this function:

◆ qt_draw_decoration_for_glyphs()

static void qt_draw_decoration_for_glyphs ( QPainter * painter,
const QPointF & decorationPosition,
const glyph_t * glyphArray,
const QFixedPoint * positions,
int glyphCount,
QFontEngine * fontEngine,
bool underline,
bool overline,
bool strikeOut )
static

Definition at line 6063 of file qpainter.cpp.

References QFontEngine::boundingBox(), drawTextItemDecoration(), QTextCharFormat::NoUnderline, QTextItem::Overline, painter, positions, QTextCharFormat::SingleUnderline, QTextItem::StrikeOut, QFixed::toReal(), and QTextItem::Underline.

Referenced by QPainterPrivate::drawGlyphs(), and QPainter::drawStaticText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_draw_helper()

void qt_draw_helper ( QPainterPrivate * p,
const QPainterPath & path,
QPainterPrivate::DrawOperation operation )

Definition at line 8162 of file qpainter.cpp.

◆ qt_format_text() [1/2]

void qt_format_text ( const QFont & fnt,
const QRectF & _r,
int tf,
const QString & str,
QRectF * brect,
int tabstops,
int * ta,
int tabarraylen,
QPainter * painter )

Definition at line 7087 of file qpainter.cpp.

References painter, qt_format_text(), and str.

+ Here is the call graph for this function:

◆ qt_format_text() [2/2]

void qt_format_text ( const QFont & font,
const QRectF & _r,
int tf,
const QTextOption * option,
const QString & str,
QRectF * brect,
int tabstops,
int * tabarray,
int tabarraylen,
QPainter * painter )

Definition at line 7097 of file qpainter.cpp.

Referenced by QFontMetrics::boundingRect(), QFontMetricsF::boundingRect(), QPainter::boundingRect(), QPainter::drawText(), QPainter::drawText(), QPainter::drawText(), and qt_format_text().

+ Here is the caller graph for this function:

◆ qt_isExtendedRadialGradient()

bool qt_isExtendedRadialGradient ( const QBrush & brush)
extern

Definition at line 801 of file qbrush.cpp.

◆ qt_painter_thread_test()

static bool qt_painter_thread_test ( int devType,
int engineType,
const char * what )
static

Definition at line 127 of file qpainter.cpp.

References QThread::currentThread(), QPlatformIntegration::hasCapability(), QInternal::Image, QInternal::OpenGL, QPaintEngine::OpenGL, QPaintEngine::OpenGL2, QInternal::Picture, QInternal::Pixmap, QGuiApplicationPrivate::platformIntegration(), QInternal::Printer, qApp, qWarning, QPlatformIntegration::ThreadedOpenGL, QPlatformIntegration::ThreadedPixmaps, and QInternal::Widget.

Referenced by QPainter::drawPixmap(), QPainter::drawPixmap(), and QPainter::drawTiledPixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_pixmapForBrush()

QPixmap qt_pixmapForBrush ( int style,
bool invert )
extern

Definition at line 80 of file qbrush.cpp.

◆ qt_regionToPath()

QPainterPath qt_regionToPath ( const QRegion & region)
extern

Definition at line 1007 of file qregion.cpp.

References QPainterPath::addRect(), QRegion::begin(), QRegion::boundingRect(), connect(), QRegion::end(), i, j, rect, QRegion::rectCount(), and QRect::y().

Referenced by QPainter::clipPath(), QGraphicsViewPrivate::findItems(), QTransform::map(), QWin32PrintEngine::updateClipPath(), QX11PaintEngine::updateState(), and QWin32PrintEngine::updateState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roundInDeviceCoordinates()

static QPointF roundInDeviceCoordinates ( const QPointF & p,
const QTransform & m )
inlinestatic

Definition at line 4766 of file qpainter.cpp.

Referenced by QPainter::drawImage(), QPainter::drawImage(), QPainter::drawPixmap(), QPainter::drawPixmap(), and QPainter::drawTiledPixmap().

+ Here is the caller graph for this function:

◆ stretchGradientToUserSpace()

static QBrush stretchGradientToUserSpace ( const QBrush & brush,
const QRectF & boundingRect )
inlinestatic

Definition at line 492 of file qpainter.cpp.

References boundingRect(), Qt::ConicalGradientPattern, Qt::LinearGradientPattern, QGradient::LogicalMode, QGradient::ObjectMode, and Q_ASSERT.

Referenced by QPainterPrivate::drawStretchedGradient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: