forked from Blendman974/faceclaw
Display lists
This commit is contained in:
1 parent
a7af84e231
commit
4320021222
44 files changed
+823
-284
No files matched your search
@@ -2467,7 +2467,7 @@ class DashboardController {
|
||||
beginRenderPass(!wantFreshData);
|
||||
const paintStartedAtMs = Date.now();
|
||||
const planes = frameTimings.span(frameId, "paint", () =>
|
||||
frameTimings.runWithFrame(frameId, () => shell.paintSurface()),
|
||||
frameTimings.runWithFrame(frameId, () => shell.paintScene()),
|
||||
);
|
||||
const paintMs = Date.now() - paintStartedAtMs;
|
||||
const paintUsedStaleData = endRenderPass();
|
||||
@@ -2484,32 +2484,7 @@ class DashboardController {
|
||||
frameTimings.finishFrame(frameId, "discarded: shell render with no display target");
|
||||
return;
|
||||
}
|
||||
// A shell overlay that dims what it covers (a context menu) must dim the
|
||||
// window surfaces too, which live below the shell surface in the
|
||||
// compositor: forward the factor before this frame composites.
|
||||
const underlayDim = shell.underlayDim();
|
||||
if (underlayDim !== this.appliedUnderlayDim) {
|
||||
this.appliedUnderlayDim = underlayDim;
|
||||
await display.setUnderlayDim(SHELL_SURFACE_Z_ORDER, underlayDim);
|
||||
}
|
||||
const fingerprint = frameTimings.span(frameId, "fingerprint", () => planesFingerprint(planes));
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
const preparedDraws = frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws));
|
||||
// Spanned because the bridge serializes Java calls: a frame can sit here
|
||||
// behind another surface's submission, which is otherwise an unexplained
|
||||
// jump between the paint spans and the composite.
|
||||
await frameTimings.spanAsync(frameId, "submit", () =>
|
||||
display.submitSurfaceFrame(
|
||||
SHELL_SURFACE_ID,
|
||||
buffer,
|
||||
{ x: 0, y: 0, width: image.width, height: image.height },
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
preparedDraws,
|
||||
),
|
||||
);
|
||||
await frameTimings.spanAsync(frameId, "submit", () => display.submitShellScene(planes, paintMs, frameId));
|
||||
// Backpressure: the next shell render waits for this one to reach the
|
||||
// glasses. Timing out here means the loop was blocked for the full timeout
|
||||
// and any input arriving meanwhile had its chrome repaint delayed, so say
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/** Adapter for raster-only senders; optimized legacy layouts remain internal to the phone. */
|
||||
export function drawMessages(payload: Uint8Array, width = 640, height = 480): Uint8Array[] {
|
||||
const word = (v: number) => [v & 255, (v >>> 8) & 255]
|
||||
const mode = payload[0] & 127
|
||||
let calls: Uint8Array[]
|
||||
if (mode === 8) {
|
||||
const output: Uint8Array[] = []; let p=2
|
||||
for(let i=0;i<payload[1];i++) { const n=payload[p] | payload[p+1]<<8; p+=2; output.push(...drawMessages(payload.subarray(p,p+n),width,height));p+=n }
|
||||
return output
|
||||
} else if (mode === 3) calls=[new Uint8Array([1,0,0,...payload.subarray(1,5),...payload.subarray(7)])]
|
||||
else if(mode === 6) calls=[new Uint8Array([1,0,1,0,0,0,0,...word(width),...word(height),...payload.subarray(1)])]
|
||||
else throw new Error(`Unsupported raster draw ${mode}`)
|
||||
return calls.map(call => new Uint8Array([26,1,0,...word(call.length),...call]))
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export type FirmwareInfo = {
|
||||
};
|
||||
|
||||
/** The Faceclaw firmware revision this build of the app needs. */
|
||||
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 23;
|
||||
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 25;
|
||||
|
||||
const FACECLAW_PREFIX = "Faceclaw/";
|
||||
const LEGACY_PREFIX = "EVENCFW";
|
||||
|
||||
@@ -19,12 +19,12 @@ export type FirmwarePatchSet = {
|
||||
export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
"base": "g2_2.3.0.24.bin",
|
||||
"baseSha256": "187ccf2bcc5c17a212106e8a376745511e8289c4232b634a7ea94b9bf25a0979",
|
||||
"outputSha256": "393ea24203d9a388975c732cae4698339f8af0e13139b73d71386181a1bc004e",
|
||||
"outputSha256": "986930903c6ea41ad7fd7ed15c73c0a1af00cc9b58604abfe2092a79745bb641",
|
||||
"patches": [
|
||||
{
|
||||
"offset": 1045797,
|
||||
"old": "38b584b0",
|
||||
"new": "59f3efbf",
|
||||
"new": "5cf337be",
|
||||
"desc": "ring receiver entry: timestamped unfiltered reports under framebuffer lease"
|
||||
},
|
||||
{
|
||||
@@ -36,49 +36,49 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
{
|
||||
"offset": 1437923,
|
||||
"old": "fef788ff",
|
||||
"new": "faf2fefc",
|
||||
"new": "fdf246fb",
|
||||
"desc": "cfw_ancs_event"
|
||||
},
|
||||
{
|
||||
"offset": 1437951,
|
||||
"old": "fef7e8fb",
|
||||
"new": "faf238fa",
|
||||
"new": "fdf280f8",
|
||||
"desc": "cfw_ancs_open"
|
||||
},
|
||||
{
|
||||
"offset": 1437969,
|
||||
"old": "fef7e7fb",
|
||||
"new": "faf24ffa",
|
||||
"new": "fdf297f8",
|
||||
"desc": "cfw_ancs_close"
|
||||
},
|
||||
{
|
||||
"offset": 1388387,
|
||||
"old": "39694d00",
|
||||
"new": "e5317d00",
|
||||
"new": "755e7d00",
|
||||
"desc": "connection-bound ANCS EUS write callback"
|
||||
},
|
||||
{
|
||||
"offset": 971497,
|
||||
"old": "fff717f8",
|
||||
"new": "6cf31ff9",
|
||||
"new": "6ef367ff",
|
||||
"desc": "bl faceclaw_input_bridge_received (ring relay and ordered private transport before worker pool)"
|
||||
},
|
||||
{
|
||||
"offset": 971845,
|
||||
"old": "fef769ff",
|
||||
"new": "6cf371f8",
|
||||
"new": "6ef3b9fe",
|
||||
"desc": "bl faceclaw_input_bridge_received (ring relay and ordered private transport before worker pool)"
|
||||
},
|
||||
{
|
||||
"offset": 979579,
|
||||
"old": "fdf74ef8",
|
||||
"new": "6af356f9",
|
||||
"new": "6cf39eff",
|
||||
"desc": "bl faceclaw_input_bridge_received (ring relay and ordered private transport before worker pool)"
|
||||
},
|
||||
{
|
||||
"offset": 1428895,
|
||||
"old": "f8f76cfd",
|
||||
"new": "f9f28afd",
|
||||
"new": "fcf292f8",
|
||||
"desc": "bl cfw_receive_packet (private SID-f0 probe before TPL reassembly)"
|
||||
},
|
||||
{
|
||||
@@ -108,145 +108,145 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
{
|
||||
"offset": 1248487,
|
||||
"old": "d4f712fb",
|
||||
"new": "27f354fb",
|
||||
"new": "2af3bef8",
|
||||
"desc": "bl settings_send_wrapper (append caps field 100)"
|
||||
},
|
||||
{
|
||||
"offset": 1246183,
|
||||
"old": "f5f7e2f8",
|
||||
"new": "27f374fd",
|
||||
"new": "2af360fa",
|
||||
"desc": "bl settings_decode_wrapper (Faceclaw lease field 101)"
|
||||
},
|
||||
{
|
||||
"offset": 975219,
|
||||
"old": "02f083fc",
|
||||
"new": "69f3d6fd",
|
||||
"new": "6cf3c2fa",
|
||||
"desc": "bl faceclaw_display_start @ 0x467d68 (fail-open wake takeover)"
|
||||
},
|
||||
{
|
||||
"offset": 975411,
|
||||
"old": "02f023fc",
|
||||
"new": "69f344fe",
|
||||
"new": "6cf330fb",
|
||||
"desc": "bl faceclaw_display_start_headup @ 0x467e28 (fail-open wake takeover)"
|
||||
},
|
||||
{
|
||||
"offset": 975103,
|
||||
"old": "07f085fb",
|
||||
"new": "6bf328f9",
|
||||
"new": "6df370ff",
|
||||
"desc": "bl headup_gate (head-up sensor event -> EvenHub sys event 12 under lease)"
|
||||
},
|
||||
{
|
||||
"offset": 830549,
|
||||
"old": "19f03efb",
|
||||
"new": "8ef3d7fa",
|
||||
"new": "91f31ff9",
|
||||
"desc": "bl gesture_ring_press_mode (observe ring touch-down, preserve stock dispatch)"
|
||||
},
|
||||
{
|
||||
"offset": 830795,
|
||||
"old": "1ff071ff",
|
||||
"new": "8ef390fa",
|
||||
"new": "91f3d8f8",
|
||||
"desc": "bl gesture_press (owned event 9 before stock menu gate)"
|
||||
},
|
||||
{
|
||||
"offset": 830887,
|
||||
"old": "1ff043ff",
|
||||
"new": "8ef38afa",
|
||||
"new": "91f3d2f8",
|
||||
"desc": "bl gesture_short_long (Faceclaw lease gates event 11 vs stock Menu path)"
|
||||
},
|
||||
{
|
||||
"offset": 831763,
|
||||
"old": "1ff08dfd",
|
||||
"new": "8ef3c0f8",
|
||||
"new": "90f308ff",
|
||||
"desc": "bl gesture_release (owned event 10 before stock menu gate)"
|
||||
},
|
||||
{
|
||||
"offset": 1570209,
|
||||
"old": "7fb50600",
|
||||
"new": "d8f2e5be",
|
||||
"new": "dbf24fbc",
|
||||
"desc": "even_ai_display_ctrl entry -> conditional Faceclaw lease trampoline"
|
||||
},
|
||||
{
|
||||
"offset": 1051545,
|
||||
"old": "f6f787f9",
|
||||
"new": "53f3cbfc",
|
||||
"new": "55f3fbfb",
|
||||
"desc": "bl display_copy_hook @ 0x47a78e (640x480 direct framebuffer)"
|
||||
},
|
||||
{
|
||||
"offset": 1051861,
|
||||
"old": "f6f7e9f8",
|
||||
"new": "53f32dfc",
|
||||
"new": "55f35dfb",
|
||||
"desc": "bl display_copy_hook @ 0x47a8ca (640x480 direct framebuffer)"
|
||||
},
|
||||
{
|
||||
"offset": 1262237,
|
||||
"old": "d9f7d0fd",
|
||||
"new": "23f3b3fc",
|
||||
"new": "26f333f9",
|
||||
"desc": "bl faceclaw_send_wear_event @ 0x4ade92 (outside onboarding)"
|
||||
},
|
||||
{
|
||||
"offset": 1262337,
|
||||
"old": "d9f79efd",
|
||||
"new": "23f381fc",
|
||||
"new": "26f301f9",
|
||||
"desc": "bl faceclaw_send_wear_event @ 0x4adef6 (outside onboarding)"
|
||||
},
|
||||
{
|
||||
"offset": 1309405,
|
||||
"old": "67f02dff",
|
||||
"new": "17f39bfd",
|
||||
"new": "1af319fa",
|
||||
"desc": "bl compass_decode_capture (sample-matched GAF diagnostics)"
|
||||
},
|
||||
{
|
||||
"offset": 1307865,
|
||||
"old": "fff7c9fb",
|
||||
"new": "18f319f9",
|
||||
"new": "1af397fd",
|
||||
"desc": "bl compass_report_event (stock UI + heading with diagnostics over BLE)"
|
||||
},
|
||||
{
|
||||
"offset": 1300937,
|
||||
"old": "00210170",
|
||||
"new": "19f3fffd",
|
||||
"new": "1cf37dfa",
|
||||
"desc": "bl compass_preserve_accuracy (retain magnetic calibration under Faceclaw framebuffer lease)"
|
||||
},
|
||||
{
|
||||
"offset": 4537963,
|
||||
"old": "",
|
||||
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf2de9f04fa5b04ef66c6a4ff29c5516460c46ccf2ff0ac2f229054ff6ff7800274ff00109019006e048f2a351c0f24501bff32f8f8847d5f800b0bff35f8f28680321cff680710140b1f1005fbff35f8f02d10168514543d04ff4417004f050fb002800f036810021421847540431b1f5417f57709770d770f6d1c0f800a080f80a90a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8055e8001f5945aed1bff35f8f00bf45e8000121b155e8001f5945f8d0a3e7a34644ea064100260127c0f8701206e048f2a351c0f24501bff32f8f88472c68bff35f8f28680321cff680710140b1f1005fbff35f8f02d10168514542d04ff4417004f0edfa002800f0d380002100bf421846540431b1f5417f56709670d670f6d1c0f800a08772a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8055e8001fa142afd1bff35f8f45e8000121b155e8001fa142f8d0a5e7d0f8746242f6f767c0f24407002ebff35f8f71d007f19a0230464ff0ff314ff0ff379047002840f0c28047f6df40c0f24f00804700274ff001090397adf8107007e000bf48f2a351c0f24501bff32f8f88472c68bff35f8f28680321cff680710140b1f1005fbff35f8f02d10168514567d04ff4417004f071fa002860d00021421847540431b1f5417f57709770d770f6d1c0f800a080f80a90a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8055e8001fa142b0d1bff35f8f00bf45e8000149b355e8001fa142f8d0a5e704460020b847b0b104f51d7151e8006f4eb9bff35f8f00bf41e8000292b151e8006f002ef8d00021bff32f8fbff35f8f21b1064672e74ff0ff373ce007f5a97188476be70121f1e70020019f42f6f769002f4ff00104c0f2440918bfbbf1000f2dd102ad8046284602f054f903ab38465946012205f0eefc9df8111007462846002918bf4ff0ff3702f0f6f9002c044608d19df8100028b94af21f30c0f247004c308047b8f1000f18bfc8f80c4009f5807130468847384625b0bde8f08f3a7802f07f01a1f1150313f1030f0bd802f07b030b2b07d002f07e02082a03d0032901d00629bdd140b14af21f31c0f247010446884794f8641111b14ff0ff37d6e720460024ade700bf2de9f0474ef66c6a4ff29c5548f2a359ccf2ff0ac2f229054ff6ff7600274ff00108c0f2450902e0bff32f8fc8472c68bff35f8f2868bff35f8f01466ff39601b1f1005f02d10168514535d04ff4417004f084f978b30021421847540431b1f5417f57709770d770f6d1c0f800a080f80a808683c683068446848684c684068546858685c685068646868686c6860687468755e8001fa142c6d1bff35f8f00bf45e80001002908bfbde8f08755e8001fa142f5d0b8e70020bde8f08770b500284dd001684ef66c62ccf2ff02914218bf70bd90f8441090f845504bf6394c8d42c0f2510c2ad205eb8501014491f8492091f84a4091f846e091f8473091f8481042ea0424012c4ff0010298bf14466e1c054680f84560b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f84410bde870406047e047286c38b142f64d42c0f244022146bde87040104770bd02464ff64b70cff6ff7042f6653c7844c0f2440c00210023604700bf2de9f04f9db04ff29c50c2f22900d0f800b0bff35f8f58466ff39600b0f1005f3fd1dbf800004ef66c65ccf2ff05a84237d19bf8640110b3dbf86041fcb140f24030c2f20000d0f8787502a802f020f8002f00f0f18040f20308384621464ff41632cff680784ff6ff760197fff764fc48f2a35900240127c0f245091ce09bf8660170b1dbf8680140b147f64c61c2f207010968401a002801f3cc8700208bf8660140f6a120c0f247001db0bde8f04f0047bff32f8fc8474ff29c50c2f22900d0f800a0bff35f8f0068bff35f8f00ea0801b1f1005f02d10168a94236d04ff4417004f07df8002801f08c87002100bf421844540431b1f5417f54709470d470f6d14ff29c52056087728683c683068446848684c684068546858685c685068646868686c68606874687c2f2290252e8001f5145bdd1bff35f8f00bf42e8000121b152e8001f5145f8d0b2e7817a002941f05887027e0021002a8df814107cd04ff29c5605aac2f22906535c002b00f0b68053185f78002f74d09f78002f73d0df78002f72d01f79002f71d05f79002f70d09f79002f6fd0df79002f6ed01f7a002f6dd05f7a002f6cd09f7a002f6bd0df7a002f6ad01f7b002f69d05f7b002f68d09f7b002f67d0df7b002f66d01f7c002f65d05f7c002f64d09f7c002f63d0df7c002f62d01f7d002f61d05f7d002f60d09f7d002f5fd0df7d002f5ed01f7e002f5dd05f7e002f5cd09f7e002f5bd0df7e002f5ad01f7f002f59d05f7f002f58d09f7f002f57d0db7f002b56d0203160297ff49aaf76e000208bf86401cbf860018bf8660101208bf8650140f6a120c0f24700804701f0e8be4ff29c56c2f2290664e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2921d84ff0520353541dd00a4445235e29537018d04Line truncated
|
||||
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf2de9f04fc5b04ff690454ef66c6b4ff29c591446cff6ff75ccf2ff0bc2f229094ff6ff78002701260d93cde90e0106e048f2a351c0f24501bff32f8f8847d9f800a0bff35f8fd9f800000321cff680710140b1f1005fbff35f8f03d10168594500f0ac804ff45c7007f0b4f8002800f0eb8129464218373182f8707382f8717382f8727382f8737382f8747382f8757382f8767382f8777382f8787382f8797382f87a7382f87b7382f87c7382f87d7382f87e7382f87f7382f8807382f8817382f8827382f8837382f8847382f8857382f8867382f8877382f8887382f8897382f88a7382f88b7382f88c7382f88d7382f88e7382f88f7382f8907382f8917382f8927382f8937382f8947382f8957382f8967382f8977382f8987382f8997382f89a7382f89b7382f89c7382f89d7382f89e7382f89f7382f8a07382f8a17382f8a27382f8a37382f8a47382f8a57382f8a6738ed1c0f800b08672a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8059e8001f51457ff445afbff35f8f00bf49e8000121b159e8001f5145f8d039e70f99012641ea04410024c0f8701206e048f2a351c0f24501bff32f8f8847d9f80070bff35f8fd9f800000321cff680710140b1f1005fbff35f8f03d10168594500f0ac804ff45c7006f0e6ff002800f01d8129464218373182f8704382f8714382f8724382f8734382f8744382f8754382f8764382f8774382f8784382f8794382f87a4382f87b4382f87c4382f87d4382f87e4382f87f4382f8804382f8814382f8824382f8834382f8844382f8854382f8864382f8874382f8884382f8894382f88a4382f88b4382f88c4382f88d4382f88e4382f88f4382f8904382f8914382f8924382f8934382f8944382f8954382f8964382f8974382f8984382f8994382f89a4382f89b4382f89c4382f89d4382f89e4382f89f4382f8a04382f8a14382f8a24382f8a34382f8a44382f8a54382f8a6438ed1c0f800b08672a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8059e8001fb9427ff445afbff35f8f00bf49e8000121b159e8001fb942f8d039e7d0f874a242f6f766c0f24406baf1000fbff35f8f4ad006f19a0250464ff0ff314ff0ff379047002840f08f810f98002861d00e980778a7f1170002285bd80f980c2840f078810e9e7078b178084300f07281f0780138022800f26d81b279f379747a42ea0322337a307942ea0342717942ea0463b27af67a192f42ea062200f07f83172f40f09583002a40f05481fe2800f0cb87812800f0bd87002840f0d28751ea030040f0478101f062b904460020b047e8b104f51d7151e800afbaf1000f0cd1bff35f8f00bf41e80002002a00f0e78051e800afbaf1000ff5d00021bff32f8f0029bff35f8f00f0d680824692e74ff0ff3729e147f6df40c0f24f008047002701261197adf8487006e048f2a351c0f24501bff32f8f8847d9f80040bff35f8fd9f800000321cff680710140b1f1005fbff35f8f03d10168594500f0b3804ff45c7006f09afe002800f0ab8029464218373182f8707382f8717382f8727382f8737382f8747382f8757382f8767382f8777382f8787382f8797382f87a7382f87b7382f87c7382f87d7382f87e7382f87f7382f8807382f8817382f8827382f8837382f8847382f8857382f8867382f8877382f8887382f8897382f88a7382f88b7382f88c7382f88d7382f88e7382f88f7382f8907382f8917382f8927382f8937382f8947382f8957382f8967382f8977382f8987382f8997382f89a7382f89b7382f89c7382f89d7382f89e7382f89f7382f8a07382f8a17382f8a27382f8a37382f8a47382f8a57382f8a6738ed1c0f800b08672a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8059e8001fa1427ff445afbff35f8f00bf49e8000159b159e8001fa142f8d039e706f5a9718847bae601211ee700200e9999b10f9a8ab1097801f07f02b2f10b0418bf0124b2f11c0618bf01268a2924dc0b2926d01c2924d03fe00d9010a804f0e1f94ff0ff3701269df84900002810a818bf4ff0ff3704f0fffa054646b99df8480028b94af21f30c0f247004c3080470d98002818bfc56013e09c2901d08b291bd160b14af21f31c0f247010746884797f8641119b997f80413384669b14ff0ff3742f6f760c0f2440000f5807150468847384645b0bde8f08f0d9010a8264004f0a0f90e98007800f07f040f2c2ddd142c40f3a981152c00f01183162c00f01c831d2c40f0da830f9801380228c0f04f850e994878897840ea0124b4f5007f00f2468504eb4400032101eb40000f99884240f03d8505f02ffe002800f038850c96002601270f9400f055bd092c00f3d180052c00f00c82072c40f0af83002706e048f2a351c0f24501bff32f8f8847d9f80040bff35f8fd9f800000321cff680710140b1f1005fbff35f8f03d10168594500f085864ff45c7006f033fd002800f07d86294600bf4218373182f8707382f8717382f8727382f8737382f8747382f8757382f8767382f8777382f8787382f8797382f87a7382f87b7382f87c7382f87d7382f87e7382f87f7382f8807382f8817382f8827382f8837382f8847382f8857382f8867382f8877382f8887382f8897382f88a7382f88b7382f88c7382f88d7382f88e7382f88f7382f8907382f8917382f8927382f8937382f8947382f895738Line truncated
|
||||
"desc": "append injected blobs to main-app payload"
|
||||
},
|
||||
{
|
||||
"offset": 779123,
|
||||
"old": "805a3900",
|
||||
"new": "f00a3a00",
|
||||
"new": "04403a00",
|
||||
"desc": "main-app subheader payload size (ps)"
|
||||
},
|
||||
{
|
||||
"offset": 152,
|
||||
"old": "005b3900",
|
||||
"new": "700b3a00",
|
||||
"new": "84403a00",
|
||||
"desc": "main-app TOC entry size (ps + 128)"
|
||||
},
|
||||
{
|
||||
"offset": 779243,
|
||||
"old": "805a3904",
|
||||
"new": "f00a3a04",
|
||||
"new": "04403a04",
|
||||
"desc": "main-app preamble length (low 24 bits)"
|
||||
},
|
||||
{
|
||||
"offset": 779247,
|
||||
"old": "effdbcea",
|
||||
"new": "09a9afac",
|
||||
"new": "4c01635d",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
|
||||
},
|
||||
{
|
||||
"offset": 156,
|
||||
"old": "c0c6322a",
|
||||
"new": "19292813",
|
||||
"new": "155cd97f",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
|
||||
},
|
||||
{
|
||||
"offset": 779127,
|
||||
"old": "c0c6322a",
|
||||
"new": "19292813",
|
||||
"new": "155cd97f",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { drawMessages } from './draw-protocol'
|
||||
import { setBrightness } from './brightness-protocol'
|
||||
import { AncsClient, ANCS_FIRMWARE_VERSION } from './ancs-client'
|
||||
import { type CompassEvent } from '../native/compass-types'
|
||||
@@ -254,7 +255,7 @@ export class GlassesSession {
|
||||
return Promise.all(['right', 'left'].map(role => this.send(role, protocol.SID.settings, 0x20, protocol.framebufferLease(acquire))))
|
||||
}
|
||||
private requestCfw(role: string, payload: Uint8Array): Promise<void> {
|
||||
if (payload.length > CFW_MAX_MESSAGE) return Promise.reject(new Error('CFW message too large'))
|
||||
if (payload.length > CFW_MAX_MESSAGE - 16) return Promise.reject(new Error('CFW message too large'))
|
||||
return new Promise((resolve, reject) => {
|
||||
const item: CfwPending = { role, payload, checksum: protocol.crc16(payload), magic: this.nextMagic(), ackLenses: 0, retries: 0,
|
||||
retryPending: false, deadline: 0, resolve, reject }
|
||||
@@ -508,7 +509,7 @@ export class GlassesSession {
|
||||
const textureFrame = this.latestTextures; this.latestTextures = null
|
||||
// Compare with the last enqueued image, not the last ACKed one. In an
|
||||
// A -> B -> A sequence, B may still be in flight when A is requested.
|
||||
if (this.lastEnqueued && packed.every((value, i) => value === this.lastEnqueued![i])) continue
|
||||
if (!textureFrame && this.lastEnqueued && packed.every((value, i) => value === this.lastEnqueued![i])) continue
|
||||
const texturePlan = textureFrame ? this.textures?.plan(this.lastEnqueued, packed, textureFrame, this.nextImageFrameId) : null
|
||||
let commands: Uint8Array[]
|
||||
if (texturePlan) {
|
||||
@@ -521,9 +522,10 @@ export class GlassesSession {
|
||||
const delta = buildBoundingBoxPayload(this.lastEnqueued, packed, 640, 480, this.nextImageFrameId)
|
||||
const payload = delta ?? protocol.concat(new Uint8Array([6]), protocol.rle4(packed))
|
||||
if (delta) this.nextImageFrameId = this.nextImageFrameId >= 0xfffe ? 1 : this.nextImageFrameId + 1
|
||||
commands = payload.length <= CFW_MAX_MESSAGE ? [payload] : buildFullFrameBands(packed, 640, 480, this.nextImageFrameId)
|
||||
if (payload.length > CFW_MAX_MESSAGE) for (const _ of commands)
|
||||
commands = payload.length <= CFW_MAX_MESSAGE - 16 ? [payload] : buildFullFrameBands(packed, 640, 480, this.nextImageFrameId)
|
||||
if (payload.length > CFW_MAX_MESSAGE - 16) for (const _ of commands)
|
||||
this.nextImageFrameId = this.nextImageFrameId >= 0xfffe ? 1 : this.nextImageFrameId + 1
|
||||
commands = [...commands.flatMap(command => drawMessages(command)), new Uint8Array([28])]
|
||||
this.log(`Display ${delta ? 'bbox' : 'full'} (${commands.length} CFW commands)`)
|
||||
}
|
||||
this.displaySending = { packed, commands, offset: 0, pending: 0 }
|
||||
|
||||
@@ -352,9 +352,7 @@ export class IosPreviewController {
|
||||
try {
|
||||
if (this.shellDirty) {
|
||||
this.shellDirty = false
|
||||
const { image, draws } = flattenPlanesWithDraws(shell.paintSurface(), { width: 640, height: 480 })
|
||||
this.compositor.submitSurfaceFrame('shell', image.pixels, { x: 0, y: 0, width: 640, height: 480 }, prepareFrameDraws(draws))
|
||||
this.compositor.setUnderlayDim(1, shell.underlayDim())
|
||||
this.compositor.setShellScene(shell.paintScene())
|
||||
}
|
||||
const { pixels, textures } = this.compositor.compositeFrame()
|
||||
this.session?.setFrame(pixels, textures)
|
||||
|
||||
@@ -15,6 +15,8 @@ import { GrayImage, type DeferredDraw } from "./image";
|
||||
* existing incremental-update and screen-preview pipeline.
|
||||
*/
|
||||
export type Plane = {
|
||||
shellKey?: number;
|
||||
dimUnderneath?: number;
|
||||
image: GrayImage;
|
||||
/**
|
||||
* Offset of the plane's top-left within the submitted frame. Applied
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { GrayImage } from './image'
|
||||
import type { Plane } from './plane'
|
||||
|
||||
/** Crop one independently owned, opaque shell surface; never split it into tiles. */
|
||||
export function shellCrop(image: GrayImage, x: number, y: number, width: number, height: number, key: number): Plane {
|
||||
const baked = image.withDrawsBaked(), crop = new GrayImage(width, height, 0)
|
||||
for (let row = 0; row < height; row++) crop.pixels.set(baked.pixels.subarray((y + row) * image.width + x, (y + row) * image.width + x + width), row * width)
|
||||
return { image: crop, x, y, shellKey: key }
|
||||
}
|
||||
|
||||
/** Shared Kotlin receives original 8-bit pixels and quantizes once, before composing. */
|
||||
export function encodeShellScene(planes: readonly Plane[]): Uint8Array {
|
||||
const layers: { image: GrayImage; x: number; y: number; key: number; dim: number }[] = []
|
||||
for (const plane of planes) {
|
||||
const image = plane.image.withDrawsBaked()
|
||||
let left = image.width, top = image.height, right = -1, bottom = -1
|
||||
for (let y = 0; y < image.height; y++) for (let x = 0; x < image.width; x++) {
|
||||
if (image.pixels[y * image.width + x] === 0) continue
|
||||
left = Math.min(left, x); right = Math.max(right, x); top = Math.min(top, y); bottom = Math.max(bottom, y)
|
||||
}
|
||||
if (right < left) continue
|
||||
const w = right - left + 1, h = bottom - top + 1
|
||||
if (5 + Math.ceil(w / 2) * h > 65536) throw new Error(`Shell surface ${plane.shellKey} exceeds 64 KiB (${w}×${h})`)
|
||||
const cropped = shellCrop(image, left, top, w, h, plane.shellKey!)
|
||||
layers.push({ image: cropped.image, x: plane.x + left, y: plane.y + top, key: plane.shellKey!, dim: Math.round((plane.dimUnderneath ?? 1) * 256) })
|
||||
}
|
||||
const result = new Uint8Array(2 + layers.reduce((n, l) => n + 14 + l.image.pixels.length, 0))
|
||||
const view = new DataView(result.buffer); let p = 0
|
||||
const word = (n: number) => { view.setUint16(p, n, true); p += 2 }
|
||||
word(layers.length)
|
||||
for (const l of layers) { word(l.key); word(l.x); word(l.y); word(l.image.width); word(l.image.height); word(l.dim); word(0); result.set(l.image.pixels, p); p += l.image.pixels.length }
|
||||
return result
|
||||
}
|
||||
@@ -33,6 +33,7 @@ export class SurfaceCompositor {
|
||||
this.native.submitDrawsIdDataXYWidthHeightDraws(id, toData(pixels), rect.x, rect.y, rect.width, rect.height,
|
||||
draws ? toData(new Uint8Array(draws)) : null)
|
||||
}
|
||||
setShellScene(bytes: Uint8Array): void { this.native.shellData(toData(bytes)) }
|
||||
composite(): Uint8Array { return fromData(this.native.composite()) }
|
||||
compositeFrame(): { pixels: Uint8Array; textures: TextureFrame } {
|
||||
const native = this.native.compositeFrame()
|
||||
|
||||
@@ -9,6 +9,8 @@ type Surface = SurfaceConfiguration & { pixels: Uint8Array; visible: boolean }
|
||||
|
||||
export class SurfaceCompositor {
|
||||
private readonly surfaces = new Map<string, Surface>()
|
||||
private shellScene: Uint8Array | null = null
|
||||
setShellScene(bytes: Uint8Array): void { this.shellScene = new Uint8Array(bytes) }
|
||||
private dimBelow = 0
|
||||
private dimFactor = 1
|
||||
private blanked = false
|
||||
@@ -55,11 +57,11 @@ export class SurfaceCompositor {
|
||||
composite(): Uint8Array {
|
||||
const output = new Uint8Array(this.width * this.height)
|
||||
if (this.blanked) return output
|
||||
const surfaces = [...this.surfaces.values()].filter(s => s.visible).sort((a, b) => a.zOrder - b.zOrder)
|
||||
const surfaces = [...this.surfaces.values()].filter(s => s.visible && !(this.shellScene && s === this.surfaces.get('shell'))).sort((a, b) => a.zOrder - b.zOrder)
|
||||
for (const surface of surfaces) {
|
||||
const left = Math.max(0, surface.x), right = Math.min(this.width, surface.x + surface.width)
|
||||
const top = Math.max(0, surface.y), bottom = Math.min(this.height, surface.y + surface.height)
|
||||
const dim = surface.zOrder < this.dimBelow ? this.dimFactor : 1
|
||||
const dim = !this.shellScene && surface.zOrder < this.dimBelow ? this.dimFactor : 1
|
||||
for (let y = top; y < bottom; y++) {
|
||||
let source = (y - surface.y) * surface.width + left - surface.x
|
||||
let target = y * this.width + left
|
||||
@@ -72,6 +74,21 @@ export class SurfaceCompositor {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.shellScene && !surfaces.some(s => s.zOrder > 1)) {
|
||||
const quantize = (v: number) => Math.min(15, (v + 8) >> 4)
|
||||
for (let i=0;i<output.length;i++) output[i]=quantize(output[i])*16
|
||||
const bytes=this.shellScene, view=new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
|
||||
let p=2
|
||||
for(let i=0;i<view.getUint16(0,true);i++) {
|
||||
const x=view.getInt16(p+2,true), y=view.getInt16(p+4,true), w=view.getUint16(p+6,true), h=view.getUint16(p+8,true), dim=view.getUint16(p+10,true)
|
||||
p+=14
|
||||
if(dim<256) for(let j=0;j<output.length;j++) output[j]=Math.floor((output[j]/16)*dim/256)*16
|
||||
for(let yy=0;yy<h;yy++) for(let xx=0;xx<w;xx++) {
|
||||
if(x+xx>=0 && y+yy>=0 && x+xx<this.width && y+yy<this.height) output[(y+yy)*this.width+x+xx]=quantize(bytes[p+yy*w+xx])*16
|
||||
}
|
||||
p+=w*h
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
||||
}
|
||||
@@ -541,6 +541,11 @@ export class FaceclawCommunicatorBridge {
|
||||
* next composite. How a shell overlay's Layer.dimUnderneath reaches the
|
||||
* window surfaces beneath the shell surface.
|
||||
*/
|
||||
async submitShellScene(bytes: Uint8Array, paintMs = 0, frameId = 0): Promise<void> {
|
||||
const snapshot = new Uint8Array(bytes);
|
||||
await this.enqueueJavaCall(() => this.communicator.submitShellScene(snapshot.buffer, paintMs, frameId), true);
|
||||
}
|
||||
|
||||
async setUnderlayDim(belowZOrder: number, factor: number): Promise<void> {
|
||||
await this.enqueueJavaCall(() => {
|
||||
this.communicator.setUnderlayDim(Math.round(belowZOrder), dimFactor256(factor));
|
||||
|
||||
@@ -31,6 +31,8 @@ export function runKotlinProtocolSmokeTest(): void {
|
||||
c.submitSurfaceFrame('test', new Uint8Array([0, 16, 255, 32, 48, 64]), { x: 0, y: 0, width: 3, height: 2 })
|
||||
assert(hex(c.composite()) === '0010ff203040', 'composition')
|
||||
assert(hex(protocol.packGray4(c.composite(), 3, 2)) === '01f02340', 'packing')
|
||||
c.setShellScene(new Uint8Array([1,0,1,0,0,0,0,0,1,0,1,0,128,0,0,0,255]))
|
||||
assert(hex(c.composite()) === 'f00070101020', 'shell scene bridge and 4bpp composition')
|
||||
c.setScreenBlanked(true); assert(c.composite().every(p => p === 0), 'blanking')
|
||||
const textures = new IosTexturePlanner(), textured = new SurfaceCompositor(4, 2)
|
||||
textured.configureSurface('icon', { x: 0, y: 0, width: 2, height: 2, zOrder: 0, transparency: 'opaque' })
|
||||
@@ -40,7 +42,7 @@ export function runKotlinProtocolSmokeTest(): void {
|
||||
textured.submitSurfaceFrame('icon', white, { x: 0, y: 0, width: 2, height: 2 }, draw.buffer)
|
||||
const snapshot = textured.compositeFrame(), packed = protocol.packGray4(snapshot.pixels, 4, 2)
|
||||
const cold = textures.plan(null, packed, snapshot.textures, 1)
|
||||
assert(!!cold && cold.resourceCommands.some(command => command[0] === 21) && cold.payload[0] === 8, 'texture upload and draw')
|
||||
assert(!!cold && cold.resourceCommands.some(command => command[0] === 21) && cold.payload[0] === 28, 'texture upload and draw')
|
||||
assert(textures.plan(null, packed, snapshot.textures, 1)?.resourceCommands.length === 0, 'texture reuse')
|
||||
textures.reset()
|
||||
assert((textures.plan(null, packed, snapshot.textures, 1)?.resourceCommands.length ?? 0) > 0, 'texture reset')
|
||||
|
||||
@@ -22,6 +22,7 @@ export type DisplayTarget = Pick<
|
||||
| "setUnderlayDim"
|
||||
| "setScreenBlanked"
|
||||
| "submitSurfaceFrame"
|
||||
| "submitShellScene"
|
||||
| "waitForFrameFinished"
|
||||
| "getCompositePreview"
|
||||
| "saveScreenshot"
|
||||
@@ -97,6 +98,10 @@ export class PreviewDisplayTarget implements DisplayTarget {
|
||||
this.compositor.setSurfaceVisible(id, Boolean(visible));
|
||||
}
|
||||
|
||||
async submitShellScene(bytes: Uint8Array, paintMs = 0, frameId = 0): Promise<void> {
|
||||
this.compositor.submitShellScene(new Uint8Array(bytes).buffer, paintMs, frameId);
|
||||
}
|
||||
|
||||
async setUnderlayDim(belowZOrder: number, factor: number): Promise<void> {
|
||||
this.compositor.setUnderlayDim(Math.round(belowZOrder), dimFactor256(factor));
|
||||
}
|
||||
|
||||
+16
-4
@@ -80,6 +80,7 @@ export interface LayerContext {
|
||||
}
|
||||
|
||||
export interface Layer {
|
||||
paintParts?(): Plane[];
|
||||
readonly paintOverBase?: boolean;
|
||||
/**
|
||||
* Dim everything painted beneath this layer: a 0..1 brightness factor
|
||||
@@ -116,6 +117,12 @@ export interface Layer {
|
||||
|
||||
export class LayerStack {
|
||||
private readonly layers: Layer[];
|
||||
private static nextShellKey = 3;
|
||||
static allocateShellKey(): number {
|
||||
if (this.nextShellKey > 65535) this.nextShellKey = 3;
|
||||
return this.nextShellKey++;
|
||||
}
|
||||
private readonly shellKeys = new WeakMap<Layer, number>();
|
||||
private readonly ctx: LayerContext;
|
||||
private baseWidth: number;
|
||||
private baseHeight: number;
|
||||
@@ -225,6 +232,8 @@ export class LayerStack {
|
||||
* A stack whose base is transparent over something else (the shell chrome
|
||||
* over the window surfaces) forwards this to what lies beneath.
|
||||
*/
|
||||
paintUndimmed(): Plane[] { return this.paintLayer(this.layers.length - 1, 1, true); }
|
||||
|
||||
baseDim(): number | false {
|
||||
return this.lastBaseDim;
|
||||
}
|
||||
@@ -259,8 +268,11 @@ export class LayerStack {
|
||||
|
||||
|
||||
/** Paint layer `index`; `dimSoFar` is the factor the layers above apply to it. */
|
||||
private paintLayer(index: number, dimSoFar: number): Plane[] {
|
||||
private paintLayer(index: number, dimSoFar: number, raw = false): Plane[] {
|
||||
const layer = this.layers[index]!;
|
||||
if (raw && index === 0 && layer.paintParts) return layer.paintParts();
|
||||
let key = this.shellKeys.get(layer);
|
||||
if (key === undefined) { key = LayerStack.allocateShellKey(); this.shellKeys.set(layer, key); }
|
||||
let canvas: GrayImage | null = null;
|
||||
let belowRequested = false;
|
||||
const image = spanCurrent(`paint[${index}]:${layer.constructor.name}`, () =>
|
||||
@@ -272,7 +284,7 @@ export class LayerStack {
|
||||
return canvas;
|
||||
}),
|
||||
);
|
||||
const ownPlane: Plane = { image, x: 0, y: 0 };
|
||||
const ownPlane: Plane = { image, x: 0, y: 0, shellKey: key, dimUnderneath: layer.dimUnderneath === false ? 1 : layer.dimUnderneath };
|
||||
if (index <= 0) {
|
||||
this.lastBaseDim = dimSoFar;
|
||||
return [ownPlane];
|
||||
@@ -281,7 +293,7 @@ export class LayerStack {
|
||||
return [ownPlane];
|
||||
}
|
||||
const dim = layer.dimUnderneath || 1;
|
||||
const below = this.paintLayer(layer.paintOverBase ? 0 : index - 1, dimSoFar * dim);
|
||||
return [...(dim < 1 ? dimPlanes(below, dim) : below), ownPlane];
|
||||
const below = this.paintLayer(layer.paintOverBase ? 0 : index - 1, dimSoFar * dim, raw);
|
||||
return [...(!raw && dim < 1 ? dimPlanes(below, dim) : below), ownPlane];
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -42,6 +42,7 @@ export type MenuLayout = {
|
||||
* renders over whatever is below it (modal/window menus).
|
||||
*/
|
||||
opaque?: boolean;
|
||||
squareCorners?: boolean;
|
||||
};
|
||||
|
||||
export type MenuItemRenderArgs = {
|
||||
@@ -226,6 +227,7 @@ export class MenuLayer implements Layer {
|
||||
const maxHeight = Math.min(
|
||||
this.layout.maxHeight ?? image.height - y - DEFAULT_MENU_Y,
|
||||
image.height - y,
|
||||
this.layout.squareCorners ? Math.floor(65530 / Math.ceil(width / 2)) : Infinity,
|
||||
);
|
||||
const footerHeight = this.layout.footer ? MENU_FOOTER_GAP + lineStep(font) : 0;
|
||||
const contentHeight = chromeTop + this.items.length * rowHeight + footerHeight + MENU_BODY_PADDING;
|
||||
@@ -243,9 +245,11 @@ export class MenuLayer implements Layer {
|
||||
|
||||
// Fill 1, not 0: identical after 4bpp quantization, but 0 is the
|
||||
// transparent color key when a menu paints on the shell surface.
|
||||
image.fillRoundedRect(x, y, width, height, 1);
|
||||
if (this.layout.squareCorners) image.fillRect(x, y, width, height, 1);
|
||||
else image.fillRoundedRect(x, y, width, height, 1);
|
||||
if (this.layout.showBorder !== false) {
|
||||
image.drawRoundedRect(x, y, width, height, 72);
|
||||
if (this.layout.squareCorners) image.drawRect(x, y, width, height, 72);
|
||||
else image.drawRoundedRect(x, y, width, height, 72);
|
||||
}
|
||||
if (this.title) {
|
||||
image.drawText(font, x + 12, y + 8, this.title, 220);
|
||||
|
||||
@@ -12,7 +12,7 @@ const DIALOG_X = 40;
|
||||
const DIALOG_W = G2_LENS_WIDTH - 80;
|
||||
// The dialog fits inside the min-height window band (like the other shell
|
||||
// overlays), wherever the vertical position setting puts it.
|
||||
const DIALOG_MARGIN_Y = 24;
|
||||
const DIALOG_MARGIN_Y = 28;
|
||||
const DIALOG_H = MIN_WINDOW_HEIGHT - 2 * DIALOG_MARGIN_Y;
|
||||
const TEXT_MAX_WIDTH = DIALOG_W - 32;
|
||||
const MENU_ROWS = 2;
|
||||
@@ -95,8 +95,8 @@ export class AssistantLayer implements Layer {
|
||||
|
||||
// Solid dialog box (fill 1, matching the voice dialog: opaque after 4bpp
|
||||
// quantization, but not the color-key transparent 0).
|
||||
image.fillRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1, 10);
|
||||
image.drawRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90, 10);
|
||||
image.fillRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1);
|
||||
image.drawRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90);
|
||||
|
||||
const left = DIALOG_X + 16;
|
||||
image.drawText(font, left, top + 12, this.phase === "thinking" ? "Assistant ●" : "Assistant", 220);
|
||||
|
||||
@@ -25,8 +25,8 @@ export class BrightnessPickerLayer implements Layer {
|
||||
const height = BAR_HEIGHT + 3 * font.lineHeight + 56;
|
||||
const left = viewport.x + Math.round((viewport.width - DIALOG_WIDTH) / 2);
|
||||
const top = viewport.y + Math.round((viewport.height - height) / 2);
|
||||
image.fillRoundedRect(left, top, DIALOG_WIDTH, height, SHELL_OPAQUE_BLACK, 8);
|
||||
image.drawRoundedRect(left, top, DIALOG_WIDTH, height, 110, 8);
|
||||
image.fillRect(left, top, DIALOG_WIDTH, height, SHELL_OPAQUE_BLACK);
|
||||
image.drawRect(left, top, DIALOG_WIDTH, height, 110);
|
||||
|
||||
const centeredText = (text: string, y: number, value: number) => {
|
||||
image.drawText(font, left + Math.round((DIALOG_WIDTH - font.measureText(text)) / 2), y, text, value);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { shellCrop } from "../../graphics/shell-scene";
|
||||
import type { Plane } from "../../graphics/plane";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
@@ -18,7 +20,7 @@ import {
|
||||
} from "../dashboard-settings";
|
||||
import { formatClockDate, formatClockTime } from "../clock-format";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { Layer } from "../layers";
|
||||
import { Layer, LayerStack } from "../layers";
|
||||
import { scrollToKeepSelectionVisible } from "../menu";
|
||||
import { lineStep } from "../metrics";
|
||||
import {
|
||||
@@ -216,6 +218,21 @@ export class ShellChromeLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
paintParts(): Plane[] {
|
||||
const state = this.getState(), parts: Plane[] = [];
|
||||
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
|
||||
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
this.drawSidebar(canvas, state);
|
||||
parts.push(shellCrop(canvas, 0, minWindowTop(state.foregroundAppId), SIDEBAR_WIDTH, MIN_WINDOW_HEIGHT, 1));
|
||||
}
|
||||
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
this.drawTopBar(canvas, state);
|
||||
const left = sidebarStripVisible(state.focus, state.foregroundAppId) ? SIDEBAR_WIDTH : 0;
|
||||
parts.push(shellCrop(canvas, left, windowTop(state.foregroundHeightMode, state.foregroundAppId), G2_LENS_WIDTH-left, TOP_BAR_HEIGHT, 2));
|
||||
drawAmbientCards(canvas, parts);
|
||||
return parts;
|
||||
}
|
||||
|
||||
handleInput(): void {
|
||||
// Shell input is handled by the shell state machine before it reaches the
|
||||
// layer stack; the chrome itself never consumes events.
|
||||
@@ -500,7 +517,8 @@ const AMBIENT_MAX_LINES_PER_CARD = 3;
|
||||
* bottom of the window band and newer ones stack above it. Cards that would
|
||||
* cross into the top bar are dropped rather than clipped.
|
||||
*/
|
||||
function drawAmbientCards(image: GrayImage): void {
|
||||
const ambientKeys = new Map<string, number>();
|
||||
function drawAmbientCards(image: GrayImage, parts?: Plane[]): void {
|
||||
const cards = activeAmbientCards();
|
||||
if (!cards.length) return;
|
||||
const font = getDefaultSmallFont();
|
||||
@@ -514,10 +532,11 @@ function drawAmbientCards(image: GrayImage): void {
|
||||
const height = 2 * AMBIENT_CARD_PADDING_Y + lines.length * lineStep(font);
|
||||
const y = bottom - height;
|
||||
if (y < bandTop + TOP_BAR_HEIGHT) break;
|
||||
image.fillRoundedRect(x, y, AMBIENT_CARD_WIDTH, height, SHELL_OPAQUE_BLACK, 6);
|
||||
image.drawRoundedRect(x, y, AMBIENT_CARD_WIDTH, height, 90, 6);
|
||||
const target = parts ? new GrayImage(image.width, image.height, 0) : image;
|
||||
target.fillRect(x, y, AMBIENT_CARD_WIDTH, height, SHELL_OPAQUE_BLACK);
|
||||
target.drawRect(x, y, AMBIENT_CARD_WIDTH, height, 90);
|
||||
for (let index = 0; index < lines.length; index++) {
|
||||
image.drawText(
|
||||
target.drawText(
|
||||
font,
|
||||
x + AMBIENT_CARD_PADDING_X,
|
||||
y + AMBIENT_CARD_PADDING_Y + index * lineStep(font),
|
||||
@@ -525,6 +544,11 @@ function drawAmbientCards(image: GrayImage): void {
|
||||
index === 0 ? 220 : 160,
|
||||
);
|
||||
}
|
||||
if (parts) {
|
||||
let key = ambientKeys.get(card.id);
|
||||
if (key === undefined) { key = LayerStack.allocateShellKey(); ambientKeys.set(card.id, key); }
|
||||
parts.push(shellCrop(target, x, y, AMBIENT_CARD_WIDTH, height, key));
|
||||
}
|
||||
bottom = y - AMBIENT_CARD_GAP;
|
||||
}
|
||||
}
|
||||
@@ -557,7 +581,7 @@ function attentionDot(value: number): GrayImage {
|
||||
|
||||
const TAB_RADIUS = 6;
|
||||
// How far the diversion pokes past the separator into the main area.
|
||||
const TAB_EXTEND = 1;
|
||||
const TAB_EXTEND = 0;
|
||||
const TAB_STROKE = 150;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ const DIALOG_X = 40;
|
||||
const DIALOG_W = G2_LENS_WIDTH - 80;
|
||||
// The dialog fits inside the min-height window band (like the other shell
|
||||
// overlays), wherever the vertical position setting puts it.
|
||||
const DIALOG_MARGIN_Y = 24;
|
||||
const DIALOG_MARGIN_Y = 28;
|
||||
const DIALOG_H = MIN_WINDOW_HEIGHT - 2 * DIALOG_MARGIN_Y;
|
||||
const TEXT_MAX_WIDTH = DIALOG_W - 32;
|
||||
|
||||
@@ -51,8 +51,8 @@ export function paintInputDialog(image: GrayImage, content: InputDialogContent):
|
||||
|
||||
// Solid dialog box over the underlying UI. Fill 1, not 0: identical after
|
||||
// 4bpp quantization, but 0 is transparent on the color-key shell surface.
|
||||
image.fillRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1, 10);
|
||||
image.drawRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90, 10);
|
||||
image.fillRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1);
|
||||
image.drawRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90);
|
||||
|
||||
const left = DIALOG_X + 16;
|
||||
image.drawText(font, left, top + 12, content.title, 220);
|
||||
|
||||
@@ -16,7 +16,7 @@ function modalInterior(): { width: number; height: number } {
|
||||
const viewport = appViewportSize("min");
|
||||
return {
|
||||
width: viewport.width - 2 * MODAL_MARGIN - 2 * MODAL_PADDING,
|
||||
height: viewport.height - 2 * MODAL_MARGIN - 2 * MODAL_PADDING,
|
||||
height: Math.min(viewport.height - 2 * MODAL_MARGIN, Math.floor(65530 / Math.ceil((viewport.width - 2 * MODAL_MARGIN) / 2))) - 2 * MODAL_PADDING,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export function modalRect(): { x: number; y: number; width: number; height: numb
|
||||
x: viewport.x + MODAL_MARGIN,
|
||||
y: viewport.y + MODAL_MARGIN,
|
||||
width: viewport.width - 2 * MODAL_MARGIN,
|
||||
height: viewport.height - 2 * MODAL_MARGIN,
|
||||
height: Math.min(viewport.height - 2 * MODAL_MARGIN, Math.floor(65530 / Math.ceil((viewport.width - 2 * MODAL_MARGIN) / 2))),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ export class ShellModalLayer implements Layer {
|
||||
// below transplants the finished modal content into this layer's plane.
|
||||
const inner = flattenPlanes(this.stack.paint(), 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);
|
||||
image.fillRect(rect.x, rect.y, rect.width, rect.height, SHELL_OPAQUE_BLACK);
|
||||
image.drawRect(rect.x, rect.y, rect.width, rect.height, 110);
|
||||
image.bitBlt(inner, rect.x + MODAL_PADDING, rect.y + MODAL_PADDING, { transparentZero: true });
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { encodeShellScene } from "../../graphics/shell-scene";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
|
||||
import { singlePlane, type Plane } from "../../graphics/plane";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
@@ -229,6 +230,7 @@ class ShellOverlayMenuLayer extends MenuLayer {
|
||||
y: minWindowTop() + TOP_BAR_HEIGHT + 8,
|
||||
width,
|
||||
minHeight: 150,
|
||||
squareCorners: true,
|
||||
footer,
|
||||
dimUnderneath: CONTEXT_MENU_DIM,
|
||||
});
|
||||
@@ -266,8 +268,8 @@ class ShellAlertLayer implements Layer {
|
||||
const font = getDefaultSmallFont();
|
||||
// Positioned within the min-height window band, like the other shell overlays.
|
||||
const alertY = minWindowTop() + ALERT_Y;
|
||||
image.fillRoundedRect(ALERT_X, alertY, ALERT_W, ALERT_H, 1, 10);
|
||||
image.drawRoundedRect(ALERT_X, alertY, ALERT_W, ALERT_H, 90, 10);
|
||||
image.fillRect(ALERT_X, alertY, ALERT_W, ALERT_H, 1);
|
||||
image.drawRect(ALERT_X, alertY, ALERT_W, ALERT_H, 90);
|
||||
image.drawText(font, ALERT_X + 16, alertY + 12, "Assistant", 200);
|
||||
image.drawTextWrapped({
|
||||
font,
|
||||
@@ -690,6 +692,8 @@ class Shell {
|
||||
}
|
||||
|
||||
/** Paint the shell surface: transparent chrome, or all-transparent when asleep. */
|
||||
paintScene(): Uint8Array { return encodeShellScene(this.screenOn ? this.stack.paintUndimmed() : []); }
|
||||
|
||||
paintSurface(): Plane[] {
|
||||
if (!this.screenOn) {
|
||||
return singlePlane(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
|
||||
|
||||
@@ -19,7 +19,7 @@ import { lineStep } from "../metrics";
|
||||
const DIALOG_WIDTH = 420;
|
||||
// Shell overlays align to the min-height window band; the detail box fills
|
||||
// the band below the top bar with an 8px margin on each side.
|
||||
const DETAIL_HEIGHT = MIN_WINDOW_HEIGHT - TOP_BAR_HEIGHT - 16;
|
||||
const DETAIL_HEIGHT = 208;
|
||||
|
||||
/** Dialog left edge: past the sidebar strip where one reserves width. */
|
||||
function dialogX(): number {
|
||||
@@ -42,6 +42,7 @@ export class ToolDebugMenuLayer extends MenuLayer {
|
||||
x: dialogX(),
|
||||
y: dialogY(),
|
||||
width: DIALOG_WIDTH,
|
||||
squareCorners: true,
|
||||
minHeight: 0,
|
||||
});
|
||||
}
|
||||
@@ -89,8 +90,8 @@ class ToolDetailLayer implements Layer {
|
||||
const left = dialogX();
|
||||
const width = detailWidth();
|
||||
const top = dialogY();
|
||||
image.fillRoundedRect(left, top, width, DETAIL_HEIGHT, 1, 10);
|
||||
image.drawRoundedRect(left, top, width, DETAIL_HEIGHT, 72, 10);
|
||||
image.fillRect(left, top, width, DETAIL_HEIGHT, 1);
|
||||
image.drawRect(left, top, width, DETAIL_HEIGHT, 72);
|
||||
|
||||
const textX = left + DETAIL_PADDING;
|
||||
const textWidth = width - 2 * DETAIL_PADDING - 8;
|
||||
|
||||
Reference in new issue
Block a user