Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clipping not being applied to the source in drawCanvas() 9-argument version #179

Merged

Conversation

mpaperno
Copy link
Contributor

@mpaperno mpaperno commented Oct 29, 2024

The drawCanvas() test below should look like the drawImage() one above it. Same source image, same coordinates used, but source image first drawn another canvas at full size.

// tests['drawImage ....
  img.onload = function () {
    ctx.drawImage(img, 13, 13, 45, 45, 25, 25, img.width / 2, img.height / 2)
  }

// tests['drawCanvas ....
  img.onload = function () {
    const ctx2 = new Canvas(200,200).getContext('2d');
    ctx2.drawImage(img, 0, 0);
    ctx.drawCanvas(ctx2.canvas, 13, 13, 45, 45, 25, 25, img.width / 2, img.height / 2)
  }

image

The canvas' Picture can't be clipped, as far as I can tell, and there's no SkCanvs.draw_picture() version that takes a clip, like with draw_image_rect_..(), so I clipped the destination canvas instead.

image

This came up while I was working on SVG rendering and was doing a final check, expecting the current Content2D.draw_picture() to take care of things once given a Picture... then was surprised. Luckily thought to test with drawCanvas() first before assuming it had anything to do with SVG specifically.

@samizdatco samizdatco merged commit b7eb9ff into samizdatco:maintenance-2024 Oct 30, 2024
@samizdatco samizdatco mentioned this pull request Oct 30, 2024
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.

2 participants