Skip to content
  • Aaron Plattner's avatar
    xfree86: Fix rotation of 2-color non-interleaved cursor images · ffcbfa00
    Aaron Plattner authored
    
    
    When RandR 1.2's transformation code is enabled, it rotates the cursor
    image so that it appears upright on a rotated screen.  This code
    completely mangles 2-color cursors on hardware where the the mask and
    source images are not interleaved due to two problems:
    
    1. stride is calculated as (width / 4) rather than (width / 8), so the
       expression (y * stride) skips two lines instead of one for every
       time y is incremented.
    2. cursor_bitpos ignores the 'mask' parameter if the hardware doesn't
       specify any of the HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_* flags.
    
    To fix this, refactor the code to pass the whole xf86CursorInfoPtr
    through to cursor_bitpos and compute the correct stride there based on
    the flags.  If none of the SOURCE_MASK_INTERLEAVE flags are set, use
    the total cursor size to move the 'image' variable into the mask part
    of the image before computing the desired byte pointer.
    
    Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
    Reviewed-by: default avatarRobert Morell <rmorell@nvidia.com>
    Reviewed-by: default avatarAlex Deucher <alexdeucher@gmail.com>
    Tested-by: default avatarCyril Brulebois <kibi@debian.org>
    ffcbfa00