Here's patch which changes SurfaceGDI::DrawRGBAImage to round the rectangle corners instead of truncating them to improve alignment. Does not apply to SurfaceD2D::DrawRGBAImage because it doesn't truncate.
https://patch-diff.githubusercontent.com/raw/jrsoftware/scintilla/pull/4.diff
https://patch-diff.githubusercontent.com/raw/jrsoftware/scintilla/pull/4.patch
https://github.com/jrsoftware/scintilla/pull/4/files
An image of before and after could help motivate this change.
It may be better to change alignment in the caller where there is more context. Calling
round
on the width and height should have no impact and these expressions could be replaced withwidth
andheight
so it's just the top-left point that may be aligned.Its likely the only caller of interest is
LineMarker::Draw
as other calls use bitmaps that should already match their destinations. Has a bitmap scale been set withSCI_RGBAIMAGESETSCALE
?Thanks for looking into it.
Attached is a before (top) and after (bottom) image.
The caller is LineMarker::Draw indeed. There's no SCI_RGBAIMAGESETSCALE call.
The bitmap sizes are 12x12. In LineMarker::Draw the height of rcWhole is 17 (using Consolas 10pt). This gives top and bottom values in SurfaceGDI::DrawRGBAImage of "half-integer" values like 0.5, 1.5, etc.
Last edit: Martijn Laan 2024-06-22
While the changed position suits your design, I do not think that it will be better with all font and image choices. Perhaps not even a majority. This may worsen the appearance of other applications which may have tweaked their images to work well.
It is possible to achieve your preferred outcome with the current implementation, possibly by editing the images, but definitely in code. For example, a transparent line of pixels could be added at the top of each image for odd line heights. The image format is very simple and can be manipulated easily.
With the possibility of worsening the appearance of applications, this change shouldn't be committed.
Ok, I understand and should have thought of backward compatibility myself, sorry.