Skip to content

[vector_graphics_codec] Add support for encoding and decoding paint blur commands - #13148

Merged
auto-submit[bot] merged 4 commits into
flutter:mainfrom
edwin-hollen:upstream-svg-codec-blur
Oct 14, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:mainfrom
edwin-hollen:upstream-svg-codec-blur

Conversation

@edwin-hollen

@edwin-hollen edwin-hollen commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds a new _paintBlurTag command (writePaintBlur / onPaintBlur) to vector_graphics_codec (1.2.0) to support encoding and decoding Gaussian blur image filters (sigmaX, sigmaY) alongside paint records.

This is split out from #11909 so the codec changes can land and be published first.

Part of flutter/flutter#158592

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions Bot added p: vector_graphics triage-engine Should be looked at in engine triage labels Oct 6, 2026
@edwin-hollen edwin-hollen changed the title [vector_graphics_codec] Add writePaintBlur and onPaintBlur support [vector_graphics_codec] Add support for encoding and decoding paint blur commands Oct 6, 2026
@edwin-hollen
edwin-hollen marked this pull request as ready for review October 6, 2026 18:47

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for encoding and decoding paint blur commands (writePaintBlur and onPaintBlur) in the vector_graphics_codec package, including corresponding unit tests. The review feedback suggests adding assertions to validate paintId and ensure sigmaX and sigmaY are non-negative, and updating the unit test to assert the exact sequence of decoded commands rather than using a partial match.

