Refactor display to be outside of terminal and add some const correctness

This commit is contained in:
Keith Winstein
2011-08-13 15:06:37 -04:00
parent 945acbca37
commit 023eb182d0
9 changed files with 123 additions and 106 deletions
+9 -13
View File
@@ -10,27 +10,23 @@ namespace Terminal {
int x, y;
std::string str;
FrameState() : x(0), y(0), str() {}
int cursor_x, cursor_y;
std::string current_rendition_string;
Framebuffer last_frame;
FrameState( const Framebuffer &s_last ) : x(0), y(0), str(), cursor_x(0), cursor_y(0), current_rendition_string(), last_frame( s_last ) {}
void append( std::string s ) { str.append( s ); }
};
class Display {
private:
bool initialized;
Framebuffer last_frame;
std::string current_rendition_string;
int cursor_x, cursor_y;
void put_cell( FrameState &frame, Framebuffer &f );
void put_cell( bool initialized, FrameState &frame, const Framebuffer &f );
public:
Display( int width, int height )
: initialized( false ), last_frame( width, height ),
current_rendition_string(), cursor_x( -1 ), cursor_y( -1 )
{}
Display() {}
std::string new_frame( Framebuffer &f );
void invalidate( void ) { initialized = false; }
std::string new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f );
};
}