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

GPU accelerated rendering & Mouse-handler optimization #146

Merged
merged 10 commits into from
May 22, 2024
15 changes: 10 additions & 5 deletions src/renderer/canvas_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ export class CanvasManager {
this.indices = [];
}

// TODO: WARNING! This function uses ctx.getImageData() which forces
// the browser to turn off GPU accelerated canvas painting!
// It needs to be reworked to not use getImageData() anymore.
phschaad marked this conversation as resolved.
Show resolved Hide resolved
public isBlank(): boolean {
const ctx = this.canvas.getContext('2d');
if (!ctx)
Expand All @@ -247,11 +250,13 @@ export class CanvasManager {
return;
this.contention++;
this.request_scale = true;
if (this.isBlank()) {
this.renderer.set_bgcolor('black');
this.renderer.zoom_to_view(null, false);
diff = 0.01;
}

// Don't use the easteregg feature as long as isBlank() is not fixed!
// if (this.isBlank()) {
// this.renderer.set_bgcolor('black');
// this.renderer.zoom_to_view(null, false);
// diff = 0.01;
// }

this.scale_origin.x = x;
this.scale_origin.y = y;
Expand Down
Loading
Loading