Skip to content

Commit

Permalink
Improved texture writing
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyThePilot committed Oct 19, 2021
1 parent d100a0a commit ec5bc69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/app/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::error::Error;

use std::path::Path;
use std::fs::File;
use std::io::BufWriter;
use std::fmt;

const ZOOM_SENSITIVITY: f64 = 0.125;
Expand Down Expand Up @@ -823,5 +824,5 @@ impl Camera {
}

fn export_image_buffer<P: AsRef<Path>>(path: P, image: RgbImage) -> Result<(), Error> {
super::map::write_rgb_bmp_image(File::create(path)?, &image)
super::map::write_rgb_bmp_image(BufWriter::new(File::create(path)?), &image)
}
4 changes: 2 additions & 2 deletions src/app/map/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::util::uord::UOrd;

use std::path::{Path, PathBuf};
use std::collections::hash_map::Entry;
use std::io::{self, Cursor, Read, Write};
use std::io::{self, Cursor, BufWriter, Read, Write};
use std::cmp::Ordering;
use std::fs::File;
use std::fmt;
Expand Down Expand Up @@ -302,7 +302,7 @@ pub fn save_bundle(location: &Location, bundle: &Bundle) -> Result<(), Error> {
Location::Dir(path) => {
let (definition_table, adjacencies_table, id_changes) = deconstruct_map_data(bundle)?;

let file = create_file(path.join("provinces.bmp"))?;
let file = BufWriter::new(create_file(path.join("provinces.bmp"))?);
write_rgb_bmp_image(file, &bundle.map.color_buffer)?;

let file = create_file(path.join("definition.csv"))?;
Expand Down

0 comments on commit ec5bc69

Please sign in to comment.