summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--Cargo.toml2
-rw-r--r--source/benoit/benoit.rs2
-rw-r--r--source/benoit/benoit/colour_data.rs18
-rw-r--r--source/benoit/benoit/image.rs5
-rw-r--r--source/benoit/benoit/image/colour.rs4
-rw-r--r--source/benoit/benoit/script/still.rs5
7 files changed, 13 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a04efc..61fa717 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 2.7.1
+
+* Improve info logs
+* Enumerate iterators
+
# 2.7.0
* Bump minor version
diff --git a/Cargo.toml b/Cargo.toml
index 359cdb9..c1d848d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "benoit"
-version = "2.7.0"
+version = "2.7.1"
authors = ["Gabriel Bjørnager Jensen"]
edition = "2021"
description = "Multithreaded Mandelbrot renderer with support for PNG and WebP encoding."
diff --git a/source/benoit/benoit.rs b/source/benoit/benoit.rs
index 549e25a..55a1e44 100644
--- a/source/benoit/benoit.rs
+++ b/source/benoit/benoit.rs
@@ -37,7 +37,7 @@ pub mod video;
pub const VERSION: (u32, u32, u32) = (
0x2, // Major
0x7, // Minor
- 0x0, // Patch
+ 0x1, // Patch
);
pub const PRECISION: u32 = 0x80;
diff --git a/source/benoit/benoit/colour_data.rs b/source/benoit/benoit/colour_data.rs
index 4f8dac4..2c36672 100644
--- a/source/benoit/benoit/colour_data.rs
+++ b/source/benoit/benoit/colour_data.rs
@@ -21,27 +21,19 @@
If not, see <https://www.gnu.org/licenses/>.
*/
-use crate::benoit::image::Image;
use crate::benoit::palette::PaletteData;
-use std::mem::size_of;
-use std::num::NonZeroUsize;
-use std::ptr::addr_of;
-
pub struct ColourData {
exponent: f32,
max_iter_count: u32,
colour_range: f32,
palette_data: &'static PaletteData,
-
- image: NonZeroUsize,
}
impl ColourData {
#[must_use]
pub fn new(
- image: &Image,
exponent: f32,
max_iter_count: u32,
colour_range: f32,
@@ -53,20 +45,10 @@ impl ColourData {
colour_range: colour_range,
palette_data: palette_data,
-
- image: NonZeroUsize::new(image.data().as_ptr() as usize).unwrap(),
};
}
#[must_use]
- pub fn index(&self, element: &(u8, u8, u8)) -> usize {
- let element_addr = addr_of!(*element) as usize;
-
- let index = (element_addr - self.image.get()) / size_of::<(u8, u8, u8)>();
- return index;
- }
-
- #[must_use]
pub fn consts(&self) -> (f32, u32, f32, &'static PaletteData) {
return (self.exponent, self.max_iter_count, self.colour_range, self.palette_data);
}
diff --git a/source/benoit/benoit/image.rs b/source/benoit/benoit/image.rs
index 4b9396f..6d43d7a 100644
--- a/source/benoit/benoit/image.rs
+++ b/source/benoit/benoit/image.rs
@@ -49,11 +49,6 @@ impl Image {
}
#[must_use]
- pub fn data<'a>(&'a self) -> &'a [(u8, u8, u8)] {
- return &self.data[..];
- }
-
- #[must_use]
pub fn raw<'a>(&'a self) -> &'a [u8] {
let data_pointer = self.data.as_ptr() as *const u8;
diff --git a/source/benoit/benoit/image/colour.rs b/source/benoit/benoit/image/colour.rs
index 9349662..3c3562e 100644
--- a/source/benoit/benoit/image/colour.rs
+++ b/source/benoit/benoit/image/colour.rs
@@ -44,15 +44,13 @@ impl Image {
};
let data = ColourData::new(
- self,
fractal.exponent(),
max_iter_count.min(new_max_iter_count),
colour_range,
palette.data(),
);
- self.data.par_iter_mut().for_each(|point| {
- let index = data.index(point);
+ self.data.par_iter_mut().enumerate().for_each(|(index, point)| {
let (iter_count, dist) = render[index];
*point = colour_point(&data, iter_count, dist);
diff --git a/source/benoit/benoit/script/still.rs b/source/benoit/benoit/script/still.rs
index ee93b65..65177d9 100644
--- a/source/benoit/benoit/script/still.rs
+++ b/source/benoit/benoit/script/still.rs
@@ -28,6 +28,9 @@ use crate::benoit::script::Script;
impl Script {
#[must_use]
pub(super) fn still(&self) -> Result<(), String> {
+ let frame_count = self.stop.frame - self.start.frame + 0x1;
+ assert!(frame_count == 0x1);
+
let mut render = Render::allocate(self.canvas_width, self.canvas_height)?;
let mut image = Image::allocate( self.canvas_width, self.canvas_height)?;
@@ -35,6 +38,8 @@ impl Script {
eprintln!("");
eprintln!("rendering still: the {}", self.fractal.name());
+ eprintln!(" width: {}", self.canvas_width);
+ eprintln!(" height: {}", self.canvas_height);
eprintln!(" re(c): {}", self.stop.centre.real);
eprintln!(" im(c): {}", self.stop.centre.imag);
eprintln!(" re(w): {}", self.stop.extra.real);