Repository navigation
fix(abr): read tool blend mode and opacity from MdSl - #283
Merged
Merged
Conversation
Fails until parse_tool_options reads the nested MdSl object.
A preset can store its tool blend mode and opacity in toolOptions/MdSl instead of the top-level Md and Opct keys. Map the MdSl layer key to its BlnM value id, read MdSl/Opct, and keep the top-level keys first.
A malformed MdSl ends the toolOptions read as the skip did before, instead of dropping the preset. Tests cover both key orders for top-level precedence, and the corpus test checks the layer key maps to a BlnM id.
Owner
Author
|
PASS Independently verified
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A consumer of
brushkit-abrneeds the tool blend mode and opacity of every preset (pmwoz/abr2brushset-app#912). Some presets store both in a nestedMdSlobject insidetoolOptions, and the parser read only the top-levelMdandOpctkeys. SoToolOptions::blend_modeandopacity_pctwereNonefor such a preset.What changed
parse_tool_optionsreadsMdSl/Opctintoopacity_pct. It maps the layer blend keyMdSl/Kyto itsBlnMvalue id inblend_mode, with the 27 pairs from the issue's D2. An unknown key reads as the raw four bytes.MdorOpctwins overMdSlin either key order.MdSlends thetoolOptionsread and keeps the preset, as the old skip did.ToolOptions::blend_modeandopacity_pctnameMdSlas the second source.Scope
MdSl/SgntandMdSl/Clppstay unread.Verification
descriptor::tests.mdsl_supplies_blend_mode_and_opacityreadsmuland 35 asSome("Mltp")andSome(35).top_level_md_and_opct_win_over_mdsl_in_either_orderreads the top-level values with them before and afterMdSl.unknown_mdsl_layer_key_reads_rawreadszzzasSome("zzz "). The first and third fail before the fix.malformed_mdsl_keeps_the_preset_and_earlier_tool_optionsfails when theMdSlerror drops the preset.corpus_smoke::every_corpus_mdsl_preset_reads_its_blend_mode_and_opacity(runs withBRUSHKIT_CORPUS_DIR) checks every corpus preset that stores its opacity only inMdSl. One preset in a 140-pack corpus has it. Before the fix,opacity_pctisNoneand the test fails. After, it reads 35 andMltp.cargo test --workspacewith the corpus, clippy with-D warnings, and the wasm32 build pass locally.Closes #282