Grain and Add Noise stay with the document on the canvas; the GPU canvas's contracts judged and pinned on the CPU canvas (13.9b)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-01 17:47:52 -04:00
1 parent 06843364fe
commit d2c8507fc7
8 files changed
+402 -31

No files matched your search

-28
View File
@@ -83,7 +83,6 @@ private slots:
void theLiveCompositeDrawsWhatTheExportDraws();
void adjustmentsShowAsTheExportDoes();
void anAdjustmentsMaskClipsItOnTheCanvas();
void grainFollowsTheViewOnTheCanvas();
};
void CanvasDisplayTests::theBackgroundCheckerboardShadowAndBorderSurroundTheDocument()
@@ -411,32 +410,5 @@ void CanvasDisplayTests::anAdjustmentsMaskClipsItOnTheCanvas()
session.cancelBrush();
}
void CanvasDisplayTests::grainFollowsTheViewOnTheCanvas()
{
// Swift's canvas hands Grain the view's region, not the document's.
Scene scene(40, 40, 120, 120);
EditorSession &session = scene.session;
session.insert(filled(40, 40, qRgba(128, 128, 128, 255), "Gray"));
session.addAdjustment(AdjustmentKind::grain);
session.setAdjustmentEditingID(std::nullopt);
LayerAdjustment grain = session.activeLayer().value().adjustment.value();
GrainSettings strong = grain.grain();
strong.amount = 100;
// Pinned: under some seeds the pan keeps one pixel's tone.
strong.seed = 7;
grain.setGrain(strong);
session.updateAdjustment(session.activeLayerID().value(), grain);
session.zoom(1);
QVERIFY(gapToExport(scene) > 20);
// A pan moves the pattern under the same document pixel.
const auto pixel = [&scene] {
const QPointF origin = scene.origin();
return scene.shot().pixel(int(origin.x() + 20.5), int(origin.y() + 20.5));
};
const QRgb before = pixel();
session.viewport.translate(QSizeF(3, 0));
QVERIFY(pixel() != before);
}
QTEST_MAIN(CanvasDisplayTests)
#include "CanvasDisplayTests.moc"