Skip to content

Commit

Permalink
1.13.23
Browse files Browse the repository at this point in the history
  • Loading branch information
quinton-ashley committed Nov 22, 2024
1 parent 5618ea2 commit 7cfd076
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
"version": "git add -A",
"postversion": "git push"
},
"version": "1.13.22"
"version": "1.13.23"
}
16 changes: 9 additions & 7 deletions v3/q5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,9 @@ Q5.renderers.q2d.image = ($, q) => {
if (!sh) {
sh = drawable.height || drawable.videoHeight;
} else sh *= pd;
$.ctx.drawImage(drawable, sx * pd, sy * pd, sw, sh, dx, dy, dw, dh);
sx *= pd;
sy *= pd;
$.ctx.drawImage(drawable, sx, sy, sw, sh, dx, dy, dw, dh);

if ($._tint) {
$.ctx.save();
Expand All @@ -1368,21 +1370,21 @@ Q5.renderers.q2d.image = ($, q) => {
$.ctx.shadowBlur = 0;

if (img.canvas.alpha) {
img.tintImg ??= $.createImage(dw, dh);
if (img.tintImg.width != dw || img.tintImg.height != dh) {
img.tintImg.resize(dw, dh);
img.tintImg ??= $.createImage(img.w, img.h, { pixelDensity: pd });
if (img.tintImg.width != img.width || img.tintImg.height != img.height) {
img.tintImg.resize(img.w, img.h);
}

let tnt = img.tintImg.ctx;
tnt.globalCompositeOperation = 'copy';
tnt.fillStyle = $._tint;
tnt.fillRect(0, 0, dw, dh);
tnt.fillRect(0, 0, img.width, img.height);

tnt.globalCompositeOperation = 'destination-in';
tnt.drawImage(drawable, 0, 0, dw, dh);
tnt.drawImage(drawable, 0, 0, img.width, img.height);

$.ctx.globalCompositeOperation = 'multiply';
$.ctx.drawImage(img.tintImg.canvas, 0, 0, dw, dh, dx, dy, dw, dh);
$.ctx.drawImage(img.tintImg.canvas, sx, sy, sw, sh, dx, dy, dw, dh);
} else {
$.ctx.globalCompositeOperation = 'multiply';
$.ctx.fillStyle = $._tint;
Expand Down
2 changes: 1 addition & 1 deletion v3/q5.min.js

Large diffs are not rendered by default.

0 comments on commit 7cfd076

Please sign in to comment.