1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-29 20:31:46 +00:00

Handle runs that don't cross a pixel boundary.

`
This commit is contained in:
Thomas Harte 2024-10-15 21:15:30 -04:00
parent b6fff521e4
commit 02f92a7818

View File

@ -43,9 +43,6 @@ struct ScanTarget: public Outputs::Display::ScanTarget {
const int src_pixels = scan_.end_points[1].data_offset - scan_.end_points[0].data_offset;
const int dst_pixels = (scan_.end_points[1].x - scan_.end_points[0].x) / WidthDivider;
const int step = (src_pixels << 16) / dst_pixels;
int position = 0;
const auto x1 = scan_.end_points[0].x / WidthDivider;
const auto x2 = scan_.end_points[1].x / WidthDivider;
@ -53,9 +50,15 @@ struct ScanTarget: public Outputs::Display::ScanTarget {
if(x_ < x1) {
std::fill(&line[x_], &line[x1], 0);
}
for(int x = x1; x < x2; x++) {
line[x] = data_[position >> 16];
position += step;
if(x2 != x1) {
const int step = (src_pixels << 16) / dst_pixels;
int position = 0;
for(int x = x1; x < x2; x++) {
line[x] = data_[position >> 16];
position += step;
}
}
x_ = x2;
}