Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Fix PixbufFormat, regen Pixbuf #57

Merged
merged 8 commits into from
Dec 30, 2017

Conversation

EPashkin
Copy link
Member

Closes #55
Closes #56
Closes #23

Build will fails until gtk-rs/glib#278

cc @GuillaumeGomez, @sdroege

@EPashkin EPashkin force-pushed the fix_PixbufFormat_regen_Pixbuf branch from d97b088 to 62d23bf Compare December 17, 2017 18:23
@EPashkin EPashkin changed the title WIP: Fix PixbufFormat, regen Pixbuf Fix PixbufFormat, regen Pixbuf Dec 17, 2017
@EPashkin
Copy link
Member Author

Ok, PR is finished,
Not all async functions generated by unknown reason, but we can finish it later.

@GuillaumeGomez
Copy link
Member

I agree. Once CI is good, it's good for me as well.

@EPashkin
Copy link
Member Author

Forgot to check async function, at minimum new_from_stream_async need be manual.

@sdroege
Copy link
Member

sdroege commented Dec 17, 2017

Generally looks good, good work :) will check later in detail, not ideal from the phone

@EPashkin EPashkin force-pushed the fix_PixbufFormat_regen_Pixbuf branch from 62d23bf to bad7e46 Compare December 17, 2017 19:54
@EPashkin
Copy link
Member Author

Updated.

@EPashkin
Copy link
Member Author

@sdroege Please, look at this if you have time.

@sdroege
Copy link
Member

sdroege commented Dec 28, 2017

I will tomorrow, thanks for the reminder. I missed that something is left to be done here

@sdroege
Copy link
Member

sdroege commented Dec 29, 2017

Also feel free to remind me sooner than ~2 weeks later for such things in the future :)


fn composite_color_simple(&self, dest_width: i32, dest_height: i32, interp_type: InterpType, overall_alpha: i32, check_size: i32, color1: u32, color2: u32) -> Option<Pixbuf>;

fn copy(&self) -> Option<Pixbuf>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this really fail? And the others returning an Option

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check all others later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting


//#[cfg(any(feature = "v2_36", feature = "dox"))]
//fn save_to_streamv_async<'a, P: IsA</*Ignored*/gio::OutputStream>, Q: Into<Option<&'a gio::Cancellable>>, R: /*Ignored*/gio::AsyncReadyCallback>(&self, stream: &P, type_: &str, option_keys: &[&str], option_values: &[&str], cancellable: Q, callback: R);
//fn save_to_streamv_async<'a, P: IsA<gio::OutputStream>, Q: Into<Option<&'a gio::Cancellable>>, R: /*Unimplemented*/gio::AsyncReadyCallback>(&self, stream: &P, type_: &str, option_keys: &[&str], option_values: &[&str], cancellable: Q, callback: R);

fn savev(&self, filename: &str, type_: &str, option_keys: &[&str], option_values: &[&str]) -> Result<(), Error>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already weird before, but it seems like this should be taking a options: &[(&str, &str)] instead? It's probably unsafe now if the arrays are different length?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You right. Maybe even options: &[(AsRef<str>, AsRef<str>)]

@@ -178,10 +163,44 @@ impl Pixbuf {
}
}

pub fn copy(&self) -> Pixbuf {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it also was not returning an Option.

Maybe take a diff of the API changes here to make sure the API is not regressing without noticing.

src/pixbuf.rs Outdated
@@ -178,10 +163,44 @@ impl Pixbuf {
}
}

pub fn copy(&self) -> Pixbuf {
pub fn get_file_info(filename: &str) -> Option<(PixbufFormat, i32, i32)> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a &Path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I change it to AsRef<Path>

@EPashkin
Copy link
Member Author

@sdroege Updated with AsRef<Path> for file names and &[(&str, &str)] for save options.
Tried &[(AsRef<str>, AsRef<str>)], but it make problem with saving without options.
About return Option<Pixbuf>: seems Pixbuf even don't follow glib rules that object constructors can't return null, so all function returning Pixbuf need be optional.
I stuck with rust-lang/rust#47048 and can't build gir, so I can't change this now and propose postpone this change.

@sdroege
Copy link
Member

sdroege commented Dec 30, 2017

👍

@GuillaumeGomez
Copy link
Member

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 1e9ce85 into gtk-rs:master Dec 30, 2017
@EPashkin EPashkin deleted the fix_PixbufFormat_regen_Pixbuf branch December 30, 2017 09:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants