Skip to content

Commit

Permalink
fix build break w/o webp feature
Browse files Browse the repository at this point in the history
  • Loading branch information
hanabi1224 committed Aug 7, 2021
1 parent c73653d commit 29f4a4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ dds = ["image/dds"]
tga = ["image/tga"]
jpeg = ["image/jpeg"]
bmp = ["image/bmp"]
webp = ["webp_lib"]
webp = ["image/webp", "webp_lib"]
6 changes: 4 additions & 2 deletions crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ use texture::HdrTextureLoader;
feature = "dds",
feature = "tga",
feature = "jpeg",
feature = "bmp"
feature = "bmp",
feature = "webp"
))]
use texture::ImageTextureLoader;

Expand Down Expand Up @@ -108,7 +109,8 @@ impl Plugin for RenderPlugin {
feature = "dds",
feature = "tga",
feature = "jpeg",
feature = "bmp"
feature = "bmp",
feature = "webp"
))]
{
app.init_asset_loader::<ImageTextureLoader>();
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_render/src/texture/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ impl Texture {
"image/jpeg" => Ok(image::ImageFormat::Jpeg),
"image/bmp" => Ok(image::ImageFormat::Bmp),
"image/x-bmp" => Ok(image::ImageFormat::Bmp),
#[cfg(feature = "webp")]
"image/webp" => Ok(image::ImageFormat::WebP),
_ => Err(TextureError::InvalidImageMimeType(mime_type.to_string())),
},
Expand All @@ -244,6 +245,7 @@ impl Texture {
// cases.

let dyn_img = match format {
#[cfg(feature = "webp")]
image::ImageFormat::WebP => webp_lib::Decoder::new(buffer)
.decode()
.ok_or_else(|| {
Expand Down

0 comments on commit 29f4a4b

Please sign in to comment.