diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-04 13:13:44 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-11 20:23:41 -0800 |
commit | ce32eee0999b60842c63cb7607b8bf9319242d5c (patch) | |
tree | bfe30ba3464800d2ba109c82bd67ede4b0268e71 /src/main.rs | |
parent | 23e36f19255db60084c2c240a166d137f6c12c3e (diff) | |
download | alacritty-ce32eee0999b60842c63cb7607b8bf9319242d5c.tar.gz alacritty-ce32eee0999b60842c63cb7607b8bf9319242d5c.zip |
Refactor color list management
There's now a ColorList type that provides strongly typed indexing for
not only usize but NamedColor as well. Previously, the `NamedColor` was
casted to a `usize` when indexing the colors. Additionally, only one
copy of the ColorList needs to exist;it's borrowed from the `Config`
when rendering, and the renderer doesn't need a copy.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index f25c2111..80389b2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -256,7 +256,7 @@ fn main() { let terminal = terminal.lock(); signal_flag.set(false); if terminal.dirty { - display.draw(terminal); + display.draw(terminal, &config); } if process_should_exit() { @@ -330,7 +330,7 @@ impl Display { /// A reference to Term whose state is being drawn must be provided. /// /// This call may block if vsync is enabled - pub fn draw(&mut self, mut terminal: MutexGuard<Term>) { + pub fn draw(&mut self, mut terminal: MutexGuard<Term>, config: &Config) { terminal.dirty = false; // Resize events new_size and are handled outside the poll_events @@ -360,7 +360,7 @@ impl Display { let _sampler = self.meter.sampler(); let size_info = terminal.size_info().clone(); - self.renderer.with_api(&size_info, |mut api| { + self.renderer.with_api(config, &size_info, |mut api| { api.clear(); // Draw the grid @@ -372,7 +372,7 @@ impl Display { if self.render_timer { let timing = format!("{:.3} usec", self.meter.average()); let color = alacritty::ansi::Color::Spec(Rgb { r: 0xd5, g: 0x4e, b: 0x53 }); - self.renderer.with_api(terminal.size_info(), |mut api| { + self.renderer.with_api(config, terminal.size_info(), |mut api| { api.render_string(&timing[..], glyph_cache, &color); }); } |