forked from Blendman974/faceclaw
Add a performance tracing system (FrameTimings) and fix a big that would cause 6-second stalls
This commit is contained in:
1 parent
971b04f677
commit
630b511d32
11 files changed
+786
-72
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { spanCurrent } from "../../native/frame-timings";
|
||||
import { BATTERY_ICON_WIDTH, drawBattery } from "../../graphics/battery";
|
||||
import { readActiveNotificationIcons } from "../../native/notification-icons";
|
||||
import { readPhoneBatteryState } from "../../native/phone-battery";
|
||||
@@ -149,6 +150,7 @@ function pad2(value: number): string {
|
||||
}
|
||||
|
||||
export function drawSystemCard(image: GrayImage, bounds: DashboardPluginCardBounds): void {
|
||||
spanCurrent("draw-system-card", () => {
|
||||
const now = new Date();
|
||||
const logo = getDashboardLogo();
|
||||
|
||||
@@ -159,5 +161,6 @@ export function drawSystemCard(image: GrayImage, bounds: DashboardPluginCardBoun
|
||||
image.drawText(mediumFont, infoX, bounds.y + 10, systemCardNameSetting.get(), 200);
|
||||
image.drawText(mediumFont, infoX, bounds.y + 32, formatDashboardDate(now), 200);
|
||||
drawSystemCardFlowItems(image, bounds);
|
||||
});
|
||||
}
|
||||
|
||||
+15
-12
@@ -1,5 +1,6 @@
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
|
||||
import { BdfFont } from "../graphics/bdffont";
|
||||
import { spanCurrent } from "../native/frame-timings";
|
||||
import { type ConfigSettingString } from "./dashboard-settings";
|
||||
|
||||
export type DashboardInputEvent =
|
||||
@@ -79,18 +80,20 @@ export class LayerStack {
|
||||
private paintLayer(index: number): GrayImage {
|
||||
const layer = this.layers[index]!;
|
||||
let cachedBelow: GrayImage | null = null;
|
||||
return layer.paint(this.ctx, () => {
|
||||
if (cachedBelow) {
|
||||
return spanCurrent(`paint[${index}]:${layer.constructor.name}`, () =>
|
||||
layer.paint(this.ctx, () => {
|
||||
if (cachedBelow) {
|
||||
return cachedBelow;
|
||||
}
|
||||
if (index <= 0) {
|
||||
cachedBelow = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
} else if (layer.paintOverBase) {
|
||||
cachedBelow = this.paintLayer(0);
|
||||
} else {
|
||||
cachedBelow = this.paintLayer(index - 1);
|
||||
}
|
||||
return cachedBelow;
|
||||
}
|
||||
if (index <= 0) {
|
||||
cachedBelow = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
} else if (layer.paintOverBase) {
|
||||
cachedBelow = this.paintLayer(0);
|
||||
} else {
|
||||
cachedBelow = this.paintLayer(index - 1);
|
||||
}
|
||||
return cachedBelow;
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user