Skip to content

Commit 48507a8

Browse files
authored
1 parent 811465c commit 48507a8

2 files changed

Lines changed: 31 additions & 37 deletions

File tree

src/modules/qt/filter_qtext.cpp

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -262,35 +262,6 @@ static QColor get_qcolor(mlt_properties filter_properties,
262262
return QColor(color.r, color.g, color.b, color.a);
263263
}
264264

265-
static QPen get_qpen(mlt_properties filter_properties,
266-
mlt_properties frame_properties,
267-
int position,
268-
int length)
269-
{
270-
QColor color;
271-
int outline = mlt_properties_get_int(filter_properties, "outline");
272-
QPen pen;
273-
274-
pen.setWidth(outline);
275-
if (outline) {
276-
color = get_qcolor(filter_properties, "olcolour", frame_properties, position, length);
277-
} else {
278-
color = get_qcolor(filter_properties, "bgcolour", frame_properties, position, length);
279-
}
280-
pen.setColor(color);
281-
282-
return pen;
283-
}
284-
285-
static QBrush get_qbrush(mlt_properties filter_properties,
286-
mlt_properties frame_properties,
287-
int position,
288-
int length)
289-
{
290-
QColor color = get_qcolor(filter_properties, "fgcolour", frame_properties, position, length);
291-
return QBrush(color);
292-
}
293-
294265
static void transform_painter(QPainter *painter,
295266
mlt_rect frame_rect,
296267
QRectF path_rect,
@@ -367,10 +338,26 @@ static void paint_text(QPainter *painter,
367338
int position,
368339
int length)
369340
{
370-
QPen pen = get_qpen(filter_properties, frame_properties, position, length);
371-
painter->setPen(pen);
372-
QBrush brush = get_qbrush(filter_properties, frame_properties, position, length);
341+
// Draw the outline first, and then draw the fill on top of it.
342+
// This avoids the outline encroaching on the text fill.
343+
344+
// Draw the outline if requested
345+
int outline = mlt_properties_get_int(filter_properties, "outline");
346+
if (outline) {
347+
QPen pen;
348+
pen.setWidth(outline);
349+
QColor color = get_qcolor(filter_properties, "olcolour", frame_properties, position, length);
350+
pen.setColor(color);
351+
painter->setPen(pen);
352+
painter->setBrush(Qt::NoBrush); // No brush needed for outline
353+
painter->drawPath(*qpath);
354+
}
355+
356+
// Fill the text area
357+
QColor color = get_qcolor(filter_properties, "fgcolour", frame_properties, position, length);
358+
QBrush brush(color);
373359
painter->setBrush(brush);
360+
painter->setPen(Qt::NoPen); // No pen needed for fill
374361
painter->drawPath(*qpath);
375362
}
376363

src/modules/qt/producer_qtext.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,23 @@ static void generate_qimage(mlt_properties frame_properties)
323323
#endif
324324
);
325325

326-
QPen pen;
327-
pen.setWidth(outline);
326+
// Draw the outline first, and then draw the fill on top of it.
327+
// This avoids the outline encroaching on the text fill.
328+
329+
// Draw the outline if requested
328330
if (outline) {
331+
QPen pen;
332+
pen.setWidth(outline);
329333
pen.setColor(QColor(ol_color.r, ol_color.g, ol_color.b, ol_color.a));
330-
} else {
331-
pen.setColor(QColor(bg_color.r, bg_color.g, bg_color.b, bg_color.a));
334+
painter.setPen(pen);
335+
painter.setBrush(Qt::NoBrush); // No brush needed for outline
336+
painter.drawPath(*qPath);
332337
}
333-
painter.setPen(pen);
338+
339+
// Fill the text area
334340
QBrush brush(QColor(fg_color.r, fg_color.g, fg_color.b, fg_color.a));
335341
painter.setBrush(brush);
342+
painter.setPen(Qt::NoPen); // No pen needed for fill
336343
painter.drawPath(*qPath);
337344
}
338345

0 commit comments

Comments
 (0)