Skip to content

Commit

Permalink
Fix prelude/imports
Browse files Browse the repository at this point in the history
  • Loading branch information
emmabritton committed Dec 24, 2023
1 parent 4ec775f commit 87670a6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### Version 0.12.6
- Fix prelude/imports
- Fix crash from offscreen drawing

### Version 0.12.5
- Update shapes lib

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "buffer-graphics-lib"
version = "0.12.5"
version = "0.12.6"
edition = "2021"
authors = ["Emma Britton <emmabritton@pm.me>"]
description = "Simple graphics library for buffers"
Expand All @@ -18,7 +18,7 @@ ici = ["ici-files"]

[dependencies]
thiserror = "1.0.51"
graphics-shapes = "0.2.5"
graphics-shapes = {path="../graphics-shapes"}# "0.2.5"
serde = { version = "1.0.193", features = ["derive"], optional = true }
image = { version = "0.24.7", optional = true }
log = "0.4.20"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The `Graphics` struct needs a mutable slice to work on and so mostly likely you'

In your `Cargo.toml` file add
```toml
buffer-graphics-lib = "0.12.5"
buffer-graphics-lib = "0.12.6"
```

### Code
Expand Down
24 changes: 12 additions & 12 deletions src/drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
xy.x + x as isize,
xy.y + y,
Color {
Expand Down Expand Up @@ -182,7 +182,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x as isize + xy.x,
y as isize + xy.y,
color.to_color(),
Expand All @@ -207,7 +207,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x as isize + xy.x,
y as isize + xy.y,
color.to_color(),
Expand All @@ -231,7 +231,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
px.x,
px.y,
color,
Expand Down Expand Up @@ -264,7 +264,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
start.x,
y,
color,
Expand All @@ -276,7 +276,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x,
start.y,
color,
Expand All @@ -302,7 +302,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x,
y,
color,
Expand All @@ -323,7 +323,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x,
y,
color,
Expand Down Expand Up @@ -439,7 +439,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x as isize + pos.0,
y as isize + pos.1,
color,
Expand Down Expand Up @@ -523,7 +523,7 @@ impl Graphics<'_> {
self.buffer,
&self.translate,
&self.clip,
self.width,
(self.width, self.height),
x,
y,
color,
Expand All @@ -538,15 +538,15 @@ fn update_pixel(
buffer: &mut [u8],
translate: &Coord,
clip: &Clip,
width: usize,
(width, height): (usize, usize),
x: isize,
y: isize,
color: Color,
) {
let x = x + translate.x;
let y = y + translate.y;
let idx = ((x + y * width as isize) * 4) as usize;
if x >= 0 && y >= 0 && x < width as isize && clip.is_valid((x, y)) {
if x >= 0 && y >= 0 && x < width as isize && y < height as isize && clip.is_valid((x, y)) {
match color.a {
255 => set_pixel(buffer, idx, color),
0 => {}
Expand Down

0 comments on commit 87670a6

Please sign in to comment.