1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +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) { void ScanTarget::announce(Event event, bool is_visible, const Outputs::Display::ScanTarget::Scan::EndPoint &location) {
switch(event) { if(event == ScanTarget::Event::EndVerticalRetrace) {
default: break; is_first_in_frame_ = true;
case ScanTarget::Event::BeginHorizontalRetrace: frame_was_complete_ = true;
if(active_line_) {
active_line_->end_points[1].x = location.x;
active_line_->end_points[1].y = location.y;
} }
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. // Commit the most recent line only if any scans fell on it.
// Otherwise there's no point outputting it, it'll contribute nothing. // Otherwise there's no point outputting it, it'll contribute nothing.
if(provided_scans_) { 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_->end_points[0].y = location.y;
active_line_->line = write_pointers_.line; active_line_->line = write_pointers_.line;
} }
} break; } else {
case ScanTarget::Event::EndVerticalRetrace: if(active_line_) {
is_first_in_frame_ = true; active_line_->end_points[1].x = location.x;
frame_was_complete_ = true; active_line_->end_points[1].y = location.y;
break;
} }
}
// TODO: any lines that include any portion of vertical sync should be hidden. output_is_visible_ = is_visible;
// (maybe set a flag and zero out the line coordinates?)
} }
void ScanTarget::setup_pipeline() { void ScanTarget::setup_pipeline() {

View File

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