Only the sample match uses the measured increase-plus-decrease distance (#11901).
Protect Foreground Color keeps today's largest per-channel difference, as #11903
asks for its unmeasured cases. The tolerance doc describes the new distance and
the graded falloff.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a Lab document the Color mode no longer blends through RGB (which
changed the pixel's L): it keeps the stored L and moves a and b to the
foreground's, as in the reference application. Hue, Saturation and
Luminosity keep today's RGB blend.
A dab that erases a pixel only partly now also removes the sampled
colour's share from it: the kept colour becomes
(c - sampled x (1 - keep)) / keep per channel, clipped to the channel
range, so composited over the sampled colour it gives back the
original. Later dabs, in the same stroke and in later strokes, match
the pixel's current, decontaminated colour; sampling and the
Contiguous fill still read the pixels before the stroke. With the
graded alpha of #11901 this gives the reference application's drag
results.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Find Edges used to give every pixel within the Tolerance full weight,
so on a blurred edge it erased more than Contiguous. It now uses the
same graded weight (#11901), which keeps the transition as the
reference application does and still gives the Contiguous result on a
hard edge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One dab now erases a colour less the further it is from the sampled
colour, over the whole Tolerance, instead of fully up to the last
quarter of it. The weight is 1 - clamp((d - d0) / (T - d0), 0, 1) with
d0 = min(T / 20, 8 levels), measured with single clicks in the
reference application. The colour distance is the largest increase
plus the largest decrease over the channels, so opposite-sign changes
add up. Find Edges keeps its hard cut (#11904).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BrushSettings::default() turned Pressure for Size on, so a fresh brush -
and the brush Reset Tool hands back, which is that default plus
Photoshop's 10 % smoothing - reported pressureSize: true from brush.get
and drew the options bar's "Always use pressure for size" button
highlighted, while the reference application leaves both pressure
toggles off after Reset Tool. Neither is on now.
The toggle itself is untouched: it still switches both ways, Shape
Dynamics' Pen Pressure control is unaffected, and path.stroke's Simulate
Pressure still tapers a brush that follows pen pressure. A brush JSON
that omits pressureSize now reads as off, as the reference's default is.
Two engine tests took their expectation from the old default and set
pressureSize explicitly instead: cmd::brush_cmds::tests::stroke_backwards_compatible
and cmd::vector_cmds::tests::stroke_path_simulate_pressure_tapers_both_ends.
The new crates/engine/src/brush_pressure_size_default_tests.rs covers the
default, brush.get on a fresh session, an omitted field, switching the
toggle, and that a pressure ramp with the default brush paints like
pressureSize: false.
Fixes#11809
* perf(paint): sampled, textured and wet-edge dabs rasterize on all cores (#11350)
The general dab loop runs its rows on the thread pool, with the same pixels as serially.
It reaches the pool from about 16,000 pixels, a quarter of the round path's threshold.
* test(paint): the parallel-vs-serial depth test checks colour, not alpha, for painted pixels
The opaque background's alpha (1.0) is 0.5 away from 0.5, so the check
passed even if nothing was painted (CodeRabbit on #11369).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(paint): read pixels with as_chunks (clippy chunks_exact_to_as_chunks)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Thanks @wanikhawar — merging.
**Summary:** Sampled brush tip mip pyramids are reused across strokes and symmetry through a bounded LRU (64 entries / 256 MiB); Edit ▸ Purge All releases the cache. Bench + purge/render tests lock the behaviour.
Each new coverage tile zeroes 16 KB. The parallel path of
CoverageMap::accumulate did that on the calling thread while building
its work list, so a large dab's new tiles ran one at a time. Create
them inside the parallel section instead.
coverage_bench gains a large-dab line (3457x3457, what a soft 2000 px
tip covers). big_dab_bench's "accumulate" figure is relabelled: it is
a cold first push minus a warm rasterize, not accumulate alone.
Refs #11339
The key now uses the brightness and contrast values Texture::level uses (clamped, non-finite as 0, -0.0 as 0.0), so equal levels share one entry. The cache logic moves into a PatternCache struct so the eviction test runs on its own instance instead of the shared static.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CodeRabbit review points: a duplicate insert should promote the entry, the key-separation test could pass after the base entry was evicted, and the entry limit was untested.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CodeRabbit review points: the i32 rem_euclid in sample_bilinear_wrap differs from sample_wrap for sides past i32::MAX, and nothing checked the x/y argument order at the texture_at call.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
DabGenerator::walk collected every step of a segment into a Vec before building
dabs (up to 1e7 steps in the pixel-grid mode). The steps now become dabs as the
walker emits them. Non-finite opacity, flow, hardness and spacing fall back to the
defaults in bounded_for_render, and the smoother drops points without a finite
position.
Refs #11137
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
apply_mixer_dab read and converted the whole stroke working rectangle for every dab when a sample surface was given, which made Sample All Layers strokes quadratic. It now reads fp.rect clipped to the working rectangle, which is all apply_mixer_dab_region reads. Pixels are unchanged. Refs #11133.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Smudge writes its carry buffer straight into place (no Vec per pixel) and picks up row by row; mix_back and apply_coverage read the selection one row at a time instead of one tile lookup per pixel. Output is bit-identical, tests compare against the previous per-pixel code. Refs #11132.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
BrushContext::new regenerated the procedural texture and re-applied its levels for every stroke and every symmetry pass. A bounded LRU (4 entries, 16 MiB) keyed by style, size, seed and the level settings returns the identical image. Refs #11134.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Texture at a scale other than 100% made four sample_wrap calls per pixel,
eight rem_euclid in all. Wrap the two columns and rows once and read the four
texels directly; same bits out, with a test against the old four-call form.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Preserve both sparse and bounded-rectangle overlap paths after integrating #9852 with current main. Existing touches_covers_every_pixel_with_coverage covers negative coordinates, edges and huge rectangles. Combined CI will validate; no local build claimed.
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Preserve current spatial Mixer Brush Alt-click sampling and live transaction architecture; add compatible point-sample command without foreground mutation. Retain sample across automatic reload until foreground changes and preserve all new regressions.
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Ported Behind paint across engine/render and shared options-bar/canvas mode menus, preserving Clear and current popup ownership. Added localized responsive picker title/width and File Info multiline fields without dropping ordered fields, Browse or camera metadata; ported Pen anchor repositioning, copy cursor, grayscale-target sampling and authorized select-under-cursor dispatch into current modules with original regressions.
The trail mask is at most 1024 px on its long side, so on a big document
one mask pixel stands for k x k document pixels, and the Remove trail
sampled only each block's centre. A thin stroke that fell between the
centres (2 px on 6000x4000, k = 6; 4 px on 12000x8000, k = 12) showed no
tint at all, though every pixel it touched is removed. In reach mode a
mask pixel now takes the largest coverage of its whole block, clipped to
the document. Blocks no coverage tile reaches are skipped
(StrokeRenderer::touches), so releasing a whole stroke on a 30000x20000
document restamps in 0.22 s instead of 23 s.
Also pins the waiting strokes' kept tint where a later stroke restamps
its rectangle off its own path (fails with the base max removed).
Co-authored-by: Hartmut Nörenberg <55043719+hnoerenberg@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>