mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-11 04:20:31 -06:00
AtlasEngine: Curly line redux (#17508)
See #17501. (cherry picked from commit 7f2249c810ca7df219b3189b728c05b83649ffff) Service-Card-Id: 92942980 Service-Version: 1.21
This commit is contained in:
parent
09aa541d56
commit
5a99621856
@ -658,24 +658,14 @@ void BackendD2D::_drawGridlineRow(const RenderingPayload& p, const ShapedRow* ro
|
||||
// it being simple to implement and robust against more peculiar fonts with unusually large/small descenders, etc.
|
||||
// We still need to ensure though that it doesn't clip out of the cellHeight at the bottom, which is why `position` has a min().
|
||||
const auto height = std::max(3.0f, duBottom + duHeight - duTop);
|
||||
const auto position = std::min(duTop, cellHeight - height - duHeight);
|
||||
const auto position = std::min(duTop, cellHeight - height);
|
||||
|
||||
// The amplitude of the wave needs to account for the stroke width, so that the final height including
|
||||
// antialiasing isn't larger than our target `height`. That's why we calculate `(height - duHeight)`.
|
||||
//
|
||||
// In other words, Direct2D draws strokes centered on the path. This also means that (for instance)
|
||||
// for a line width of 1px, we need to ensure that the amplitude passes through the center of a pixel.
|
||||
// Because once the path gets stroked, it'll occupy half a pixel on either side of the path.
|
||||
// This results in a "crisp" look. That's why we do `round(amp + half) - half`.
|
||||
const auto halfLineWidth = 0.5f * duHeight;
|
||||
const auto amplitude = roundf((height - duHeight) * 0.5f + halfLineWidth) - halfLineWidth;
|
||||
// While the amplitude needs to account for the stroke width, the vertical center of the wave needs
|
||||
// to be at an integer pixel position of course. Otherwise, the wave won't be vertically symmetric.
|
||||
const auto center = cellCenter + position + amplitude + halfLineWidth;
|
||||
|
||||
const auto top = center - 2.0f * amplitude;
|
||||
const auto bottom = center + 2.0f * amplitude;
|
||||
const auto step = 0.5f * height;
|
||||
const auto center = cellCenter + position + 0.5f * height;
|
||||
const auto top = center - (height - duHeight);
|
||||
const auto bottom = center + (height - duHeight);
|
||||
const auto step = roundf(0.5f * height);
|
||||
const auto period = 4.0f * step;
|
||||
|
||||
const auto from = r.from * scaledCellWidth;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user