reads_of kept one process-wide count per buffer address and never forgot it, so a
buffer freed by a test running alongside could pass its count to a new buffer the
allocator put at the same address. On Windows, linked_pages_read_the_file_once_and_a_blank_page_keeps_its_crop_box
saw 2 such stale reads in the full cargo test run of 7481fd3a while passing alone.
Keying by address and length keeps a freed buffer's count from carrying over.
A placed image of more pixels than the writer is given (2^27) was left out of
the PDF, with the warning for an image that can't be decoded (#10490). It is
now decoded as Open and Place decode it, within MAX_RASTER_ALLOC and by the
decoders that refuse a file too short for the pixels it declares, and scaled
down to the most pixels that fit before the Compression and Output settings
apply. The warning gives its size and the size written. An image that can't
be scaled down (beyond the allowance, or CMYK) is still left out, and the
warning gives its size as the cause.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit df730ecbcd)
Backport the PDF option handling from 82d4ec4336. Apply it to editable and linked opens while preserving the original file when an alternate box was requested.
Opening a PDF with editing data without naming a box gives its trim boxes,
but the Import PDF dialog always sent cropTo, so OK with Crop To left as it
started opened the crop boxes instead. Opening such a file, Crop To now
starts on Trim Box, also once a password unlocks it, and OK names the box
only when one was picked. Picking Crop Box still opens the crop boxes, and
a place still starts on Crop Box.
When the planar map is skipped because the paths have too many pieces
(SHAPE_BUILDER_MAX_MAP_EDGES, added in 7a46d5ec56), too many segments
or exceed the sweep's work budget, Divide with open paths fell back to
the filled areas. It replaced the selection with the uncut shapes and
deleted the cutting paths without saying so. Live Paint built no faces:
Make reported the paths as too degenerate to paint, and with Gap
Detection a group could get its edges and no faces.
pathops now has try_pathfinder_with, try_live_paint and
try_live_paint_with_gaps, which return TooManyPieces in those cases
without sweeping the filled areas. Divide, Live Paint Make, Merge and
Gap Options use them and stop with an error that leaves the art
unchanged. The caps, and the fallbacks of pathfinder_with, live_paint,
live_paint_with_gaps and the Shape Builder, are unchanged.
When a Gap Options preview fails after one that found gaps, the dialog
no longer keeps drawing the earlier preview's gaps over the groups the
failure put back.
Docs: docs/mcp.md, the commands' params text and the Divide line in
docs/target-app-parity.md.
A raw bitmap with no width or no height is not taken in place of the
text beside it, so the text is pasted. Bytes past a raw bitmap's pixels
are dropped before the pixels are stored, so the PNG encoder is given
exactly the pixels the size names and the paste goes through.
(cherry picked from commit 6a4c1e6af9)
When a picture is read later in place of text that only names it, a raw
bitmap whose pixels don't fill the size in its header is not taken: the
text beside it is pasted, as for any picture that can't be read. A raw
bitmap with no text beside it is still read and its error reported.
read_pixels documents what happens when the renderers' store refuses
the decoded pixels: they are dropped, and the PNG is decoded as any
other image is. A render test covers that case.
(cherry picked from commit 438ffdcebe)
A paste of a picture copied in a browser or another app read the
clipboard's pixels, encoded them as PNG, then decoded that PNG again to
check it before keeping it. The paste now encodes the pixels once for the
document and keeps the pixels it already has as the decoded image the
canvas draws, so the read decodes nothing.
decode::decodes counts the images decode_image decodes on a thread, and
the new test checks that such a paste decodes none.
(cherry picked from commit ea828714fb)
The shared swatch pair exposes unnamed radio parts. Drive real clicks on the exposed area of Stroke and Fill and keep the original paint and modifier assertions.
Restore the glide when Zoom with Scroll Wheel and Animated Zoom are both on, as in 0.24.1. The canvas keeps precision point input and pinches immediate. Tracks #10418.
With one image selected, the Control bar and the Properties panel ask
image.info for its details again after every change to the document,
each step of a drag included. image.info decoded the whole image to
find its color mode, so dragging or redrawing a large placed image
(about 8000 x 4000 px) spent hundreds of milliseconds per step on the
UI thread. A group holding the image did not lag.
image.info and file.place.info now read the color mode from the
header of a PNG, JPEG, TIFF, PSD, GIF or BMP file, and report RGB for
WebP, without decoding the pixels. Other formats are still decoded.
(cherry picked from commit 194de01a52)
The canvas kept the selection's outlines, anchors and dots only while the
document revision stayed the same, so every move command, nudge and drag
step built them again from every selected object. With 10,000 selected
rectangles one build took about 26 ms in a release build.
A move of whole objects now records the documents before and after it
and the distance (DocState::moved). The record is made only when each
moved object is still the node the transform left (no later pass, such
as the pixel grid snap, changed it), none is a member of a blend, and
every object the selection shows, the key object and the key anchor's
object included, is a moved object or inside one. Copies, scales, moves
of patterns alone and moves that resize type areas make no record.
The canvas moves its kept marks by that distance when the record names
the document they show, or the document a drag began with. It also keeps
them through a new revision of the same document and selection, as at
the end of a drag. Every other change builds them as before.
(cherry picked from commit 389fc65631)
The Scale Cursor Proportional to UI preference was never passed to the
interface, so painted tool cursors always grew with UI Scaling and showed
twice as large at 200%. The preference now decides it, and it is off by
default.
(cherry picked from commit 0ef22709c1)
When the sweep cuts the paths into more than SHAPE_BUILDER_MAX_MAP_EDGES
pieces, the Shape Builder falls back to the regions of the filled areas,
which are capped separately. The docs said it then finds no regions.
(cherry picked from commit 1b59873456)
Paths that cross each other many times are cut by the sweep into far
more pieces than they have segments, and building the regions and edges
of those pieces took minutes and gigabytes of memory. 400 circles
stacked nearly on top of each other (1,600 segments) were cut into
about 320,000 pieces, and their map took 60 s and 4.2 GB, enough to
make the whole computer unresponsive.
The Shape Builder now stops after the sweep when it cuts the paths into
more than SHAPE_BUILDER_MAX_MAP_EDGES pieces (twice
SHAPE_BUILDER_MAX_SEGMENTS, what open paths that cross nothing make at
that cap) and finds no regions. The filled-area regions it falls back
to are capped the same way.
(cherry picked from commit 7a46d5ec56)
A corner in one subpath gave the stroke's join to the lines of a curve
in another subpath that met at the same point, so a miter could be
drawn there instead of a round join. The corners are now kept per
subpath and each subpath of the outline reads only its own.
Test: a curve's outline is the same with and without a second subpath
that has a corner at the curve's start.
(cherry picked from commit f1ef1a4e39)
Since #9972 a thin stroke along a curve is drawn as lines, and where two
of those lines met at a sharp angle the stroke's own join was drawn
there. Along smooth anchors that sit close together after a bend, or a
curve that bends tightly, the lines turn sharply, so a miter join drew a
spike past the stroke and the smooth curve showed sharp corners on the
canvas. The document's anchors are unchanged; only the drawing was
wrong.
The stroke's join is now drawn only at the path's own corners, where
two segments meet with tangents that are not in line. Where the lines a
curve is drawn with turn sharply they meet with a round join, as the
stroke along the curve itself is round there.
Tests: a bend followed by smooth anchors 0.1 and 1 apart keeps every
outline point within the stroke's width of the curve and covers it;
with long handles the outline matches the curve's own outline away
from its edge; 200 random cubics with a miter join keep their outline
within the stroke's width of the curve.
(cherry picked from commit 69ff74a63b)