diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-03-28 01:16:44 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-09-11 18:24:50 +0300 |
commit | 2e2aa4079943a330f8e10d22c14ad67da3c4107b (patch) | |
tree | 2fea0951e836c474400f4be7bde23135551bbd09 /src/apps/common/options.cpp | |
parent | e5fd3bea77fb1f02479c68e13a34e49027dad2dc (diff) |
qcam: viewfinder_qt: Draw the letterbox background black
When the widget's aspect ratio doesn't match the camera aspect ratio,
the viewfinder is rendered letter-boxed. The side rectangles are not
painted by the viewfinder, and Qt thus renders the parent widget
background to fill that space.
To make it black, we have two options:
- The simplest option is to set the widget's autoFillBackground property
to true. This causes Qt to paint the whole widget with its background
colour before calling paintEvent(). As the camera image typically
covers most (if not all) of the viewfinder widget, this is less
efficient.
- The more complicated option is to paint the letterbox rectangles
manually. We can additionally set the widget's WA_OpaquePaintEvent
attribute to instruct Qt to skip painting the parent widget. This
reduces CPU usage by about 1% (and may reduce GPU usage as well).
Note that the WA_OpaquePaintEvent attribute has to be disabled when we
render the stopped icon, as the icon has a transparent background.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/apps/common/options.cpp')
0 files changed, 0 insertions, 0 deletions