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

Switches to using the announce is_visible flag to spot line ends.

This commit is contained in:
Thomas Harte 2019-01-06 13:37:34 -05:00
parent e9d9ff0da0
commit c392c819c1
2 changed files with 43 additions and 45 deletions

View File

@ -223,15 +223,13 @@ void ScanTarget::submit() {
}
void ScanTarget::announce(Event event, bool is_visible, const Outputs::Display::ScanTarget::Scan::EndPoint &location) {
switch(event) {
default: break;
case ScanTarget::Event::BeginHorizontalRetrace:
if(active_line_) {
active_line_->end_points[1].x = location.x;
active_line_->end_points[1].y = location.y;
if(event == ScanTarget::Event::EndVerticalRetrace) {
is_first_in_frame_ = true;
frame_was_complete_ = true;
}
break;
case ScanTarget::Event::EndHorizontalRetrace: {
if(output_is_visible_ == is_visible) return;
if(is_visible) {
// Commit the most recent line only if any scans fell on it.
// Otherwise there's no point outputting it, it'll contribute nothing.
if(provided_scans_) {
@ -261,15 +259,13 @@ void ScanTarget::announce(Event event, bool is_visible, const Outputs::Display::
active_line_->end_points[0].y = location.y;
active_line_->line = write_pointers_.line;
}
} break;
case ScanTarget::Event::EndVerticalRetrace:
is_first_in_frame_ = true;
frame_was_complete_ = true;
break;
} else {
if(active_line_) {
active_line_->end_points[1].x = location.x;
active_line_->end_points[1].y = location.y;
}
// TODO: any lines that include any portion of vertical sync should be hidden.
// (maybe set a flag and zero out the line coordinates?)
}
output_is_visible_ = is_visible;
}
void ScanTarget::setup_pipeline() {

View File

@ -55,6 +55,8 @@ class ScanTarget: public Outputs::Display::ScanTarget {
void submit() override;
void announce(Event event, bool is_visible, const Outputs::Display::ScanTarget::Scan::EndPoint &location) override;
bool output_is_visible_ = false;
// Extends the definition of a Scan to include two extra fields,
// relevant to the way that this scan target processes video.
struct Scan {