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

(#251): Surface::create_similar() and friends should return a Result #287

Merged

Commits on Oct 10, 2019

  1. (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
    federicomenaquintero committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    3e2026c View commit details
    Browse the repository at this point in the history
  2. xcb: return Result from the functions that take a size

    These may fail due to the caller passing a too-big size.
    federicomenaquintero committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    b354658 View commit details
    Browse the repository at this point in the history
  3. 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.
    federicomenaquintero committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    a4e7c3f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d40cd7c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7f2e839 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2019

  1. Add PdfSurface::try_from(Surface)

    Also, do the from_glib_*() in the same fashion as ImageSurface.
    federicomenaquintero committed Nov 19, 2019
    Configuration menu
    Copy the full SHA
    2b7ed5b View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2019

  1. Add PsSurface::try_from(Surface)

    Also, do the from_glib_*() in the same fashion as ImageSurface.
    federicomenaquintero committed Nov 20, 2019
    Configuration menu
    Copy the full SHA
    2beea0a View commit details
    Browse the repository at this point in the history
  2. Add SvgSurface::try_from(Surface)

    Also, do the from_glib_*() in the same fashion as ImageSurface.
    federicomenaquintero committed Nov 20, 2019
    Configuration menu
    Copy the full SHA
    a7fe8f9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b4a8778 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dfc78b6 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    248da91 View commit details
    Browse the repository at this point in the history
  6. 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.
    federicomenaquintero committed Nov 20, 2019
    Configuration menu
    Copy the full SHA
    f9a32bf View commit details
    Browse the repository at this point in the history
  7. 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
    federicomenaquintero committed Nov 20, 2019
    Configuration menu
    Copy the full SHA
    275cc3c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5fe7cea View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2019

  1. Configuration menu
    Copy the full SHA
    6ea6f03 View commit details
    Browse the repository at this point in the history
  2. fmt

    GuillaumeGomez committed Nov 21, 2019
    Configuration menu
    Copy the full SHA
    1794024 View commit details
    Browse the repository at this point in the history