Skip to content
  • Ell's avatar
    app: maintain drawable bounding box separately from its logical boundary · 153cb33e
    Ell authored
    Maintain the bounding box of drawables (i.e., the bounds of their
    actual rendered content) separately from their logical boundary (as
    shown in the UI).
    
    The bounding box is calculated through the new
    GimpDrawable::get_bounding_box() virtual function, which has a
    corresponding gimp_drawable_get_bounding_box() function; the
    default implementation simply returns the drawable's logical
    boundary.  The bounding box is specified in drawable coordinates,
    i.e., it's not affected by the drawable's offset.
    
    The bounding box is recalculated through
    gimp_drawable_update_bounding_box(), which should be called
    whenever a change may affect the bounding box (for example, when
    setting a new buffer, as done implicitly by GimpDrawable's
    ::set_buffer() implementation, or when a drawable filter's
    properties change, as will be done by GimpDrawableFilter in a
    following commit).  When the bounding box changes, the affected
    regions of the drawable are updated, and the
    GimpDrawable::bounding-box-changed signal is emitted.
    
    When gimp_drawable_update() is called with negative width/height
    values, the entire drawable's bounding box is updated, rather than
    only its logical boundary.
    
    Likewise, GimpDrawableStack and GimpLayerStack are adapted to use
    the bounding box, instead of the logical bounds, when updating the
    drawable's area.
    153cb33e