1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Blank out border.

This commit is contained in:
Thomas Harte 2024-08-05 22:06:23 -04:00
parent 1977675a73
commit 05f0a122f4

View File

@ -46,15 +46,37 @@ struct ScanTarget: public Outputs::Display::ScanTarget {
const int step = (src_pixels << 16) / dst_pixels; const int step = (src_pixels << 16) / dst_pixels;
int position = 0; int position = 0;
for(int x = scan_.end_points[0].x / WidthDivider; x < scan_.end_points[1].x / WidthDivider; x++) { const auto x1 = scan_.end_points[0].x / WidthDivider;
raw_image_[line_ * ImageWidth + x] = data_[position >> 16]; const auto x2 = scan_.end_points[1].x / WidthDivider;
uint8_t *const line = &raw_image_[line_ * ImageWidth];
if(x_ < x1) {
std::fill(&line[x_], &line[x1], 0);
}
for(int x = x1; x < x2; x++) {
line[x] = data_[position >> 16];
position += step; position += step;
} }
x_ = x2;
} }
void announce(Event event, bool, const Scan::EndPoint &, uint8_t) override { void announce(Event event, bool, const Scan::EndPoint &, uint8_t) override {
switch(event) { switch(event) {
case Event::EndHorizontalRetrace: ++line_; break; case Event::EndHorizontalRetrace: {
case Event::EndVerticalRetrace: line_ = 0; break; if(line_ == ImageHeight - 1) break;
if(x_ < ImageWidth) {
uint8_t *const line = &raw_image_[line_ * ImageWidth];
std::fill(&line[x_], &line[ImageWidth], 0);
}
++line_;
x_ = 0;
} break;
case Event::EndVerticalRetrace:
std::fill(&raw_image_[line_ * ImageWidth], &raw_image_[ImageHeight * ImageWidth], 0);
line_ = 0;
x_ = 0;
break;
default: break; default: break;
} }
} }
@ -90,6 +112,7 @@ private:
Scan scan_; Scan scan_;
std::array<uint8_t, 2048> data_; std::array<uint8_t, 2048> data_;
int line_ = 0; int line_ = 0;
int x_ = 0;
static constexpr int ImageWidth = 914; static constexpr int ImageWidth = 914;
static constexpr int ImageHeight = 312; static constexpr int ImageHeight = 312;