diff --git a/textium/src/texture.rs b/textium/src/texture.rs index 8271c72..8ede56d 100644 --- a/textium/src/texture.rs +++ b/textium/src/texture.rs @@ -30,6 +30,22 @@ pub trait Buffer2d: Sized { } } } + + fn patch_rotated(&mut self, x: usize, y: usize, buf: &B) + where B: Buffer2d + { + let (w, h) = buf.dimensions(); + + // TODO: can this be optimized by performing an unsafe memcpy of some sort? + for sy in 0..h { + for sx in 0..w { + match buf.get(sx, sy) { + Some(v) => self.set(x+h-sy-1, y+sy, v), + _ => (), + } + } + } + } } pub trait ResizeableBuffer2d: Buffer2d {