summaryrefslogtreecommitdiff
path: root/platforms/tortuise-script-compiled/src/buffer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/tortuise-script-compiled/src/buffer.rs')
-rw-r--r--platforms/tortuise-script-compiled/src/buffer.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/platforms/tortuise-script-compiled/src/buffer.rs b/platforms/tortuise-script-compiled/src/buffer.rs
index c60ee40..ce3a693 100644
--- a/platforms/tortuise-script-compiled/src/buffer.rs
+++ b/platforms/tortuise-script-compiled/src/buffer.rs
@@ -262,6 +262,7 @@ impl From<Attributes> for crossterm::style::Attributes {
impl ScriptContext<'_> {
pub fn add_cell(&mut self, cell: Cell) {
+ #[cfg(feature = "profiling")]
puffin::profile_function!();
self.0
.operation_queue
@@ -279,7 +280,47 @@ impl ScriptContext<'_> {
}));
}
+ pub fn add_eternal_cell(&mut self, cell: Cell) {
+ #[cfg(feature = "profiling")]
+ puffin::profile_function!();
+ log::info!("Add eternal cell");
+ self.0
+ .operation_queue
+ .push(Operation::AddEternalCell(tortuise::buffer::Cell {
+ character: cell.character,
+ style: ContentStyle {
+ foreground_color: Some(cell.foreground_color.into()),
+ background_color: Some(cell.background_color.into()),
+ underline_color: Some(cell.underline_color.into()),
+ attributes: cell.attributes.into(),
+ },
+ x: cell.x,
+ y: cell.y,
+ z: cell.z,
+ }));
+ }
+
+ pub fn remove_eternal_cell(&mut self, cell: Cell) {
+ #[cfg(feature = "profiling")]
+ puffin::profile_function!();
+ self.0
+ .operation_queue
+ .push(Operation::RemoveEternalCell(tortuise::buffer::Cell {
+ character: cell.character,
+ style: ContentStyle {
+ foreground_color: Some(cell.foreground_color.into()),
+ background_color: Some(cell.background_color.into()),
+ underline_color: Some(cell.underline_color.into()),
+ attributes: cell.attributes.into(),
+ },
+ x: cell.x,
+ y: cell.y,
+ z: cell.z,
+ }));
+ }
+
pub fn window_size(&self) -> WindowSize {
+ #[cfg(feature = "profiling")]
puffin::profile_function!();
let size = &self.0.buffer.window_size;
WindowSize {
@@ -289,6 +330,7 @@ impl ScriptContext<'_> {
}
pub fn set_framerate_limit(&mut self, limit: Option<u32>) {
+ #[cfg(feature = "profiling")]
puffin::profile_function!();
let limit = limit.map(|limit| Duration::from_nanos(1_000_000_000 / limit as u64));
self.0.operation_queue.push(Operation::SetFrameLimit(limit));