Skip to content

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

Open
rajeshgk wants to merge 1 commit into
OpenShot:developfrom
rajeshgk:fix/caption-stroke-fill-order
Open

rajeshgk wants to merge 1 commit into
OpenShot:developfrom
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
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.

1 participant