Comment on lines +968 to +974
void writePaintBlur(VectorGraphicsBuffer buffer, int paintId, double sigmaX, double sigmaY) {
buffer._checkPhase(_CurrentSection.paints);
buffer._putUint8(_paintBlurTag);
buffer._putUint16(paintId);
buffer._putFloat32(sigmaX);
buffer._putFloat32(sigmaY);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add assertions to validate that paintId is within the valid range (0 to kMaxId) and that the Gaussian blur standard deviations (sigmaX and sigmaY) are non-negative. Negative standard deviations are mathematically invalid for Gaussian blurs and will cause rendering errors.

  void writePaintBlur(VectorGraphicsBuffer buffer, int paintId, double sigmaX, double sigmaY) {
    assert(paintId >= 0 && paintId < kMaxId);
    assert(sigmaX >= 0.0);
    assert(sigmaY >= 0.0);
    buffer._checkPhase(_CurrentSection.paints);
    buffer._putUint8(_paintBlurTag);
    buffer._putUint16(paintId);
    buffer._putFloat32(sigmaX);
    buffer._putFloat32(sigmaY);
  }

Comment on lines +128 to +144
test('Can encode and decode paint blur', () {
final buffer = VectorGraphicsBuffer();
final listener = TestListener();
final int paintId = codec.writeFill(buffer, 23, 0);
codec.writePaintBlur(buffer, paintId, 2.5, 3.5);
final int pathId = codec.writePath(
buffer,
Uint8List.fromList(<int>[ControlPointTypes.moveTo, ControlPointTypes.close]),
Float32List.fromList(<double>[1, 2]),
0,
);
codec.writeDrawPath(buffer, pathId, paintId, null);

codec.decode(buffer.done(), listener);

expect(listener.commands, contains(OnPaintBlur(paintId, 2.5, 3.5)));
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of using contains to only check for the presence of OnPaintBlur, verify the exact list of decoded commands. This ensures that the commands are decoded in the correct order and that no extra or malformed commands are generated, matching the style of other tests in this file.

  test('Can encode and decode paint blur', () {
    final buffer = VectorGraphicsBuffer();
    final listener = TestListener();
    final int paintId = codec.writeFill(buffer, 23, 0);
    codec.writePaintBlur(buffer, paintId, 2.5, 3.5);
    final int pathId = codec.writePath(
      buffer,
      Uint8List.fromList(<int>[ControlPointTypes.moveTo, ControlPointTypes.close]),
      Float32List.fromList(<double>[1, 2]),
      0,
    );
    codec.writeDrawPath(buffer, pathId, paintId, null);

    codec.decode(buffer.done(), listener);

    expect(listener.commands, <Object>[
      OnPaintObject(
        color: 23,
        strokeCap: null,
        strokeJoin: null,
        blendMode: 0,
        strokeMiterLimit: null,
        strokeWidth: null,
        paintStyle: 0,
        id: paintId,
        shaderId: null,
      ),
      OnPaintBlur(paintId, 2.5, 3.5),
      OnPathStart(pathId, 0),
      const OnPathMoveTo(1, 2),
      const OnPathClose(),
      const OnPathFinished(),
      OnDrawPath(pathId, paintId, null),
    ]);
  });

@edwin-hollen

Copy link
Copy Markdown
Contributor Author

@walley892 for visibility

Add assertions for paintId, sigmaX, and sigmaY in writePaintBlur and
assert the full decoded command sequence in vector_graphics_codec_test.
@tarrinneal
tarrinneal requested a review from jtmcdole October 6, 2026 20:59
@walley892
walley892 requested review from walley892 and removed request for jtmcdole October 12, 2026 21:37
Comment thread packages/vector_graphics_codec/lib/vector_graphics_codec.dart Outdated
Comment thread packages/vector_graphics_codec/CHANGELOG.md Outdated
Comment thread packages/vector_graphics_codec/lib/vector_graphics_codec.dart Outdated
@walley892 walley892 added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Oct 14, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2026
@auto-submit

auto-submit Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/13148, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@walley892
walley892 requested a review from gaaclarke October 14, 2026 19:57

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2026
@auto-submit
auto-submit Bot merged commit 2eb4c71 into flutter:main Oct 14, 2026
13 checks passed
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Oct 15, 2026
…4459)

Roll Packages from a1ed23c to da40eaf4548a (33 revisions)

flutter/packages@a1ed23c...da40eaf

2026-10-15 tarrinneal@gmail.com [pigeon]add support for sealed classes
in native interop (flutter/packages#13175)
2026-10-15 tarrinneal@gmail.com [pigeon] Replace full JNI bindings with
stubs for API classes that aren't needed (flutter/packages#13173)
2026-10-14 ksanaullah383.khan@gmail.com [material_ui] Fix
self-comparison and assert bugs in semantics_tester
(flutter/packages#12722)
2026-10-14 magder@google.com [camera_avfoundation] Replace the
deprecated 'videoOrientation' with 'videoRotationAngle' on iOS 17+
(flutter/packages#13247)
2026-10-14 zengyan@88.com [material_ui] Fix GridTile crash when the
incoming constraints are unbounded (flutter/packages#12586)
2026-10-14 magder@google.com [in_app_purchase_storekit] Remove unused
and deprecated "SKDownload" hosted content (flutter/packages#13222)
2026-10-14 55765052+MohanadAbdallah-mv@users.noreply.github.com
[material_ui] Add supportingTextPadding to InputDecorator
(flutter/packages#12769)
2026-10-14 37883572+edwin-hollen@users.noreply.github.com
[vector_graphics_codec] Add support for encoding and decoding paint blur
commands (flutter/packages#13148)
2026-10-14 ketulm8@gmail.com [go_router] Fix redirect zone async error
handling (flutter/packages#12836)
2026-10-14 fluttergithubbot@gmail.com Sync release-go_router-18.1.0 to
main (flutter/packages#13260)
2026-10-14 fluttergithubbot@gmail.com Sync release-cupertino_ui-1.1.3 to
main (flutter/packages#13258)
2026-10-14 lsaudon@gmail.com [material_ui] add enableInlinePrediction
parameter to TextFormField (flutter/packages#12793)
2026-10-14 fluttergithubbot@gmail.com Sync release-material_ui-1.7.0 to
main (flutter/packages#13259)
2026-10-14 sokolovskyi.konstantin@gmail.com [material_ui] Add the
Material shapes. (flutter/packages#12771)
2026-10-14 64028623+Ahtsham0715@users.noreply.github.com [material_ui]
Add tertiary tap callbacks to InkResponse and InkWell
(flutter/packages#12676)
2026-10-14 engine-flutter-autoroll@skia.org Roll Flutter from
4249ccb to 426be96 (44 revisions) (flutter/packages#13256)
2026-10-14 47866232+chunhtai@users.noreply.github.com [material_ui]
fixes expanded state in the a11y_assessment home page dropdown
(flutter/packages#13219)
2026-10-14 zhongliu88889@gmail.com [VPAT] Fix semantics in
a11y_assessments drawer, radio, and rail demos (flutter/packages#13159)
2026-10-14 5684363+tenninebt@users.noreply.github.com
[google_maps_flutter] Add onPointOfInterestTap (flutter/packages#11872)
2026-10-14 Gornivv@gmail.com [go_router] Fix shell route key collisions
and dynamic branch updates (flutter/packages#12549)
2026-10-14 engine-flutter-autoroll@skia.org Manual roll Flutter from
d03768e to 4249ccb (158 revisions) (flutter/packages#13220)
2026-10-14 okorohelijah@google.com [image_picker_ios] Require Flutter
3.47 / iOS 15 and drop deprecated kUTType code paths
(flutter/packages#13224)
2026-10-13 louisehsu@google.com [in_app_purchase_storekit] Fixes
Storekit 2 flaky tests (flutter/packages#13213)
2026-10-13 stuartmorgan@google.com [local_auth] Convert Android to new
Pigeon suspend support (flutter/packages#12894)
2026-10-13 50643541+Mairramer@users.noreply.github.com [material_ui] Add
enabled parameter to DropdownButtonFormField (flutter/packages#12610)
2026-10-13 molchanovia.dev@gmail.com [go_router] Link ShellRoute docs to
StatefulShellRoute (flutter/packages#13120)
2026-10-13 jmccandless@google.com FadeForwards page transition
performance (flutter/packages#13161)
2026-10-13 101952451+eszter-varga@users.noreply.github.com
[in_app_purchase_android] Guard async billing callbacks against
duplicate listener responses (flutter/packages#12640)
2026-10-13 victor.orozco@cloudsufi.com [google_sign_in] Remove the
Objective-C exception catcher (flutter/packages#13156)
2026-10-13 magder@google.com [camera_avfoundation] Remove availability
checks below the package minimum iOS 13 (flutter/packages#13214)
2026-10-13 magder@google.com [google_maps_flutter_ios] Remove iOS 14
availability check from example UI tests (flutter/packages#13218)
2026-10-13 stuartmorgan@google.com [google_sign_in] Convert
implementation to Kotlin (flutter/packages#13005)
2026-10-13 victor.orozco@cloudsufi.com [image_picker_ios] PR 2/5 Add a
PHImageManager image-data seam and migrate plugin native tests to Swift
Testing (flutter/packages#13079)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
@edwin-hollen

Copy link
Copy Markdown
Contributor Author

@gaaclarke The post-submit release run for this PR failed at "Wait for test check-in" (https://github.com/flutter/packages/actions/runs/38633635933), so vector_graphics_codec 1.2.0 hasn't been published to pub.dev yet (blocking #11909). Could you re-run that release job when you get a chance?

suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…4459)

Roll Packages from a1ed23c to da40eaf4548a (33 revisions)

flutter/packages@a1ed23c...da40eaf

2026-10-15 tarrinneal@gmail.com [pigeon]add support for sealed classes
in native interop (flutter/packages#13175)
2026-10-15 tarrinneal@gmail.com [pigeon] Replace full JNI bindings with
stubs for API classes that aren't needed (flutter/packages#13173)
2026-10-14 ksanaullah383.khan@gmail.com [material_ui] Fix
self-comparison and assert bugs in semantics_tester
(flutter/packages#12722)
2026-10-14 magder@google.com [camera_avfoundation] Replace the
deprecated 'videoOrientation' with 'videoRotationAngle' on iOS 17+
(flutter/packages#13247)
2026-10-14 zengyan@88.com [material_ui] Fix GridTile crash when the
incoming constraints are unbounded (flutter/packages#12586)
2026-10-14 magder@google.com [in_app_purchase_storekit] Remove unused
and deprecated "SKDownload" hosted content (flutter/packages#13222)
2026-10-14 55765052+MohanadAbdallah-mv@users.noreply.github.com
[material_ui] Add supportingTextPadding to InputDecorator
(flutter/packages#12769)
2026-10-14 37883572+edwin-hollen@users.noreply.github.com
[vector_graphics_codec] Add support for encoding and decoding paint blur
commands (flutter/packages#13148)
2026-10-14 ketulm8@gmail.com [go_router] Fix redirect zone async error
handling (flutter/packages#12836)
2026-10-14 fluttergithubbot@gmail.com Sync release-go_router-18.1.0 to
main (flutter/packages#13260)
2026-10-14 fluttergithubbot@gmail.com Sync release-cupertino_ui-1.1.3 to
main (flutter/packages#13258)
2026-10-14 lsaudon@gmail.com [material_ui] add enableInlinePrediction
parameter to TextFormField (flutter/packages#12793)
2026-10-14 fluttergithubbot@gmail.com Sync release-material_ui-1.7.0 to
main (flutter/packages#13259)
2026-10-14 sokolovskyi.konstantin@gmail.com [material_ui] Add the
Material shapes. (flutter/packages#12771)
2026-10-14 64028623+Ahtsham0715@users.noreply.github.com [material_ui]
Add tertiary tap callbacks to InkResponse and InkWell
(flutter/packages#12676)
2026-10-14 engine-flutter-autoroll@skia.org Roll Flutter from
4249ccb to 426be96 (44 revisions) (flutter/packages#13256)
2026-10-14 47866232+chunhtai@users.noreply.github.com [material_ui]
fixes expanded state in the a11y_assessment home page dropdown
(flutter/packages#13219)
2026-10-14 zhongliu88889@gmail.com [VPAT] Fix semantics in
a11y_assessments drawer, radio, and rail demos (flutter/packages#13159)
2026-10-14 5684363+tenninebt@users.noreply.github.com
[google_maps_flutter] Add onPointOfInterestTap (flutter/packages#11872)
2026-10-14 Gornivv@gmail.com [go_router] Fix shell route key collisions
and dynamic branch updates (flutter/packages#12549)
2026-10-14 engine-flutter-autoroll@skia.org Manual roll Flutter from
d03768e to 4249ccb (158 revisions) (flutter/packages#13220)
2026-10-14 okorohelijah@google.com [image_picker_ios] Require Flutter
3.47 / iOS 15 and drop deprecated kUTType code paths
(flutter/packages#13224)
2026-10-13 louisehsu@google.com [in_app_purchase_storekit] Fixes
Storekit 2 flaky tests (flutter/packages#13213)
2026-10-13 stuartmorgan@google.com [local_auth] Convert Android to new
Pigeon suspend support (flutter/packages#12894)
2026-10-13 50643541+Mairramer@users.noreply.github.com [material_ui] Add
enabled parameter to DropdownButtonFormField (flutter/packages#12610)
2026-10-13 molchanovia.dev@gmail.com [go_router] Link ShellRoute docs to
StatefulShellRoute (flutter/packages#13120)
2026-10-13 jmccandless@google.com FadeForwards page transition
performance (flutter/packages#13161)
2026-10-13 101952451+eszter-varga@users.noreply.github.com
[in_app_purchase_android] Guard async billing callbacks against
duplicate listener responses (flutter/packages#12640)
2026-10-13 victor.orozco@cloudsufi.com [google_sign_in] Remove the
Objective-C exception catcher (flutter/packages#13156)
2026-10-13 magder@google.com [camera_avfoundation] Remove availability
checks below the package minimum iOS 13 (flutter/packages#13214)
2026-10-13 magder@google.com [google_maps_flutter_ios] Remove iOS 14
availability check from example UI tests (flutter/packages#13218)
2026-10-13 stuartmorgan@google.com [google_sign_in] Convert
implementation to Kotlin (flutter/packages#13005)
2026-10-13 victor.orozco@cloudsufi.com [image_picker_ios] PR 2/5 Add a
PHImageManager image-data seam and migrate plugin native tests to Swift
Testing (flutter/packages#13079)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: vector_graphics triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants