Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/core/p5.Renderer2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,16 @@ class Renderer2D extends Renderer {
// round down to get integer numbers
x = Math.floor(x);
y = Math.floor(y);
if (imgOrCol instanceof Image) {
if (imgOrCol instanceof Graphics) {
this.drawingContext.save();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, is the code in this branch the same as in the Image branch though? if so maybe we can simplify this by using an || condition and just having it be one branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are the same. I will update it.

this.drawingContext.setTransform(1, 0, 0, 1, 0, 0);
this.drawingContext.scale(
this._pixelDensity,
this._pixelDensity
);
this.drawingContext.drawImage(imgOrCol.canvas, x, y);
this.drawingContext.restore();
} else if (imgOrCol instanceof Image) {
this.drawingContext.save();
this.drawingContext.setTransform(1, 0, 0, 1, 0, 0);
this.drawingContext.scale(
Expand Down
Loading