Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1b477d2731
|
@ -1,7 +1,6 @@
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||||
|
|
||||||
use libretrogd::Bitmap;
|
use libretrogd::graphics::*;
|
||||||
use libretrogd::Palette;
|
|
||||||
use libretrogd::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
use libretrogd::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
||||||
|
|
||||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
|
|
|
@ -2,7 +2,8 @@ use std::path::Path;
|
||||||
|
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||||
|
|
||||||
use libretrogd::{Bitmap, BlitMethod, Rect};
|
use libretrogd::graphics::*;
|
||||||
|
use libretrogd::math::*;
|
||||||
|
|
||||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
let mut framebuffer = Bitmap::new(320, 240).unwrap();
|
let mut framebuffer = Bitmap::new(320, 240).unwrap();
|
||||||
|
@ -13,6 +14,8 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
let mut trans_bmp = Bitmap::new(16, 16).unwrap();
|
let mut trans_bmp = Bitmap::new(16, 16).unwrap();
|
||||||
trans_bmp.blit_region(BlitMethod::Solid, &bmp, &Rect::new(160, 0, 16, 16), 0, 0);
|
trans_bmp.blit_region(BlitMethod::Solid, &bmp, &Rect::new(160, 0, 16, 16), 0, 0);
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
c.bench_function("blit_single_checked_solid", |b| {
|
c.bench_function("blit_single_checked_solid", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
framebuffer.blit(
|
framebuffer.blit(
|
||||||
|
@ -35,6 +38,8 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
c.bench_function("blit_single_checked_transparent", |b| {
|
c.bench_function("blit_single_checked_transparent", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
framebuffer.blit(
|
framebuffer.blit(
|
||||||
|
@ -56,6 +61,438 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_flipped_not_flipped", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlipped {
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: false
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_flipped_horizontally", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlipped {
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: false
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_flipped_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlipped {
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: true
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_flipped_horizontally_and_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlipped {
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: true
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_flipped_not_flipped", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlipped {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: false
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_flipped_horizontally", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlipped {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: false
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_flipped_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlipped {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: true
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_flipped_horizontally_and_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlipped {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: true
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_single_flipped_not_flipped", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedSingle {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: false,
|
||||||
|
draw_color: 17,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_single_flipped_horizontally", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedSingle {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: false,
|
||||||
|
draw_color: 17,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_single_flipped_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedSingle {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: true,
|
||||||
|
draw_color: 17,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_single_flipped_horizontally_and_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedSingle {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: true,
|
||||||
|
draw_color: 17,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_single", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentSingle {
|
||||||
|
transparent_color: 0,
|
||||||
|
draw_color: 17,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_offset", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentOffset {
|
||||||
|
transparent_color: 0,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_offset_flipped_not_flipped", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedOffset {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: false,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_offset_flipped_horizontally", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedOffset {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: false,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_offset_flipped_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedOffset {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: true,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_transparent_offset_flipped_horizontally_and_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::TransparentFlippedOffset {
|
||||||
|
transparent_color: 0,
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: true,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_offset", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidOffset(42)),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_offset_flipped_not_flipped", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlippedOffset {
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: false,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_offset_flipped_horizontally", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlippedOffset {
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: false,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_offset_flipped_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlippedOffset {
|
||||||
|
horizontal_flip: false,
|
||||||
|
vertical_flip: true,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
c.bench_function("blit_solid_offset_flipped_horizontally_and_vertically", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::SolidFlippedOffset {
|
||||||
|
horizontal_flip: true,
|
||||||
|
vertical_flip: true,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_rotozoom", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::RotoZoom {
|
||||||
|
angle: 73.0f32.to_radians(),
|
||||||
|
scale_x: 1.2,
|
||||||
|
scale_y: 0.8,
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_rotozoom_offset", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::RotoZoomOffset {
|
||||||
|
angle: 73.0f32.to_radians(),
|
||||||
|
scale_x: 1.2,
|
||||||
|
scale_y: 0.8,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&solid_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_rotozoom_transparent", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::RotoZoomTransparent {
|
||||||
|
angle: 73.0f32.to_radians(),
|
||||||
|
scale_x: 1.2,
|
||||||
|
scale_y: 0.8,
|
||||||
|
transparent_color: 0,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//////
|
||||||
|
|
||||||
|
c.bench_function("blit_rotozoom_offset_transparent", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
framebuffer.blit(
|
||||||
|
black_box(BlitMethod::RotoZoomTransparentOffset {
|
||||||
|
angle: 73.0f32.to_radians(),
|
||||||
|
scale_x: 1.2,
|
||||||
|
scale_y: 0.8,
|
||||||
|
transparent_color: 0,
|
||||||
|
offset: 42,
|
||||||
|
}),
|
||||||
|
black_box(&trans_bmp),
|
||||||
|
black_box(100),
|
||||||
|
black_box(100),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
criterion_group!(benches, criterion_benchmark);
|
criterion_group!(benches, criterion_benchmark);
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub enum AudioBufferError {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Holds audio sample data that can be played via [`AudioDevice`].
|
/// Holds audio sample data that can be played via [`AudioDevice`].
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct AudioBuffer {
|
pub struct AudioBuffer {
|
||||||
spec: AudioSpec,
|
spec: AudioSpec,
|
||||||
pub data: Vec<u8>,
|
pub data: Vec<u8>,
|
||||||
|
|
|
@ -651,7 +651,9 @@ impl Bitmap {
|
||||||
// rotozoom blits internally clip per-pixel right now ... and regardless, the normal
|
// rotozoom blits internally clip per-pixel right now ... and regardless, the normal
|
||||||
// clip_blit() function wouldn't handle a rotozoom blit destination region anyway ...
|
// clip_blit() function wouldn't handle a rotozoom blit destination region anyway ...
|
||||||
RotoZoom { .. } => {}
|
RotoZoom { .. } => {}
|
||||||
|
RotoZoomOffset { .. } => {}
|
||||||
RotoZoomTransparent { .. } => {}
|
RotoZoomTransparent { .. } => {}
|
||||||
|
RotoZoomTransparentOffset { .. } => {}
|
||||||
|
|
||||||
// set axis flip arguments
|
// set axis flip arguments
|
||||||
SolidFlipped { horizontal_flip, vertical_flip, .. } |
|
SolidFlipped { horizontal_flip, vertical_flip, .. } |
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub enum BitmapError {
|
||||||
/// one row to the next is always exactly equal to the bitmap width. Rendering operations provided
|
/// one row to the next is always exactly equal to the bitmap width. Rendering operations provided
|
||||||
/// here are done with respect to the bitmaps clipping region, where rendering outside of the
|
/// here are done with respect to the bitmaps clipping region, where rendering outside of the
|
||||||
/// clipping region is simply not performed / stops at the clipping boundary.
|
/// clipping region is simply not performed / stops at the clipping boundary.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct Bitmap {
|
pub struct Bitmap {
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub enum BitmapAtlasError {
|
||||||
OutOfBounds,
|
OutOfBounds,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct BitmapAtlas {
|
pub struct BitmapAtlas {
|
||||||
bitmap: Bitmap,
|
bitmap: Bitmap,
|
||||||
bounds: Rect,
|
bounds: Rect,
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub trait Font {
|
||||||
fn measure(&self, text: &str, opts: FontRenderOpts) -> (u32, u32);
|
fn measure(&self, text: &str, opts: FontRenderOpts) -> (u32, u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct BitmaskCharacter {
|
pub struct BitmaskCharacter {
|
||||||
bytes: [u8; CHAR_HEIGHT],
|
bytes: [u8; CHAR_HEIGHT],
|
||||||
bounds: Rect,
|
bounds: Rect,
|
||||||
|
@ -83,7 +83,7 @@ impl Character for BitmaskCharacter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct BitmaskFont {
|
pub struct BitmaskFont {
|
||||||
characters: Box<[BitmaskCharacter]>,
|
characters: Box<[BitmaskCharacter]>,
|
||||||
line_height: u8,
|
line_height: u8,
|
||||||
|
|
|
@ -224,7 +224,7 @@ pub enum PaletteFormat {
|
||||||
|
|
||||||
/// Contains a 256 color palette, and provides methods useful for working with palettes. The
|
/// Contains a 256 color palette, and provides methods useful for working with palettes. The
|
||||||
/// colors are all stored individually as 32-bit packed values in the format 0xAARRGGBB.
|
/// colors are all stored individually as 32-bit packed values in the format 0xAARRGGBB.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct Palette {
|
pub struct Palette {
|
||||||
colors: [u32; NUM_COLORS],
|
colors: [u32; NUM_COLORS],
|
||||||
}
|
}
|
||||||
|
@ -530,13 +530,6 @@ impl IndexMut<u8> for Palette {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for Palette {
|
|
||||||
#[inline]
|
|
||||||
fn eq(&self, other: &Self) -> bool {
|
|
||||||
self.colors == other.colors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::ops::{Mul, MulAssign};
|
||||||
use crate::math::*;
|
use crate::math::*;
|
||||||
|
|
||||||
/// Represents a 3x3 column-major matrix and provides common methods for matrix math.
|
/// Represents a 3x3 column-major matrix and provides common methods for matrix math.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||||
pub struct Matrix3x3 {
|
pub struct Matrix3x3 {
|
||||||
pub m: [f32; 9],
|
pub m: [f32; 9],
|
||||||
}
|
}
|
||||||
|
|
BIN
libretrogd/test-assets/chunky.fnt
Normal file
BIN
libretrogd/test-assets/chunky.fnt
Normal file
Binary file not shown.
1235
libretrogd/tests/graphics.rs
Normal file
1235
libretrogd/tests/graphics.rs
Normal file
File diff suppressed because it is too large
Load diff
BIN
libretrogd/tests/ref/circle_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/circle_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/filled_circle_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/filled_circle_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/filled_rect_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/filled_rect_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/horiz_line_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/horiz_line_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/line_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/line_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/pixel_addressing.pcx
Normal file
BIN
libretrogd/tests/ref/pixel_addressing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/pixel_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/pixel_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/rect_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/rect_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/rotozoom_blits.pcx
Normal file
BIN
libretrogd/tests/ref/rotozoom_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/rotozoom_offset_blits.pcx
Normal file
BIN
libretrogd/tests/ref/rotozoom_offset_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/rotozoom_transparent_blits.pcx
Normal file
BIN
libretrogd/tests/ref/rotozoom_transparent_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/rotozoom_transparent_offset_blits.pcx
Normal file
BIN
libretrogd/tests/ref/rotozoom_transparent_offset_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/solid_blits.pcx
Normal file
BIN
libretrogd/tests/ref/solid_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/solid_flipped_blits.pcx
Normal file
BIN
libretrogd/tests/ref/solid_flipped_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/solid_flipped_offset_blits.pcx
Normal file
BIN
libretrogd/tests/ref/solid_flipped_offset_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/solid_offset_blits.pcx
Normal file
BIN
libretrogd/tests/ref/solid_offset_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/text_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/text_drawing.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/transparent_blits.pcx
Normal file
BIN
libretrogd/tests/ref/transparent_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/transparent_flipped_blits.pcx
Normal file
BIN
libretrogd/tests/ref/transparent_flipped_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/transparent_flipped_offset_blits.pcx
Normal file
BIN
libretrogd/tests/ref/transparent_flipped_offset_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/transparent_flipped_single_blits.pcx
Normal file
BIN
libretrogd/tests/ref/transparent_flipped_single_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/transparent_offset_blits.pcx
Normal file
BIN
libretrogd/tests/ref/transparent_offset_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/transparent_single_blits.pcx
Normal file
BIN
libretrogd/tests/ref/transparent_single_blits.pcx
Normal file
Binary file not shown.
BIN
libretrogd/tests/ref/vert_line_drawing.pcx
Normal file
BIN
libretrogd/tests/ref/vert_line_drawing.pcx
Normal file
Binary file not shown.
Loading…
Reference in a new issue