Skip to content

Commit

Permalink
GPU accelerated rendering & Mouse-handler optimization (#146)
Browse files Browse the repository at this point in the history
* summarize edges setting under performance section & default on

* comment-out isBlank function that prevents GPU acceleration

* reduced ctx calls for summary and plus symbols

* removed old commit relics, ctx.ellipse comment

* added arrow LOD check for deferred edges

* moushandler more efficient hover computation

* replaced drawEllipse call, canvas ctx settings comments

* summarize edges default off, comments
  • Loading branch information
LeandroTreu committed May 22, 2024
1 parent 2ceba1d commit 5f34f33
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 310 deletions.
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.
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

0 comments on commit 5f34f33

Please sign in to comment.