1. 05 May, 2020 2 commits
    • Agata Cacko's avatar
      Move asserts before usage of a variable · c2ffbc6b
      Agata Cacko authored
      Before this commit, there were two asserts that were checked
      only after both of the variables were used. This means that instead of
      asserting, Krita would crash. It probaby doesn't change much in case of
      Q_ASSERTs (it would be different with asserts that allows recovering)
      but nonetheless, it makes no sense to assert after using a variable.
      This commit moves the asserts above the usage.
      BUG:421076
      c2ffbc6b
    • Rafał Mikrut's avatar
      Check if pointer is null before using it · c01502c9
      Rafał Mikrut authored
      c01502c9
  2. 01 May, 2020 1 commit
    • Mathias Wein's avatar
      Fix tone reproduction curve estimation · 733afddd
      Mathias Wein authored
      The ITUR_2100_PQ_FULL.ICC has no colorants and revealed the bugs.
      Iteration order was inverted so normalization didn't work.
      Also only the first colorant was ever written, and
      consequently the luma coefficients were also incomplete.
      
      Additionally, RGB vs. BGR channel ordering was not respected,
      and the sum of luma coefficients needs to be 1.0 for HSY
      color space calculations.
      
      And while at it, calculate a few more points so the graph in
      the color space browser looks at least somewhat like a curve.
      
      (cherry picked from commit fe47c0619d97e0d727afc9a48c95bf18c4475ddd)
      733afddd
  3. 20 Apr, 2020 1 commit
  4. 17 Apr, 2020 1 commit
  5. 16 Apr, 2020 1 commit
  6. 14 Apr, 2020 1 commit
    • Dmitry Kazakov's avatar
      Fix comparison of KoColor objects packed into QVariant · ca5df540
      Dmitry Kazakov authored
      KoResourceManager compares value of the resource before issuing
      update signals. It doesn't issue update signal is the resource hasn't
      changed.
      
      This patch fixes a bug when moving a shape used to make all color
      selectors crazy because of constant updates of BG/FG colors.
      ca5df540
  7. 13 Apr, 2020 1 commit
  8. 10 Apr, 2020 2 commits
    • Dmitry Kazakov's avatar
      Fix compilation on clang · 22cb6a76
      Dmitry Kazakov authored
      22cb6a76
    • Dmitry Kazakov's avatar
      Add a workaround for a bug(?) in clang · 5a82b010
      Dmitry Kazakov authored
      It looks like clang cannot link to explicit instantiations containing
      'half' as a template parameter. I didn't manage to reproduce a limited
      self-contained test yet.
      
      The workaround just stops exporting templated classes. It exports a
      factory that accepts KoId. This factory then dispatches the calls to
      proper templated code.
      5a82b010
  9. 09 Apr, 2020 4 commits
  10. 08 Apr, 2020 3 commits
  11. 03 Apr, 2020 1 commit
    • Dmitry Kazakov's avatar
      Add the latest lightness blending algorithm by Peter Schatz · 7e3f6c76
      Dmitry Kazakov authored
      "We needed a formula f(x) where f(0) = 0, f(1) = 1, and f(.5) = z,
      where z is the lightness of the color chosen. This can’t be
      linear unless the color chosen is also .5. So I went with
      a quadratic equation and solved it.
      
      f(x) = ax^2 + b^x +c
      0,0 -> 0 = a0^2 + b0 + c -> c = 0
      1,1 -> 1 = a1^2 +b1 + c -> 1 = a + b + 0 -> a = 1 - b
      .5,z -> z = a*.5^2 + b*.5 + c -> z
                = a/4 + b/2 + 0 -> z =
                = 1/4 - b/4 + b/2 -> z = 1/4 + b/4 -> b = 4z - 1
      
      f(x) = (1 - (4z - 1)) * x^2 + (4z - 1) * x
      
      So yes, the equation will be different for every value of
      color chosen, because that’s the only possible way to
      achieve the goal of an equation that runs through (0,0),
      (.5,z), and (1,1)."
      7e3f6c76
  12. 01 Apr, 2020 1 commit
  13. 30 Mar, 2020 1 commit
  14. 26 Mar, 2020 1 commit
  15. 25 Mar, 2020 2 commits
    • Dmitry Kazakov's avatar
      Optimize Auto Brush by merging fill and mask passes into one · 256d014e
      Dmitry Kazakov authored
      The patch removes extra "fill with color" pass from KisAutoBrsuh and
      moves that into KoColorSpace::fillInverseAlphaNormedFloatMaskWithColor(),
      where both filling and masking happens. It makes brush speed at least
      10% higher.
      256d014e
    • Dmitry Kazakov's avatar
      Fix "Preserve Lightness" to work with all color spaces · 4064d50a
      Dmitry Kazakov authored
      Now filling of the brush with color and applying alpha mask has been
      moved into KoColorSpace as a single operation. It should be much faster
      and it makes the code more understandable.
      
      This patch also changes the "preserve lightness" algorithm. Instead of lerp
      it uses standard overlay operation in the lightness scale. This approach
      generates result a bit more like Ramon's brushes.
      4064d50a
  16. 19 Mar, 2020 1 commit
  17. 05 Mar, 2020 1 commit
    • L. E. Segovia's avatar
      Fix Lab channel render in canvas and Channels docker · 7261d7bd
      L. E. Segovia authored
      This moves the channel rendering code to a KoColorSpace function
      named convertChannelToVisualRepresentation, implemented in
      KoColorSpaceAbstract and overriden in Lab colorspaces.
      
      This function now handles copying channel values and, where necessary,
      renormalizes it so as to fit the valid channel range (as with Lab).
      
      As a bonus, I also fixed scaleToU8 in Lab because it needed
      the same renormalization procedure.
      
      Thanks to Wolthera for the initial pseudopatch -- the missing part was
      the canvas code.
      
      BUG: 254784
      7261d7bd
  18. 28 Feb, 2020 1 commit
    • Dmitry Kazakov's avatar
      Remove KoResource::operator=() · a4c282c7
      Dmitry Kazakov authored
      It was implemented incorrectly: no operators in derived classes called
      corresponding implementations of base classes, which basically caused
      "slicing". It was easier to remove all operator=() implementations instead
      of just trying to fix all of them. Anyway, they were never used (and that
      is the reason the bug has never been seen).
      a4c282c7
  19. 21 Feb, 2020 3 commits
    • Dmitry Kazakov's avatar
      Fix building KoColorSet after the merge · 1fc63cc1
      Dmitry Kazakov authored
      1fc63cc1
    • Dmitry Kazakov's avatar
      Refactor out using global resources singletons in KisPaintOpSettings · 477012cd
      Dmitry Kazakov authored
      We cannot access global resource system while rendering the stroke in
      a worker thread. Therefore, we should prepare all the resources in
      advance, in GUI-thread, wrap them into a "server-like" storage and
      then pass to the paintop itself
      
      The patch does the following changes:
      
      1) KisPaintOpSettings now stores an internal link to "resources interface".
         Whenever the settings object wants to fetch a resource, e.g. in
         KisBrushBasedPaintOpSettings::paintOpSize(), it asks the resource
         interface about it.
      
      2) Before starting a stroke KisResourcesSnapshot does the following
         preparations (via KisPaintOpPreset::createLocalResourcesSnapshot()):
      
         1) Asks the paintop's factory about all the needed resources via
            (static) call to prepareResources().
      
         2) Wraps all these resources into KisLocalStrokeResources "fake"
            object.
      
         3) Sets this "fake" object as a resources source for KisPaintOpSettings
            object. Therefore, no global resources system will be accessed during
            the execution of the stroke.
      
      3) KoResource::load() and KoResource::loadFromDevice() now should also
         accept the resources interface. Obviously, the resources source for
         for KisPaintOpPreset should be set up right from the construction.
      477012cd
    • Dmitry Kazakov's avatar
      Implement KoEphemeralResource resource type · d8e47c44
      Dmitry Kazakov authored
      This type of resources has no representation on disk. They are created
      on the fly by the corresponding factories. E.g. KisAutoBrush. These
      resources don't have any load/save() methods, so they are implemented in
      a base, KoEphemeralResource.
      
      The main reason of this patch is to remove code duplication in
      implementations of save()/load() calls and move actual implementation
      to KoResource class.
      d8e47c44
  20. 20 Feb, 2020 3 commits
  21. 18 Feb, 2020 1 commit
  22. 15 Feb, 2020 4 commits
  23. 07 Feb, 2020 1 commit
  24. 04 Feb, 2020 2 commits
    • L. E. Segovia's avatar
      Fix typo in rebase of !231 · 7c6c1cfa
      L. E. Segovia authored
      I erroneously let old master code slip in the rebase...
      7c6c1cfa
    • L. E. Segovia's avatar
      Address Lab/CMYK space subtleties within KoColorSpaceMaths · 874243cb
      L. E. Segovia authored
      Summary:
      In T4488, two problems were identified with regards to Lab and CMYK when using KoColorSpaceMaths:
       - Palette loading was broken
       - Calculations themselves were broken: KoColorSpaceMaths assumes [0..1] in floating point whereas Lab has [0.100, -128..+127, -128..+127] and CMYK [0..100].
      
      This patch closes T4488 by making LittleCMS-based profiles (CMYKF32ColorSpace, LabF32ColorSpace) request the profile's bounds prior to initializing the channel defaults, and adjusting the same in the Qt controls. I've also changed KoColorSpaceMaths to account for these bounds.
      
      Maniphest Tasks: T4488
      
      Differential Revision: https://phabricator.kde.org/D6589
      
      Closes T4488
      874243cb