Separate out state for new_frame() into a local variable

This commit is contained in:
Keith Winstein
2011-02-10 20:11:17 -05:00
parent 61251bf0bf
commit 0fb343292a
2 changed files with 57 additions and 48 deletions
+12 -5
View File
@@ -4,22 +4,29 @@
#include "terminalframebuffer.hpp"
namespace Terminal {
/* variables used within a new_frame */
class FrameState {
public:
int x, y;
std::string str;
FrameState() : x(0), y(0), str() {}
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;
int x, y;
std::string str;
void put_cell( Framebuffer &f );
void put_cell( FrameState &frame, Framebuffer &f );
public:
Display( int width, int height )
: initialized( false ), last_frame( width, height ),
current_rendition_string(), cursor_x( -1 ), cursor_y( -1 ),
x( 0 ), y( 0 ), str( "" )
current_rendition_string(), cursor_x( -1 ), cursor_y( -1 )
{}
std::string new_frame( Framebuffer &f );