1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-03-24 02:49:21 +00:00

allow setting custom pixel format on Canvas

This commit is contained in:
Alula 2020-10-30 00:37:50 +01:00
parent b8d3919f09
commit eb94343df3
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA

View file

@ -40,12 +40,22 @@ where
pub type Canvas = CanvasGeneric<GlBackendSpec>;
impl Canvas {
/// Create a new `Canvas` with the given size and number of samples.
pub fn new(
ctx: &mut Context,
width: u16,
height: u16,
samples: conf::NumSamples,
) -> GameResult<Canvas> {
Canvas::new_format(ctx, width, height, samples, ctx.gfx_context.color_format())
}
/// Create a new `Canvas` with the given size and number of samples.
pub fn new_format(
ctx: &mut Context,
width: u16,
height: u16,
samples: conf::NumSamples,
color_format: gfx::format::Format,
) -> GameResult<Canvas> {
let debug_id = DebugId::get(ctx);
let aa = match samples {
@ -54,7 +64,6 @@ impl Canvas {
};
let kind = Kind::D2(width, height, aa);
let levels = 1;
let color_format = ctx.gfx_context.color_format();
let factory = &mut ctx.gfx_context.factory;
let texture_create_info = gfx::texture::Info {
kind,