Apps submit mutli-plane images with glyphs, rather than mere images

This commit is contained in:
James Babcock committed 2026-08-16 21:01:20 -07:00
1 parent df85fb4072
commit fdf683761e
22 files changed
+348 -101

No files matched your search

+5 -4
View File
@@ -1,4 +1,5 @@
import { GrayImage } from "../../graphics/image";
import { type Plane } from "../../graphics/plane";
import * as frameTimings from "../../native/frame-timings";
import { beginRenderPass, endRenderPass } from "../../util/render-freshness";
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
@@ -37,7 +38,7 @@ export type InProcessWindowOptions = {
/** Shared actions; requestRender is rebound to this window's render. */
actions: LayerActions;
baseLayer: Layer;
submitFrame: (image: GrayImage, paintMs: number, frameId: number) => Promise<void>;
submitFrame: (planes: Plane[], paintMs: number, frameId: number) => Promise<void>;
setSurfaceVisible: (visible: boolean) => void;
removeSurface?: () => void;
onClosed?: () => void;
@@ -52,7 +53,7 @@ export type InProcessWindow = {
/** The controller-provided plumbing common to every in-process app window. */
export type InProcessAppOptions = {
actions: LayerActions;
submitFrame: (image: GrayImage, paintMs: number, frameId: number) => Promise<void>;
submitFrame: (planes: Plane[], paintMs: number, frameId: number) => Promise<void>;
setSurfaceVisible: (visible: boolean) => void;
removeSurface: () => void;
onClosed: () => void;
@@ -89,9 +90,9 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
nextRenderWantsFreshData = false;
beginRenderPass(!wantFreshData);
const paintStartedAtMs = Date.now();
const image = stack.paint();
const planes = stack.paint();
const paintUsedStaleData = endRenderPass();
await options.submitFrame(image, Date.now() - paintStartedAtMs, frameId);
await options.submitFrame(planes, Date.now() - paintStartedAtMs, frameId);
if (paintUsedStaleData) {
nextRenderWantsFreshData = true;
requestRender();
+4 -1
View File
@@ -1,4 +1,5 @@
import { GrayImage } from "../../graphics/image";
import { flattenPlanes } from "../../graphics/plane";
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry";
@@ -43,7 +44,9 @@ export class ShellModalLayer implements Layer {
paint(ctx: LayerContext, paintBelow: PaintBelow): GrayImage {
const image = paintBelow();
const inner = this.stack.paint();
// Flattening bakes the inner stack's planes (glyphs included) so the blit
// below transplants the finished modal content into this layer's plane.
const inner = flattenPlanes(this.stack.paint(), MODAL_INTERIOR);
const rect = modalRect();
image.fillRoundedRect(rect.x, rect.y, rect.width, rect.height, SHELL_OPAQUE_BLACK, 8);
image.drawRoundedRect(rect.x, rect.y, rect.width, rect.height, 110, 8);
+3 -2
View File
@@ -1,4 +1,5 @@
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { singlePlane, type Plane } from "../../graphics/plane";
import { getDefaultSmallFont } from "../../graphics/bdffont";
import { EvenAIStatus, EventSourceType, OsEventTypeList } from "../../g2/events";
import type { RawInputEvent } from "../../native/faceclaw-communicator";
@@ -470,9 +471,9 @@ class Shell {
}
/** Paint the shell surface: transparent chrome, or all-transparent when asleep. */
paintSurface(): GrayImage {
paintSurface(): Plane[] {
if (!this.screenOn) {
return new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
return singlePlane(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
}
return this.stack.paint();
}