summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-06-26 09:03:45 (GMT)
committerTrond Kjernaasen <trond@trolltech.com>2009-06-26 09:09:18 (GMT)
commit2df18ac4dd17f8630f1ea0f6dc2415aca53d931a (patch)
treec9942558e68288053709f1382cb14a19c5d3f394 /src/gui/painting
parentd553f376a34ea1d27492a1a5fd14f79616f6a27c (diff)
downloadQt-2df18ac4dd17f8630f1ea0f6dc2415aca53d931a.zip
Qt-2df18ac4dd17f8630f1ea0f6dc2415aca53d931a.tar.gz
Qt-2df18ac4dd17f8630f1ea0f6dc2415aca53d931a.tar.bz2
Fixed cap and join styles when printing to native Windows printers.
Line and polygon strokes did not respect the join/cap styles set on a painter. Task-number: 256914 Reviewed-by: Samuel
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qprintengine_win.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index 179927f..77b82f8 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -862,7 +862,25 @@ void QWin32PrintEnginePrivate::fillPath_dev(const QPainterPath &path, const QCol
void QWin32PrintEnginePrivate::strokePath_dev(const QPainterPath &path, const QColor &color, qreal penWidth)
{
composeGdiPath(path);
- HPEN pen = CreatePen(PS_SOLID, qRound(penWidth), RGB(color.red(), color.green(), color.blue()));
+ LOGBRUSH brush;
+ brush.lbStyle = BS_SOLID;
+ brush.lbColor = RGB(color.red(), color.green(), color.blue());
+ DWORD capStyle = PS_ENDCAP_SQUARE;
+ DWORD joinStyle = PS_JOIN_BEVEL;
+ if (pen.capStyle() == Qt::FlatCap)
+ capStyle = PS_ENDCAP_FLAT;
+ else if (pen.capStyle() == Qt::RoundCap)
+ capStyle = PS_ENDCAP_ROUND;
+
+ if (pen.joinStyle() == Qt::MiterJoin)
+ joinStyle = PS_JOIN_MITER;
+ else if (pen.joinStyle() == Qt::RoundJoin)
+ joinStyle = PS_JOIN_ROUND;
+
+ HPEN pen = ExtCreatePen(((penWidth == 0) ? PS_COSMETIC : PS_GEOMETRIC)
+ | PS_SOLID | capStyle | joinStyle,
+ penWidth, &brush, 0, 0);
+
HGDIOBJ old_pen = SelectObject(hdc, pen);
StrokePath(hdc);
DeleteObject(SelectObject(hdc, old_pen));