1. 10 Apr, 2018 1 commit
    • Michael Natterer's avatar
      Bug 791519 - Unexpected selection from channel · 3f95dc52
      Michael Natterer authored
      Make sure a channel -> selection -> channel roundtrip never does any
      gamma conversion.
      
      In gimp_channel_duplicate(), make sure a created channel has the
      right format, and the right data. Fixes selection -> channel.
      
      When switching off quick mask, call gimp_item_to_selection() instead
      if gimp_selection_load(), the latter was implementing a shortcut which
      is now wrong.
      
      Remove gimp_selection_load() which is now unused.
      
      Unrelated: also remove gimp_selection_save(), it was an obvious
      3-liner used only twice.
      3f95dc52
  2. 09 Apr, 2018 2 commits
    • Michael Natterer's avatar
      Revert "Bug 791512 - make the selection boundary detection the same as 2.8" · bba8f695
      Michael Natterer authored
      This commit was fixing only a symptom of our channel/selection
      problem, making it appear things were fine.
      
      This reverts commit 27512d80.
      bba8f695
    • Ell's avatar
      Bug 795081 - Crash when using a brush combined with a dynamics · f5cb1fed
      Ell authored
      In GimpPaintTool, brush outline generation took place during
      gimp_paint_tool_draw() even while painting.  This function is run
      concurrently with the paint thread.  When using dynamics, this
      introduced a race conidition between updating the brush mask in the
      paint thread, and updating the brush boundary in the main thread.
      
      Move brush outline generation during painting to
      gimppainttool-paint.c, and perform it in the display-update
      timeout, while the main thread and the paint thread are
      synchronized.
      f5cb1fed
  3. 08 Apr, 2018 4 commits
    • luz.paz's avatar
      Bug 794996 - Misc. typo fixes in comments in app/ · 7fdb963e
      luz.paz authored
      Found via `codespell -q 3 --skip="./po*"`
      7fdb963e
    • Michael Natterer's avatar
      Bug 791519 - Unexpected selection from channel · bb4ac7c8
      Michael Natterer authored
      Storing selections and layer masks as linear grayscale, but channels
      as whatever-the-layers-are caused severe problems in images with
      gamma-corrected layers: when combining channels with the selection,
      they would go thorugh a gamma conversion before being combined, giving
      unexpected results.
      
      This commit changes all channels to always be linear, except in 8-bit
      images, where they continue to be "Y' u8", for compatibility with old
      XCF files, and because linear 8-bit can't really be used in
      compositing (channels can be visible too).
      
      To fix channel -> selection combinations also for these images, add a
      small hack to gimp_gegl_mask_combine_buffer() which makes sure the
      to-be-combined channel's pixels are always read as-is, without any
      gamma conversion. After changing channels to linear, this makes no
      difference except in the 8-bit images where we need this hack.
      bb4ac7c8
    • Ell's avatar
      app: add gimp_drawable_{start,end,flush}_paint() · ce9ca03e
      Ell authored
      gimp_drawable_start/end_paint() are used to enter/exit paint mode
      for a given drawable.  While the drawable is in paint mode,
      gimp_drawable_get_buffer() returns a copy of the real drawable's
      buffer, referred to as the paint buffer, so that modifications to
      the returned buffer don't immediately affect the projection, and
      calls to gimp_drawable_update() queue the updated region, instead
      of emitting an "update" signal.
      
      gimp_drawable_flush_paint() can be called while the drawable is in
      paint mode, in order to copy the updated region of the paint buffer
      back to the drawable's real buffer, and to emit "update" signals
      for the queued region.
      
      We use these functions in the next commit, to move painting to a
      separate thread in the paint tools.
      ce9ca03e
    • Ell's avatar
      Makefiles: don't use -xobjective-c when linking files on Mac · 6ebc3f1b
      Ell authored
      Last commit caused -xobjective-c to be passed during linking on
      Mac, causing object files to be treated as source files.  Add a
      -xnone flag to AM_LDFLAGS, canceling the effect of -xobjective-c.
      
      Additinally, add a -xobjective-c++ flag to AM_CXXFLAGS, so that we
      can use Objective-C in C++ files on Mac, if we ever need to.
      6ebc3f1b
  4. 07 Apr, 2018 2 commits
    • Ell's avatar
      Makefiles: don't use -xobjective-c when compiling C++ files on Mac · 06950be7
      Ell authored
      On Mac, pass -xobjective-c to the compiler through AM_CFLAGS, not
      AM_CPPFLAGS, so that it's only used for C sources, and not C++
      sources.  In the latter case, it clashes with the -std=... flag,
      spewing an error.  Thanks, Partha :)
      06950be7
    • Massimo Valentini's avatar
      app: silence gcc warning · 81e1e396
      Massimo Valentini authored
      gimp-templates.c:143:15: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
                     strncpy (dpi, "ppi", 3);
                     ^~~~~~~~~~~~~~~~~~~~~~~
      81e1e396
  5. 05 Apr, 2018 1 commit
  6. 04 Apr, 2018 3 commits
    • Ell's avatar
      app: parallelize gimpbrush-transform.cc · c8d4c079
      Ell authored
      Use gimp_parallel_distribute_foo() to parallelize the brush
      transform functions.
      c8d4c079
    • Ell's avatar
      app: switch gimpbrush-transform.c to C++ · 565f1f2a
      Ell authored
      The next commit is going to parallelize gimpbrush-transform using
      the gimp_parallel_distribute_foo() functions.  To spare us a lot of
      boilerplate code, we're going to use C++ lambdas as callback
      arguments to these functions.
      
      This commit does the initial conversion of gimpbrush-transform.c to
      C++, renaming it to gimpbrush-transform.cc.  We do this in a
      separate commit, so that the changes are small enough for git to
      register this as a renamed file, rather than a new file, so that we
      don't lose the file's history.
      565f1f2a
    • Ell's avatar
      app: add gimp-parallel · 86b89cf6
      Ell authored
      Add gimp-parallel.[cc,h], which provides a set of parallel
      algorithms.
      
      These currently include:
      
        - gimp_parallel_distribute():  Calls a callback function in
          parallel on multiple threads, passing it the current thread
          index, and the total number of threads.  Allows specifying the
          maximal number of threads used.
      
        - gimp_parallel_distribute_range():  Splits a range of integers
          between multiple threads, passing the sub-range to a callback
          function.  Allows specifying the minimal sub-range size.
      
        - gimp_parallel_distribute_area():  Splits a rectangular area
          between multiple threads, passing the sub-area to a callback
          function.  Allows specifying the minimal sub-area.
      
      The callback function is passed using an appropriately-typed
      function pointer, and a user-data pointer.  Additionally, when used
      in a C++ file, each of the above functions has an overloaded
      template version, taking the callback through a generic parameter,
      without a user-data pointer, which allows using function objects.
      86b89cf6
  7. 03 Apr, 2018 1 commit
  8. 02 Apr, 2018 2 commits
    • Jehan's avatar
      app: do not edit symmetry variables but properties. · d779c138
      Jehan authored
      If variables are edited directly, in some cases, the GUI and the
      symmetries may end up out-of-sync. The variable can only be edited
      through property setting.
      d779c138
    • Jehan's avatar
      app: mirror positions 0.0 are accepted. · 3c1516ea
      Jehan authored
      This value is actually used as a special value when removing a guide to
      get rid of a symmetry, in particular it is set in the guides' callback
      gimp_mirror_guide_removed_cb() for "removed" signal.
      If not setting to 0, when adding back a symmetry, it starts with weird
      low or high values near to border (whereas when set to 0, it is reset to
      default position afterwards).
      3c1516ea
  9. 01 Apr, 2018 2 commits
    • Jehan's avatar
      app: do not raise a warning when failing to deserialize symmetry... · c9df2a68
      Jehan authored
      ... parasite.
      Not sure if that should be considered a bug. On one hand, it should
      because that's core code. On the other hand, symmetry saving currently
      uses parasites, which is a feature which can also be used by people
      randomly. So "theoretically", there could be any data in a parasite and
      we should not assume specific format.
      Anyway still keep the error message but just print to standard error
      output instead. Also print a bit more details (parasite name and
      contents) as it would help for debugging when such a case were to occur.
      c9df2a68
    • Jehan's avatar
      Bug 792520 - Image symmetries should be saved: version the properties. · e0029d31
      Jehan authored
      Care for future changes of symmetries, by adding a version property. For
      now, all symmetries are at version 0, and no real check is done. If any
      symmetry bumps its settings in the future, it will have to override also
      update_version() to change settings properly if necessary, according to
      any new behavior.
      e0029d31
  10. 31 Mar, 2018 1 commit
    • Ell's avatar
      app: align projection update area to coarse grid · 49285463
      Ell authored
      When adding a rectangle to a projection's update area, align the
      rectangle to a coarse grid, to reduce the complexity of the overall
      area.  We currently align the rectangle to a 32x32 grid, which
      seems to be a good tradeoff between the overhead of processing a
      complex area, and the overhead of processing a large area.
      49285463
  11. 29 Mar, 2018 3 commits
  12. 28 Mar, 2018 1 commit
  13. 27 Mar, 2018 3 commits
  14. 26 Mar, 2018 2 commits
  15. 25 Mar, 2018 5 commits
    • Ell's avatar
      app: round layer bounds to global pixel grid when scaling image/group · 5763b50d
      Ell authored
      Add gimp_item_scale_by_factors_with_origin(), which is an extension
      of gimp_item_scale_by_factors(), taking the input/output points of
      origin for the transformation (both of which are (0, 0) in the case
      of gimp_item_scale_by_factors()).  Implement
      gimp_item_scale_by_factors() in terms of the new function, and Use
      the new function when scaling group layers, instead of manually
      calculating the children boundaries, so that the behavior is
      uniform across whole-image scaling and group-layer scaling.
      
      The new function rounds all four edges of the boundary to the
      image-global pixel grid, instead of only rounding the top/left
      edges to the global grid, and the bottom/right edges to the item-
      local grid.  This preserves layer-adjacency when scaling.
      5763b50d
    • Ell's avatar
      app: use GimpObjectQueue in lots of places · 139a2345
      Ell authored
      Use GimpObjectQueue, added in the previous commit, in various
      instances where we perform an action on a set of objects.  This
      improves progress reporting, by using a single progress for the
      entire operation, rather than reporting the progress of each object
      individually, and by taking the relative cost of each object into
      account, instead of assuming a uniform cost for all objects.
      
      In particular, this affects the various whole-image operations
      (i.e., transformations and color conversions), operations on linked
      items, and operations on layer groups.  This also affects layers
      with masks, whose progress is now reported together instead of
      individually.
      
      Additionally, this commit fixes erroneous group-layer mask cropping
      during undo when resizing the image, by properly calling
      {start,end}_move() on all the resized layers before starting the
      operation, and when scaling the image, by only scaling top-level
      layers, and letting group layers scale their children themselves.
      139a2345
    • Ell's avatar
      app: add GimpObjectQueue · 3ee5054e
      Ell authored
      GimpObjectQueue implements a queue of GimpObjects.  It derives from
      GimpSubProgress, and hence can be used as a GimpProgress object.
      It keeps track of the total memsize of the objects that were
      pushed-to and popped-from the queue, and uses these numbers to set
      the corresponding subrange of the progress object when an object is
      popped.
      
      This provides an easy way to perform an operation on a set of
      objects, correctly reporting progress based on the relative sizes
      of the objects, which is assumed to be a good estimate of the
      relative cost of processing each object.
      3ee5054e
    • Ell's avatar
      app: add "progress" property to GimpSubProgress · 0f532787
      Ell authored
      Make the parent GimpProgress object of a GimpSubProgress instance
      settable through a property during construction, so that we can use
      it as a base class.
      0f532787
    • Ell's avatar
      app: fix layer-group mask cropping during move operation undo · 76a88cc6
      Ell authored
      In gimp_group_layer_{start,end}_move(), push corresponding undo
      steps, which perform the opposite operation during undo, and make
      sure that mask-cropping is frozen during group-layer move
      operations.
      
      This fixed erroneous group-layer mask cropping when undoing/redoing
      a group-layer move operation multiple times.
      76a88cc6
  16. 24 Mar, 2018 1 commit
    • Ell's avatar
      app: fix paste-in-place when pasting over a layer group/locked item · 8f07d767
      Ell authored
      When pasting in place over a layer group or a content-locked item,
      change the paste type to NEW_LAYER_IN_PLACE, rather than NEW_LAYER,
      so that the new layer is still pasted in the right location.
      
      Additionally, avoid showing the "Pasted as new layer because ..."
      message when pasting over a layer group or a content-locked item,
      when the paste type is NEW_LAYER[_IN_PLACE] to begin with.
      8f07d767
  17. 22 Mar, 2018 1 commit
    • Ell's avatar
      app: add crop_input parameter to gimp_gegl_apply_operation() · e1b1611e
      Ell authored
      Add a crop_input parameter to gimp_gegl_apply_[cached_]operation().
      When TRUE, the functions crop the op's input to the destination
      rect.  This is particularly useful for functions that process the
      entire input in one go (by means of get_cached_region()).  See the
      next commit.
      
      Pass crop_input = FALSE at all call sites for now, to keep the
      current behavior.
      e1b1611e
  18. 21 Mar, 2018 1 commit
  19. 19 Mar, 2018 1 commit
  20. 18 Mar, 2018 2 commits
    • Jehan's avatar
      Bug 793638 - (gimp-edit-stroke ...) crashes gimp-console-2.9 unless... · a1b4f4ae
      Jehan authored
      ... (gimp-context-set-paint-method...) is called.
      GimpContext initialized with standard paint info at constructed() time
      to ensure there is always a paint_info even if none were set manually.
      a1b4f4ae
    • Jehan's avatar
      app, libgimp, pdb: add "distance-metric" property to GimpPDBContext. · e164aee7
      Jehan authored
      This property is currently only used for gimp_edit_blend() to control
      how are computed distances. In the future, it could be used for more
      functions making use of "gegl:distance-transform" operation, or even for
      other algorithms, if relevant.
      This new property obviously comes with 2 new PDB calls:
      gimp_context_get_distance_metric() & gimp_context_set_distance_metric()
      e164aee7
  21. 17 Mar, 2018 1 commit