Skip to content

Fix intersection bug in DrawTarget.copy_surface#213

Open
galenelias wants to merge 1 commit intojrmuizel:masterfrom
galenelias:user/galenelias/fixCopySurfaceBoundsChecking
Open

Fix intersection bug in DrawTarget.copy_surface#213
galenelias wants to merge 1 commit intojrmuizel:masterfrom
galenelias:user/galenelias/fixCopySurfaceBoundsChecking

Conversation

@galenelias
Copy link

If the src_rect passed to copy_surface is outside the src bounds then the copy_surface code doesn't offset correctly into 'dst'.

Rough illustration:

dest.copy_surface(&src, intrect(-1, -1, 1, 1), IntPoint::new(0, 0));
src_rect         dst expected
+---+            +---+
| +-|--+         |   |
| |x|  |         |  x|
+---+  |         +---+
  |    |
  +----+          dst actual
    src           +---+
                  |x  |
                  |   |
                  +---+

If the src_rect passed to copy_surface is outside the src bounds then
the copy_surface code doesn't offset correctly into 'dst'.

Rough illustration:

dest.copy_surface(&src, intrect(-1, -1, 1, 1), IntPoint::new(0, 0));

src_rect         dst expected
+---+            +---+
| +-|--+         |   |
| |x|  |         |  x|
+---+  |         +---+
  |    |
  +----+          dst actual
    src           +---+
                  |x  |
                  |   |
                  +---+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant