Skip to content

Commit

Permalink
fix: draw canvas on canvas clip (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn authored Feb 22, 2025
1 parent 27e1cc8 commit e609b20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions skia-c/skia_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,11 @@ extern "C"
CANVAS_CAST->save();
// Translate to the destination position
CANVAS_CAST->translate(dx, dy);
CANVAS_CAST->clipRect(SkRect::MakeWH(d_width, d_height));
// Scale using the ratio of destination size to source surface size
CANVAS_CAST->scale(
d_width / src_surface->width(),
d_height / src_surface->height()
d_width / s_width,
d_height / s_height
);
// Draw the surface directly
src_surface->draw(CANVAS_CAST, -sx, -sy, sampling, paint);
Expand Down

0 comments on commit e609b20

Please sign in to comment.