Skip to content
  • Christian Hergert's avatar
    gtk/textview: quanitize X/Y by device pixels · 462920ea
    Christian Hergert authored
    This attempts to improve the somewhat "erratic" feeling of scrolling a
    GtkTextView with fractional scaling. However, it also improves the
    situation where you have a natural integer scaling factor such as 2x.
    
    To do so, it quantizes the X/Y origin of the visible rect to something that
    naturally alignes with device pixels. By doing so this aims to get
    consistent pixel alignment when hinting so that you no longer see jumps
    as the Y position of the buffer changes. X is also done for symmetry.
    
    The buffer itself is left in integer coordinates to avoid any sort
    of ABI breakage with existing applications. Only the origin x/y of the
    drawing area is affected and thus should only affect the ABI of
    gtk_text_view_get_visible_rect() by < 1 device pixel.
    
    Applications which require precision in the visible rect origin may use
    the new API introduced here as gtk_text_view_get_visible_offset(). This
    provides the X,Y point as doubles. graphene_point_t was not used here
    beacuse that appeared to cause aliasing due to float usage.
    
    GNOME/GtkSourceView!375 provides an example of consuming this new API to
    keep line numbers aligned in the same fashion as the textview contents.
    462920ea
Loading