obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

win-capture: Invert destination pixels when drawing monochrome cursors

Open caesay opened this issue 3 years ago • 2 comments

Issue / Motivation

Currently all monochrome cursors are always rendered all-black, meaning they are invisible on dark backgrounds (see #6794).

Description

This updates the blend mode from GS_BLEND_SRCALPHA to GS_BLEND_INVDSTCOLOR when drawing monochrome cursors, so they are visible on both light and dark backgrounds.

The following monochrome cursor rendering requirements are complete:

  • [x] A pixel that is black in both the top and bottom half will always be black in the final image.
  • [x] A pixel that is black in the top and white in the bottom will always be white in the final image.
  • [x] A pixel that is white in the top and white in the bottom will invert (XOR) the colour underneath it.
  • [x] A pixel that is white in the top and black in the bottom is a no-op.

How Has This Been Tested?

Tested on Windows 10 x64 with all of the baked-in Windows cursors. All color cursors remain unchanged, monochrome cursors (such as the I-Beam and Crosshair) are now rendered inverted instead of black. This should have no impact on any other areas of the code.

Types of changes

Bug Fix

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

caesay avatar Aug 08 '22 17:08 caesay

This potentially fixes/closes the following issues: #6794 #3129.

caesay avatar Aug 10 '22 16:08 caesay

Squashed two commits together and rebased to 1a7e5babc2033200381a208d3c90e51a309178fe

caesay avatar Sep 16 '22 10:09 caesay

I have made the requested changes and rebased to release/28.1.

caesay avatar Oct 15 '22 13:10 caesay

I have made the requested changes and rebased to release/28.1.

Always rebase to master when targeting the master branch. While the branches may sometimes be in sync, this is not always the case and is never guaranteed.

RytoEX avatar Oct 15 '22 19:10 RytoEX