Skip to content

Fix caption stroke rendering order (#1033) - #1107

Merged
jonoomph merged 1 commit into
OpenShot:caption-qt-fixesfrom
rajeshgk:fix/caption-stroke-fill-order
Oct 16, 2026
Merged

jonoomph merged 1 commit into
OpenShot:caption-qt-fixesfrom
rajeshgk:fix/caption-stroke-fill-order

Conversation

@rajeshgk

Copy link
Copy Markdown

Summary

Fixes #1033.

The Caption effect previously rendered the text stroke and fill in a single QPainter::drawPath() operation. With thicker strokes, the outline extended into the glyph interior, partially obscuring the caption text.

This change draws the stroke first, followed by the fill, ensuring that the caption's interior remains unobstructed.

Changes

  • Render the caption outline separately using Qt::NoBrush.
  • Render the caption fill afterward using Qt::NoPen.
  • Preserve support for captions with zero stroke width.
  • Add a pixel-based regression test to verify the rendering order.

Testing

Environment: Ubuntu, GCC 15, Qt 5.

  • Caption test suite: PASS
  • 36 assertions: PASS
  • CTest: 1/1 passed
  • git diff --check: PASS

Negative-control verification

The regression test was also executed against the original rendering implementation.

  • Original implementation: FAIL, with 12,608 caption-fill pixels incorrectly darkened.
  • Corrected implementation: PASS, with no caption-fill pixels incorrectly darkened.

This confirms that the regression test detects the original rendering defect and passes with the correction.

Scope

The changes are limited to:

  • src/effects/Caption.cpp
  • tests/Caption.cpp

No changes to unrelated effects or encoding functionality.

Draw caption outlines before filling glyphs so the stroke does not obscure the text interior.

Add a pixel-based regression test that fails with the original rendering order.

Fixes OpenShot#1033
@jonoomph
jonoomph changed the base branch from develop to caption-qt-fixes October 16, 2026 18:30
@jonoomph
jonoomph merged commit 65d3fda into OpenShot:caption-qt-fixes Oct 16, 2026
1 check passed

Copy link
Copy Markdown
Member

Thank you for the PR and for the care you put into fixing caption stroke rendering! We’ve reviewed and tested it locally, and merged it into caption-qt-fixes for combined testing before it moves to develop. We appreciate your contribution to OpenShot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Caption border should be drawn first, then the background.

2 participants