mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 02:19:56 -06:00
Plug-ins: a filter's read-only objects stay in its input and failed decodes count
A filter run kept a second copy of every read-only object as JSON values.
The run now keeps where each object is in the input, and checks an output
entry against it by parsing that one object, unless the entry is `{"id": …}`
alone.
An image that reaches the decoder now counts toward the 16 MiB pixel total
even when decoding fails, so broken images use up the same total as images
that decode.
The plugin.run text, docs/mcp.md and the progress line state the paint
order and that rule, and docs/plugins.md states that a CMYK image's pixels
are sRGB. New tests cover the per-image 1 MiB, the 16 MiB pixel total and
the 16 MiB text total at and one past their values, memory-budget failures
before the plug-in starts, images that are not decoded, CMYK images
included, and leading per run.
This commit is contained in:
+6
-5
@@ -6644,11 +6644,12 @@ them again at startup (`plugin.remove` deletes them there):
|
||||
schema, defaults). An object filter runs on the selected paths and compound paths with `plugin.run {id, params}` (one
|
||||
undo step; it may change, delete or add objects, and the result is selected). A filter whose manifest lists `inputs`
|
||||
(`type`, `image`, `symbolInstance`; `inputs` in its `plugin.list` entry) also lists `doc.read` in its `permissions`, so
|
||||
`plugin.install` needs `grant`. It is also given the selected objects of those kinds to read, with at most 16 MiB of
|
||||
pixels and 16 MiB of type runs over one run (later ones come with `pixelsOmitted` or `truncated`). Every object counts
|
||||
toward the input's half of the plug-in's memory cap, ids, bounds, transforms and names included: pixels and runs that
|
||||
don't fit come the same way, and an object whose other fields don't fit makes `plugin.run` return a memory-budget error
|
||||
naming the object and its size, with nothing changed. A path or compound path that doesn't fit makes it return the
|
||||
`plugin.install` needs `grant`. It is also given the selected objects of those kinds to read, in paint order from the
|
||||
bottom, with at most 16 MiB of pixels and 16 MiB of type runs over one run (an object that doesn't fit what the objects
|
||||
before it left comes with `pixelsOmitted` or `truncated`; an image that reaches the decoder counts toward the pixels
|
||||
even when decoding fails). Every object counts toward the input's half of the plug-in's memory cap, ids, bounds,
|
||||
transforms and names included: pixels and runs that don't fit come the same way, and an object whose other fields don't
|
||||
fit makes `plugin.run` return a memory-budget error naming the object and its size, with nothing changed. A path or compound path that doesn't fit makes it return the
|
||||
memory-budget error `the selection is too large to hand over`, and more than 100,000 of these objects make it return
|
||||
an object-budget error. Its output returns
|
||||
each of them as `{"id": …}` or exactly as given, otherwise `plugin.run` returns an error naming the object and the
|
||||
|
||||
Reference in New Issue
Block a user