-
-
Notifications
You must be signed in to change notification settings - Fork 59
(#251): Surface::create_similar() and friends should return a Result #287
(#251): Surface::create_similar() and friends should return a Result #287
Commits on Oct 10, 2019
-
(gtk-rs#251): Surface::create_similar() and friends should return a R…
…esult Cairo's surface creation functions never return NULL; instead they always return a surface, but it may be in an error state. In gtk-rs#141 we started making the binding functions return Result for this; some returned the plain FooSurface type, some others Option<FooSurface>. This makes the following functions return Result<FooSurface, Status> Surface::create_similar() Surface::create_similar_image() Device.surface_create() Device.surface_create_for_target() PdfSurface::new() RecordingSurface::create() RecordingSurface::from_raw_full() SvgSurface::new() XCBSurface::create() XCBSurface::create_for_bitmap() XCBSurface::create_with_xrender_format() From macro for_stream_constructors!: *::for_stream() *::for_raw_stream() The foundation for all of this is that Surface::from_raw_full() now also returns Result<FooSurface, Status>. This is to make things consistent with ImageSurface::from_raw_full(). Analogously, we now have RecordingSurface::from_raw_full() that also returns Result. Fixes gtk-rs#251
Configuration menu - View commit details
-
Copy full SHA for 3e2026c - Browse repository at this point
Copy the full SHA 3e2026cView commit details -
xcb: return Result from the functions that take a size
These may fail due to the caller passing a too-big size.
Configuration menu - View commit details
-
Copy full SHA for b354658 - Browse repository at this point
Copy the full SHA b354658View commit details -
pdf: Return Result from most functions
Most of cairo_pdf_surface_*() can set the surface to an error state, due to their internal call to _extract_pdf_surface(), which checks a few conditions with the surface itself and the paginated surface.
Configuration menu - View commit details
-
Copy full SHA for a4e7c3f - Browse repository at this point
Copy the full SHA a4e7c3fView commit details -
Add a Status.to_result() and use it throughout instead of match{}
Thanks to @EPashkin for the suggestion.
Configuration menu - View commit details
-
Copy full SHA for d40cd7c - Browse repository at this point
Copy the full SHA d40cd7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f2e839 - Browse repository at this point
Copy the full SHA 7f2e839View commit details
Commits on Nov 19, 2019
-
Add PdfSurface::try_from(Surface)
Also, do the from_glib_*() in the same fashion as ImageSurface.
Configuration menu - View commit details
-
Copy full SHA for 2b7ed5b - Browse repository at this point
Copy the full SHA 2b7ed5bView commit details
Commits on Nov 20, 2019
-
Add PsSurface::try_from(Surface)
Also, do the from_glib_*() in the same fashion as ImageSurface.
Configuration menu - View commit details
-
Copy full SHA for 2beea0a - Browse repository at this point
Copy the full SHA 2beea0aView commit details -
Add SvgSurface::try_from(Surface)
Also, do the from_glib_*() in the same fashion as ImageSurface.
Configuration menu - View commit details
-
Copy full SHA for a7fe8f9 - Browse repository at this point
Copy the full SHA a7fe8f9View commit details -
Configuration menu - View commit details
-
Copy full SHA for b4a8778 - Browse repository at this point
Copy the full SHA b4a8778View commit details -
Configuration menu - View commit details
-
Copy full SHA for dfc78b6 - Browse repository at this point
Copy the full SHA dfc78b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 248da91 - Browse repository at this point
Copy the full SHA 248da91View commit details -
Make all derived surfaces newtypes intead of having an "inner" field
This makes them consistent, and should make it possible to generate them with a macro.
Configuration menu - View commit details
-
Copy full SHA for f9a32bf - Browse repository at this point
Copy the full SHA f9a32bfView commit details -
Generate all derived surfaces with a declare_surface! macro
This includes implementations of: struct DerivedSurface(Surface) TryFrom<Surface> DerivedSurface.from_raw_full() ToGlibPtr FromGlibPtrNone FromGlibPtrBorrow FromGlibPtrFull gvalue_impl! Deref Clone Display
Configuration menu - View commit details
-
Copy full SHA for 275cc3c - Browse repository at this point
Copy the full SHA 275cc3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5fe7cea - Browse repository at this point
Copy the full SHA 5fe7ceaView commit details
Commits on Nov 21, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 6ea6f03 - Browse repository at this point
Copy the full SHA 6ea6f03View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1794024 - Browse repository at this point
Copy the full SHA 1794024View commit details