Skip to content

Commit

Permalink
Apply identity transforms if they adjust the image
Browse files Browse the repository at this point in the history
Transforms now get applied properly if the opacity or blend mode is the
only thing that is changed. Previously they would end up not doing
anything because the identity transform caused the code path to bail out
early.
  • Loading branch information
askmeaboutlo0m committed Feb 3, 2025
1 parent 8a795d4 commit f9237e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Unreleased Version 2.2.2-pre
* Feature: Allow selecting and then moving, grouping, deleting etc. of multiple layers at once. To select multiple layers, hold Shift or Ctrl while making a selection or use the boxes on the right. Thanks MorrowShore for suggesting parts of this.
* Feature: Allow dragging across the layer icons to hide the visibility of multiple layers in a row, rather than having to click each one. Thanks MorrowShore for suggesting.
* Feature: The fill and magic wand tools now always at least fill the initial pixel if gap closing or shrinking would up with a blank result. Thanks MorrowShore for suggesting.
* Fix: Properly apply transforms if the only thing you change is the opacity or blend mode. Thanks Blozzom for reporting.

2024-11-06 Version 2.2.2-beta.4
* Fix: Solve rendering glitches with selection outlines that happen on some systems. Thanks xxxx for reporting.
Expand Down
6 changes: 3 additions & 3 deletions src/libclient/canvas/transformmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ QVector<net::Message> TransformModel::applyFromCanvas(
Q_ASSERT(m_active);
Q_ASSERT(!m_pasted || m_stamped);
bool identity = TransformQuad(m_srcBounds) == m_dstQuad;
bool adjustsImage =
m_blendMode != int(DP_BLEND_MODE_NORMAL) || m_opacity < 1.0;
int singleLayerSourceId =
compatibilityMode ? 0 : getSingleLayerMoveId(layerId);
if(!identity ||
if(!identity || adjustsImage ||
(singleLayerSourceId > 0 && singleLayerSourceId != layerId)) {
int srcX = m_srcBounds.x();
int srcY = m_srcBounds.y();
Expand All @@ -277,8 +279,6 @@ QVector<net::Message> TransformModel::applyFromCanvas(
bool moveSelection = alterSelection && !m_deselectOnApply;
bool needsMask = moveContents && !m_mask.isNull();
bool sizeOutOfBounds = isDstQuadBoundingRectAreaSizeOutOfBounds();
bool adjustsImage =
m_blendMode != int(DP_BLEND_MODE_NORMAL) || m_opacity < 1.0;
QVector<net::Message> msgs;
msgs.reserve(1 + (moveContents ? 1 : 0) + (alterSelection ? 1 : 0));

Expand Down

0 comments on commit f9237e0

Please sign in to comment.