Repository: flutter
Issue: Thin lines/borders appear when using `LinearGradient` with a `ShaderMask` 
Labels: framework,c: rendering,a: desktop,has reproducible steps,P2,found in release: 3.3,found in release: 3.6,team-framework,triaged-framework

We built a carousel that contains buttons on the left and right side. These contain a linear gradient. When scrolling, it sometimes happens that strange lines appears. This is only on Windows.

<details>
<summary>Code sample</summary>
<br>

**Carousel**

```dart
@override
  Widget build(BuildContext context) {
    // Initially scroll if requested by widget
    // We don't want this side effect of `build()` to run everytime so be careful when changing anything around this
    if (!_initiallyScrolled) {
      SchedulerBinding.instance.addPostFrameCallback((_) {
        if (widget.initialOffset != null) {
          _scrollController.jumpTo(widget.initialOffset!);
        } else if (widget.initiallyCenter) {
          _scrollController.jumpTo((_scrollController.position.maxScrollExtent / 2 + widget.centerOffset!) - _scrollController.position.pixels);
        }
        setState(() => _initiallyScrolled = true);
      });
    }

    return Stack(
      children: [
        Positioned.fill(
          child: CustomScrollView(
            scrollBehavior: ScrollConfiguration.of(context).copyWith(
              scrollbars: false,
              // no harm in allowing dragging on all platforms
              dragDevices: {...PointerDeviceKind.values},
            ),
            controller: _scrollController,
            scrollDirection: Axis.horizontal,
            slivers: [
              SliverPadding(
                padding: widget.padding ?? EdgeInsets.zero,
                sliver: SliverList(
                  delegate: SliverChildBuilderDelegate(
                    widget.itemBuilder,
                    childCount: widget.itemCount,
                  ),
                ),
              ),
            ],
          ),
        ),
        // no scroll buttons on touch devices
        if (context.watch<DevicePointerType>().type != ui.PointerDeviceKind.touch) ...[
          _ScrollButton.forward(scrollController: _scrollController),
          _ScrollButton.backward(scrollController: _scrollController),
        ],
      ],
    );
  }
```

**ScrollButton**
```dart
@override
  Widget build(BuildContext context) {
    final customTheme = CustomTheme.of(context);
    return Align(
      alignment: _alignment,
      child: AnimatedBuilder(
        animation: scrollController,
        child: Stack(
          alignment: Alignment.center,
          children: [
            // fading edge
            IgnorePointer(
              child: ShaderMask(
                blendMode: ui.BlendMode.dstOut,
                shaderCallback: (Rect bounds) {
                  return LinearGradient(
                    transform: GradientRotation(_forward ? 0 : math.pi),
                    colors: [customTheme.spaceEditCarouselFadeColor, Colors.transparent],
                    begin: Alignment.centerLeft,
                    end: Alignment.centerRight,
                    stops: const [0.5, 1],
                  ).createShader(bounds);
                },
                child: Container(
                  width: 200 + _kButtonWidth,
                  height: 120,
                  color: customTheme.spaceEditCarouselBackgroundColor,
                ),
              ),
            ),
            Container(
              width: _kButtonWidth,
              child: Material(
                elevation: 10,
                color: customTheme.spaceEditCarouselButtonColor.withOpacity(0.8),
                clipBehavior: Clip.hardEdge,
                shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(ui.Radius.circular(12.0))),
                child: IconButton(
                  icon: _icon,
                  iconSize: 20,
                  onPressed: () {
                    if (!scrollController.hasClients || !scrollController.position.hasViewportDimension) return;

                    scrollController.animateTo(
                      scrollController.position.pixels +
                          (_forward ? 1 : -1) *
                              math.min(
                                scrollController.position.extentInside,
                                _forward ? scrollController.position.extentAfter : scrollController.position.extentBefore,
                              ),
                      duration: const Duration(seconds: 2),
                      curve: Curves.fastLinearToSlowEaseIn,
                    );
                  },
                ),
              ),
            ),
          ],
        ),
        builder: (context, child) {
          bool isFirstFrame = !scrollController.hasClients || !scrollController.position.hasViewportDimension;
          if (isFirstFrame) {
            // Heuristic: We assuming that there is an extent in the scroll direction.
            // This save us from showing UI based of post-frame measurements which usually feel janky for users.
            return _forward ? child! : Container();
          } else {
            // paint button whenever we aren't at an edge (with a padding of 10) of the viewport yet
            if ((_forward ? scrollController.position.extentAfter : scrollController.position.extentBefore) >= 10) {
              return child!;
            } else {
              return Container();
            }
          }
        },
      ),
    );
  }
```

</details>

<details>
  <summary>flutter doctor -v</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19044.2251], locale de-DE)
    • Flutter version 3.3.8 on channel stable at C:\Users\leon\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (9 days ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.3.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.3.32922.545
    • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code (version 1.73.1)
    • VS Code at C:\Users\leon\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.52.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.2251]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 105.0.5195.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 106.0.1370.47

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
```

</details>

![Bildschirmfoto 2022-11-18 um 13 51 25](https://user-images.githubusercontent.com/25419507/202709324-57605e89-daf0-4512-bdd9-aa2bdd3a7303.png)