Skip to content

Commit

Permalink
Vendor gelatin as a module; remove workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
DougLau committed Oct 28, 2023
1 parent 25bf592 commit 2d99a4f
Show file tree
Hide file tree
Showing 85 changed files with 842 additions and 787 deletions.
1,206 changes: 676 additions & 530 deletions Cargo.lock

Large diffs are not rendered by default.

90 changes: 80 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,82 @@
[workspace]
members = [
"alloy",
"gelatin",
[package]
name = "alloy"
version = "1.0.0"
description = "A fast and minimalistic image viewer based on emulsion"
repository = "https://github.com/ardaku/alloy"
license = "MIT"
readme = "README.md"
edition = "2021"
build = "build.rs"

[package.metadata.bundle]
name = "Emulsion"
identifier = "org.ardaku.alloy"
icon = ["resource_dev/emulsion.png"]
resources = ["LICENSE.txt"]
short_description = "A lightweight and minimalistic image viewer based on emulsion"
copyright = "Copyright (c) 2020 The Emulsion Contributors, Copyright (c) 2022 The Alloy Contributors"
linux_exec_args = "%f"
linux_mime_types = [
"image/jpeg",
"image/jpg",
"image/pjpeg",
"image/png",
"image/apng",
"image/gif",
"image/webp",
"image/tiff",
"image/bmp",
"image/avif",
"image/svg+xml",
"image/svg",
"image/x-png",
"image/x-tga",
"image/x-targa",
"image/x-bmp",
"image/x-icon",
"image/vnd.microsoft.icon",
"image/vnd.radiance",
"image/x‑portable‑bitmap",
"image/x‑portable‑graymap",
"image/x‑portable‑pixmap",
"image/x‑portable‑anymap"
]

[profile.dev.package."*"]
opt-level = 1
[profile.dev.build-override]
opt-level = 1
[profile.release]
lto = "thin"
[features]
default = []
avif = ["libavif-image"]

[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

[dependencies]
arboard = "3.2"
backtrace = "0.3"
cgmath = "0.18"
directories-next = "2.0"
env_logger = "0.10"
glium = "0.29"
image = "0.24"
kamadak-exif = "0.5"
lazy_static = "1.4"
lexical-sort = "0.3"
log = "0.4"
open = "4.1"
pico-args = "0.5"
rand = "0.8"
resvg = "0.35"
serde = { version = "1.0.159", features = ["derive"] }
sys-info = "0.9"
thiserror = "1.0"
tiny-skia = "0.9"
toml = "0.7"
trash = { version = "3.0", default-features = false }
typed-builder = "0.14"
usvg = "0.35"
winit = "0.26"

[dependencies.libavif-image]
version = "0.10"
default-features = false
features = ["codec-dav1d"]
optional = true
1 change: 1 addition & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 The Emulsion Contributors
Copyright (c) 2020 Artúr Barnabás Kovács
Copyright (c) 2022-2023 The Alloy Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
75 changes: 0 additions & 75 deletions alloy/Cargo.toml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes
3 changes: 0 additions & 3 deletions gelatin/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions gelatin/.vscode/launch.json

This file was deleted.

22 changes: 0 additions & 22 deletions gelatin/.vscode/tasks.json

This file was deleted.

18 changes: 0 additions & 18 deletions gelatin/Cargo.toml

This file was deleted.

21 changes: 0 additions & 21 deletions gelatin/LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion gelatin/README.md

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
},
};

use gelatin::image::imageops::{
use image::imageops::{
flip_horizontal_in_place, flip_vertical_in_place, rotate180_in_place,
rotate270, rotate90,
};
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion gelatin/src/application.rs → src/gelatin/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use glium::glutin::{
window::WindowId,
};

use crate::{window::Window, NextUpdate};
use crate::gelatin::{window::Window, NextUpdate};

const MAX_SLEEP_DURATION: std::time::Duration =
std::time::Duration::from_millis(4);
Expand Down
4 changes: 2 additions & 2 deletions gelatin/src/button.rs → src/gelatin/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use glium::{
uniform, Frame, Surface,
};

use crate::{
add_common_widget_functions,
use crate::add_common_widget_functions;
use crate::gelatin::{
misc::{Alignment, Length, LogicalRect, LogicalVector, WidgetPlacement},
picture::Picture,
window::RenderValidity,
Expand Down
4 changes: 2 additions & 2 deletions gelatin/src/label.rs → src/gelatin/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::{cell::RefCell, rc::Rc};
use cgmath::{Matrix4, Vector3};
use glium::{uniform, Frame, Surface};

use crate::{
add_common_widget_functions,
use crate::add_common_widget_functions;
use crate::gelatin::{
misc::{Alignment, Length, LogicalRect, LogicalVector, WidgetPlacement},
picture::Picture,
window::RenderValidity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::{cell::RefCell, rc::Rc};

use glium::Frame;

use crate::{
add_common_widget_functions,
use crate::add_common_widget_functions;
use crate::gelatin::{
misc::{
Alignment, HorDim, Length, LogicalRect, LogicalVector, PickDimension,
VerDim, WidgetPlacement,
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 6 additions & 5 deletions gelatin/src/picture.rs → src/gelatin/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use std::{
path,
};

use glium::texture::{RawImage2d, SrgbTexture2d};
use glium::texture::{MipmapsOption, RawImage2d, SrgbTexture2d};
use glium::Display;
use image::{error::ImageError, RgbaImage};

pub struct PictureTextureRef<'a> {
Expand Down Expand Up @@ -95,7 +96,7 @@ impl Picture {

pub fn texture(
&self,
display: &glium::Display,
display: &Display,
) -> Result<PictureTextureRef, ImageError> {
self.upload_to_texture(display)?;
if let PictureData::Gpu(_) = &*self.data.borrow() {
Expand All @@ -109,7 +110,7 @@ impl Picture {

fn upload_to_texture(
&self,
display: &glium::Display,
display: &Display,
) -> Result<(), ImageError> {
let mut borrowed = self.data.borrow_mut();
let mut tmp_picture = PictureData::Path("".into());
Expand Down Expand Up @@ -142,14 +143,14 @@ impl Picture {

fn cpu_to_texture(
img: RgbaImage,
display: &glium::Display,
display: &Display,
) -> SrgbTexture2d {
let image_dimensions = img.dimensions();
let image = RawImage2d::from_raw_rgba(img.into_raw(), image_dimensions);
SrgbTexture2d::with_mipmaps(
display,
image,
glium::texture::MipmapsOption::AutoGeneratedMipmaps,
MipmapsOption::AutoGeneratedMipmaps,
)
.unwrap()
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2d99a4f

Please sign in to comment.