Fix bleed, fix thumbnail orientation
This commit is contained in:
parent
207878928f
commit
b41554c608
@ -434,6 +434,10 @@ impl App {
|
||||
fn update_transform(&mut self) {
|
||||
let state = self.state.as_mut().unwrap();
|
||||
|
||||
// TODO: Remove obviously
|
||||
if state.transform_data.width < 800 {
|
||||
state.transform_data.orientation = Orientation::NoTransforms;
|
||||
}
|
||||
let (width, height) = swap_wh(
|
||||
state.transform_data.width,
|
||||
state.transform_data.height,
|
||||
|
@ -329,9 +329,10 @@ pub fn load_thumbnail_exif(path: &ImageData) -> Option<ImflowImageBuffer> {
|
||||
let decoder = image::ImageReader::new(Cursor::new(thumbnail))
|
||||
.with_guessed_format()
|
||||
.unwrap();
|
||||
let image = decoder.decode().unwrap();
|
||||
let mut image = decoder.decode().unwrap();
|
||||
|
||||
let orientation = path.orientation;
|
||||
image.apply_orientation(orientation);
|
||||
let width: usize = image.width() as usize;
|
||||
let height: usize = image.height() as usize;
|
||||
let rgba_buffer = image_to_rgba_buffer(image);
|
||||
|
@ -43,6 +43,13 @@ fn fs_main(@location(0) in: vec2<f32>) -> @location(0) vec4<f32> {
|
||||
}
|
||||
let scale = texture_size / out_dim;
|
||||
var pixel = uv * scale;
|
||||
|
||||
// add offset to remove bleed from uncleared buffer
|
||||
let half_texel = vec2<f32>(0.5) / out_dim;
|
||||
let min_uv = half_texel;
|
||||
let max_uv = scale - half_texel;
|
||||
pixel = clamp(pixel, min_uv, max_uv);
|
||||
|
||||
if transforms.orientation == 3 {
|
||||
pixel = reverse(pixel);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user