Repository: flutter
Issue: Canvas drawImageRect cannot restrict sampling to only pixels in the source rect
Labels: engine,c: rendering,has reproducible steps,P2,a: gamedev,found in release: 3.7,found in release: 3.9,team-engine,triaged-engine

I am making a game using Flutter, but I noticed something weird while trying to draw a sprite from a spritesheet, so I made an example to show the problem:

Lets say this image is a spritesheet, it is 64x128:

![test](https://user-images.githubusercontent.com/23214418/95692631-93d87500-0bfd-11eb-8195-89c85263cf61.png)

I split it in two and want to draw only the second part, I do it this way:
```dart
final src = Rect.fromLTWH(0, 64, 64, 64);
final dst = Rect.fromLTWH(0, y, 64, 64);
canvas.drawImageRect(testImage, src, dst, Paint());
```

If then, I move this sprite through the canvas, by incrementing the value of `y` by 0.1 every frame, the last row of the first part is drawn.

![ezgif com-gif-maker](https://user-images.githubusercontent.com/23214418/95692705-16613480-0bfe-11eb-8470-1c9baf6ef1e5.gif)

It should not draw the last row of the first sprite, because I made explicity that I only want the second half of the image to be drawn.

I tried it on iOS and macOS and got the same problem.

I made a repository where you can run it and see this behavior.
https://github.com/lslv1243/draw_image_rect_bug

<details>
<summary>flutter doctor</summary>
<br>

```
[✓] Flutter (Channel unknown, 1.22.0-12.1.pre, on Mac OS X 10.15.6 19G2021, locale pt)
    • Flutter version 1.22.0-12.1.pre at /Users/leonardosilva/development/flutter/flutter
    • Framework revision 8b3760638a (4 weeks ago), 2020-09-15 17:47:13 -0700
    • Engine revision 4654fc6cf6
    • Dart version 2.10.0 (build 2.10.0-110.3.beta)

 
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/leonardosilva/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.8.4

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.0

[✓] Connected device (4 available)
    • iPhone de Leonardo (mobile) • ac197a55a52fbad3d364054a4c99dbe29ed46b23 • ios            • iOS 14.0
    • macOS (desktop)             • macos                                    • darwin-x64     • Mac OS X
      10.15.6 19G2021
    • Web Server (web)            • web-server                               • web-javascript • Flutter
      Tools
    • Chrome (web)                • chrome                                   • web-javascript • Google
      Chrome 86.0.4240.75
```
</details>