render: Switch from log to tracing

This commit is contained in:
Nathan Adams 2023-02-02 15:47:20 +01:00
parent f9b378b29a
commit a3a7f79f04
5 changed files with 10 additions and 8 deletions

2
Cargo.lock generated
View File

@ -3567,13 +3567,13 @@ dependencies = [
"gc-arena",
"gif 0.12.0",
"jpeg-decoder",
"log",
"lyon",
"png",
"serde",
"smallvec",
"swf",
"thiserror",
"tracing",
"wasm-bindgen",
]

View File

@ -9,7 +9,7 @@ version.workspace = true
[dependencies]
swf = { path = "../swf"}
log = "0.4"
tracing = "0.1.37"
gif = "0.12.0"
png = { version = "0.17.7" }
flate2 = "1.0.25"

View File

@ -61,7 +61,7 @@ impl Bitmap {
// If the size is incorrect, either we screwed up or the decoder screwed up.
let expected_len = width as usize * height as usize * format.bytes_per_pixel();
if data.len() != expected_len {
log::warn!(
tracing::warn!(
"Incorrect bitmap data size, expected {} bytes, got {}",
data.len(),
expected_len

View File

@ -8,6 +8,7 @@ use lyon::tessellation::{
FillTessellator, FillVertex, StrokeTessellator, StrokeVertex, StrokeVertexConstructor,
};
use lyon::tessellation::{FillOptions, StrokeOptions};
use tracing::instrument;
pub struct ShapeTessellator {
fill_tess: FillTessellator,
@ -30,6 +31,7 @@ impl ShapeTessellator {
}
}
#[instrument(level = "debug", skip_all)]
pub fn tessellate_shape(
&mut self,
shape: DistilledShape,
@ -182,7 +184,7 @@ impl ShapeTessellator {
}
Err(e) => {
// This may simply be a degenerate path.
log::error!("Tessellation failure: {:?}", e);
tracing::error!("Tessellation failure: {:?}", e);
}
}
}

View File

@ -32,7 +32,7 @@ pub fn decode_define_bits_jpeg(data: &[u8], alpha_data: Option<&[u8]>) -> Result
let format = determine_jpeg_tag_format(data);
if format != JpegTagFormat::Jpeg && alpha_data.is_some() {
// Only DefineBitsJPEG3 with true JPEG data should have separate alpha data.
log::warn!("DefineBitsJPEG contains non-JPEG data with alpha; probably incorrect")
tracing::warn!("DefineBitsJPEG contains non-JPEG data with alpha; probably incorrect")
}
match format {
JpegTagFormat::Jpeg => decode_jpeg(data, alpha_data),
@ -135,7 +135,7 @@ pub fn remove_invalid_jpeg_data(data: &[u8]) -> Cow<[u8]> {
if data.ends_with(&[0xFF, EOI]) {
data
} else {
log::warn!("JPEG is missing EOI marker and may not decode properly");
tracing::warn!("JPEG is missing EOI marker and may not decode properly");
data.to_mut().extend_from_slice(&[0xFF, EOI]);
data
}
@ -171,7 +171,7 @@ fn decode_jpeg(jpeg_data: &[u8], alpha_data: Option<&[u8]>) -> Result<Bitmap, Er
.collect(),
jpeg_decoder::PixelFormat::L8 => decoded_data.iter().flat_map(|&c| [c, c, c]).collect(),
jpeg_decoder::PixelFormat::L16 => {
log::warn!("Unimplemented L16 JPEG pixel format");
tracing::warn!("Unimplemented L16 JPEG pixel format");
decoded_data
}
};
@ -204,7 +204,7 @@ fn decode_jpeg(jpeg_data: &[u8], alpha_data: Option<&[u8]>) -> Result<Bitmap, Er
));
} else {
// Size isn't correct; fallback to RGB?
log::error!("Size mismatch in DefineBitsJPEG3 alpha data");
tracing::error!("Size mismatch in DefineBitsJPEG3 alpha data");
}
}