Make Terminal::Renditions smaller, and its members private.

This commit is contained in:
John Hood
2017-10-29 13:46:59 -04:00
parent 0ec85b508e
commit cf493da7b4
2 changed files with 12 additions and 9 deletions
+4 -4
View File
@@ -202,8 +202,8 @@ void NotificationEngine::apply( Framebuffer &fb ) const
/* draw bar across top of screen */ /* draw bar across top of screen */
Cell notification_bar( 0 ); Cell notification_bar( 0 );
notification_bar.get_renditions().foreground_color = 37; notification_bar.get_renditions().set_foreground_color( 37 );
notification_bar.get_renditions().background_color = 44; notification_bar.get_renditions().set_background_color( 44 );
notification_bar.append( 0x20 ); notification_bar.append( 0x20 );
for ( int i = 0; i < fb.ds.get_width(); i++ ) { for ( int i = 0; i < fb.ds.get_width(); i++ ) {
@@ -273,8 +273,8 @@ void NotificationEngine::apply( Framebuffer &fb ) const
this_cell = fb.get_mutable_cell( 0, overlay_col ); this_cell = fb.get_mutable_cell( 0, overlay_col );
fb.reset_cell( this_cell ); fb.reset_cell( this_cell );
this_cell->get_renditions().set_attribute(Renditions::bold, true); this_cell->get_renditions().set_attribute(Renditions::bold, true);
this_cell->get_renditions().foreground_color = 37; this_cell->get_renditions().set_foreground_color( 37 );
this_cell->get_renditions().background_color = 44; this_cell->get_renditions().set_background_color( 44 );
this_cell->append( ch ); this_cell->append( ch );
this_cell->set_wide( chwidth == 2 ); this_cell->set_wide( chwidth == 2 );
+8 -5
View File
@@ -55,11 +55,11 @@ namespace Terminal {
public: public:
typedef enum { bold, faint, italic, underlined, blink, inverse, invisible, SIZE } attribute_type; typedef enum { bold, faint, italic, underlined, blink, inverse, invisible, SIZE } attribute_type;
static const unsigned int true_color_mask = 0x80000000;
unsigned int foreground_color;
unsigned int background_color;
private: private:
unsigned int attributes : 8; static const uint64_t true_color_mask = 0x1000000;
uint64_t foreground_color : 25;
uint64_t background_color : 25;
uint64_t attributes : 8;
public: public:
Renditions( color_type s_background ); Renditions( color_type s_background );
@@ -76,6 +76,9 @@ namespace Terminal {
return (color & true_color_mask) != 0; return (color & true_color_mask) != 0;
} }
unsigned int get_foreground_color() const { return foreground_color; }
unsigned int get_background_color() const { return background_color; }
bool operator==( const Renditions &x ) const bool operator==( const Renditions &x ) const
{ {
return ( attributes == x.attributes ) return ( attributes == x.attributes )
@@ -332,7 +335,7 @@ namespace Terminal {
void add_rendition( color_type x ) { renditions.set_rendition( x ); } void add_rendition( color_type x ) { renditions.set_rendition( x ); }
const Renditions& get_renditions( void ) const { return renditions; } const Renditions& get_renditions( void ) const { return renditions; }
Renditions& get_renditions( void ) { return renditions; } Renditions& get_renditions( void ) { return renditions; }
int get_background_rendition( void ) const { return renditions.background_color; } int get_background_rendition( void ) const { return renditions.get_background_color(); }
void save_cursor( void ); void save_cursor( void );
void restore_cursor( void ); void restore_cursor( void );