forked from Blendman974/faceclaw
Use the texture cache and builtin-font drawing firmware extensions
This commit is contained in:
1 parent
deac81f98f
commit
90603b5aa4
9 files changed
+674
-60
No files matched your search
@@ -196,6 +196,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
private final TextureCacheState textureCache = new TextureCacheState();
|
||||
private boolean textureCacheSupported;
|
||||
private boolean textureImagesSupported;
|
||||
private boolean fwTextSupported;
|
||||
|
||||
private final ArrayDeque<OutboundMessage> pendingMessages = new ArrayDeque<>();
|
||||
private final ArrayDeque<OutboundMessage> inFlightMessages = new ArrayDeque<>();
|
||||
@@ -2231,7 +2232,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
deltaBase, packed, width, height, draws, textureCache,
|
||||
nextImageFrameId,
|
||||
connectionOptions.MULTI_RECT_FRAMES, ConnectionOptions.MULTI_RECT_MAX_RECTS,
|
||||
textureImagesSupported);
|
||||
textureImagesSupported, fwTextSupported);
|
||||
if (tex != null) {
|
||||
nextImageFrameId = tex.nextFid;
|
||||
for (byte[] upload : tex.uploads) {
|
||||
@@ -2244,6 +2245,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
String texLog = "texture update " + (tex.fullFrame ? "full" : ("rects=" + tex.rectCount))
|
||||
+ " glyphs=" + tex.drawnGlyphs + " runs=" + tex.runCount
|
||||
+ " images=" + tex.drawnImages
|
||||
+ " fw=" + tex.fwGlyphs + "/" + tex.fwRuns
|
||||
+ " baked=" + tex.bakedCandidates
|
||||
+ (tex.uploadBytes > 0 ? " upload=" + tex.uploadBytes + "B" : "")
|
||||
+ " payload=" + tex.payload.length + "B";
|
||||
@@ -2445,6 +2447,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
textureCacheSupported = hasCapability(firmwareInfo.capabilities, "texcache12")
|
||||
&& hasCapability(firmwareInfo.capabilities, "texstr14");
|
||||
textureImagesSupported = hasCapability(firmwareInfo.capabilities, "teximg13");
|
||||
fwTextSupported = hasCapability(firmwareInfo.capabilities, "font15");
|
||||
emitFirmwareInfo(firmwareInfo);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.faceclaw.app;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Process-wide registry of the glasses' builtin 20 px font's glyph rasters,
|
||||
* fed from the TS side (EvenHubFont's extracted firmware font data). Unlike
|
||||
* GlyphAtlas/ImageAtlas entries, these are never uploaded: the firmware
|
||||
* already owns the font, and mode 15 draws it directly. The planner needs
|
||||
* the rasters purely phone-side — for the "would this draw land correctly"
|
||||
* check against the composite and for punching drawn ink out of delta rects.
|
||||
*
|
||||
* Placement model matches the firmware's mode-15 math: a glyph draws at
|
||||
* (penX + ofsX, lineY + inkTop) where inkTop already folds in the root
|
||||
* font's line height and baseline. The TS side only registers glyphs whose
|
||||
* on-glasses rendering it predicts exactly (native-table glyphs; baseline-
|
||||
* shifted fallback symbols stay baked).
|
||||
*/
|
||||
public final class FwGlyphAtlas {
|
||||
private FwGlyphAtlas() {}
|
||||
|
||||
public static final class Entry {
|
||||
/** Draw x = pen x + ofsX. */
|
||||
public final int ofsX;
|
||||
/** First raster row relative to the run's line-top y. */
|
||||
public final int inkTop;
|
||||
public final int boxW;
|
||||
public final int boxH;
|
||||
/** 4bpp rows, stride ceil(boxW/2), high nibble = left pixel. */
|
||||
final byte[] nibbles;
|
||||
|
||||
Entry(int ofsX, int inkTop, int boxW, int boxH, byte[] nibbles) {
|
||||
this.ofsX = ofsX;
|
||||
this.inkTop = inkTop;
|
||||
this.boxW = boxW;
|
||||
this.boxH = boxH;
|
||||
this.nibbles = nibbles;
|
||||
}
|
||||
|
||||
/** The 4bpp source value at (col, row); the draw skips 0 (transparent). */
|
||||
public int nibbleAt(int col, int row) {
|
||||
int b = nibbles[row * ((boxW + 1) >> 1) + (col >> 1)] & 0xff;
|
||||
return (col & 1) != 0 ? (b & 0x0f) : (b >> 4);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Object lock = new Object();
|
||||
private static final Map<Integer, Entry> entries = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Register glyph rasters. Little-endian buffer of records:
|
||||
* [cp u32][ofsX s16][inkTop s16][boxW u8][boxH u8]
|
||||
* [boxH x ceil(boxW/2) nibble bytes]
|
||||
* Re-registration of a codepoint is ignored (the builtin font is fixed).
|
||||
*/
|
||||
public static void register(ByteBuffer buffer) {
|
||||
if (buffer == null) return;
|
||||
ByteBuffer in = buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
synchronized (lock) {
|
||||
while (in.remaining() >= 10) {
|
||||
int cp = in.getInt();
|
||||
int ofsX = in.getShort();
|
||||
int inkTop = in.getShort();
|
||||
int boxW = in.get() & 0xff;
|
||||
int boxH = in.get() & 0xff;
|
||||
byte[] nibbles = new byte[((boxW + 1) >> 1) * boxH];
|
||||
in.get(nibbles);
|
||||
if (boxW > 0 && boxH > 0 && !entries.containsKey(cp)) {
|
||||
entries.put(cp, new Entry(ofsX, inkTop, boxW, boxH, nibbles));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Entry get(int cp) {
|
||||
synchronized (lock) {
|
||||
return entries.get(cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,8 @@ public final class SurfaceCompositor {
|
||||
public static final class ScreenDraw {
|
||||
public static final int KIND_GLYPH = 0;
|
||||
public static final int KIND_IMAGE = 1;
|
||||
/** A firmware-builtin-font text run (CFW mode 15). */
|
||||
public static final int KIND_FWTEXT = 2;
|
||||
|
||||
public final int kind;
|
||||
/** Glyph draws only. */
|
||||
@@ -67,10 +69,17 @@ public final class SurfaceCompositor {
|
||||
public final int imageId;
|
||||
public final int x;
|
||||
public final int y;
|
||||
/** Glyph draws only: 8-bit brightness the glyph was drawn with. */
|
||||
/** Glyph and fw-text draws: 8-bit brightness. */
|
||||
public final int value;
|
||||
/** Fw-text runs only: member codepoints, in text order. */
|
||||
public final int[] fwCps;
|
||||
/** Fw-text runs only: member pen offsets relative to x. */
|
||||
public final int[] fwDx;
|
||||
/** Fw-text runs only: whether each member has visible pixels. */
|
||||
public final boolean[] fwInk;
|
||||
|
||||
ScreenDraw(int kind, int fontId, int encoding, int imageId, int x, int y, int value) {
|
||||
ScreenDraw(int kind, int fontId, int encoding, int imageId, int x, int y, int value,
|
||||
int[] fwCps, int[] fwDx, boolean[] fwInk) {
|
||||
this.kind = kind;
|
||||
this.fontId = fontId;
|
||||
this.encoding = encoding;
|
||||
@@ -78,14 +87,21 @@ public final class SurfaceCompositor {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.value = value;
|
||||
this.fwCps = fwCps;
|
||||
this.fwDx = fwDx;
|
||||
this.fwInk = fwInk;
|
||||
}
|
||||
|
||||
static ScreenDraw glyph(int fontId, int encoding, int penX, int lineY, int value) {
|
||||
return new ScreenDraw(KIND_GLYPH, fontId, encoding, 0, penX, lineY, value);
|
||||
return new ScreenDraw(KIND_GLYPH, fontId, encoding, 0, penX, lineY, value, null, null, null);
|
||||
}
|
||||
|
||||
static ScreenDraw image(int imageId, int x, int y) {
|
||||
return new ScreenDraw(KIND_IMAGE, 0, 0, imageId, x, y, 0);
|
||||
return new ScreenDraw(KIND_IMAGE, 0, 0, imageId, x, y, 0, null, null, null);
|
||||
}
|
||||
|
||||
static ScreenDraw fwText(int x, int y, int value, int[] cps, int[] dx, boolean[] ink) {
|
||||
return new ScreenDraw(KIND_FWTEXT, 0, 0, 0, x, y, value, cps, dx, ink);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,6 +330,23 @@ public final class SurfaceCompositor {
|
||||
int x = in.getShort();
|
||||
int y = in.getShort();
|
||||
out.add(ScreenDraw.image(imageId, x, y));
|
||||
} else if (kind == ScreenDraw.KIND_FWTEXT && in.remaining() >= 6) {
|
||||
int x = in.getShort();
|
||||
int y = in.getShort();
|
||||
int value = in.get() & 0xff;
|
||||
int count = in.get() & 0xff;
|
||||
if (in.remaining() < count * 7) {
|
||||
break; // malformed tail: keep what parsed cleanly
|
||||
}
|
||||
int[] cps = new int[count];
|
||||
int[] dx = new int[count];
|
||||
boolean[] ink = new boolean[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
cps[i] = in.getInt();
|
||||
dx[i] = in.getShort();
|
||||
ink[i] = in.get() != 0;
|
||||
}
|
||||
out.add(ScreenDraw.fwText(x, y, value, cps, dx, ink));
|
||||
} else {
|
||||
break; // malformed tail: keep what parsed cleanly
|
||||
}
|
||||
@@ -379,7 +412,8 @@ public final class SurfaceCompositor {
|
||||
blendLocked(gray, surface);
|
||||
for (ScreenDraw draw : surface.draws) {
|
||||
draws.add(new ScreenDraw(draw.kind, draw.fontId, draw.encoding, draw.imageId,
|
||||
draw.x + surface.x, draw.y + surface.y, draw.value));
|
||||
draw.x + surface.x, draw.y + surface.y, draw.value,
|
||||
draw.fwCps, draw.fwDx, draw.fwInk));
|
||||
}
|
||||
fingerprint.append('|').append(surface.id)
|
||||
.append('@').append(surface.x).append(',').append(surface.y)
|
||||
|
||||
+223
-19
@@ -32,8 +32,16 @@ public final class TexturePlanner {
|
||||
|
||||
/** Cap on mode-14 string sub-messages (mode-8 count is a u8). */
|
||||
private static final int MAX_GLYPH_RUNS = 180;
|
||||
/**
|
||||
* Soft cap on cached-glyph selection per update, before run grouping.
|
||||
* Sized above a full-screen 6x12 terminal repaint (~4,240 cells) so dense
|
||||
* screens draw everything; the run budget is the real bound.
|
||||
*/
|
||||
private static final int MAX_SELECTED_GLYPHS = 4600;
|
||||
/** Cap on mode-13 image sub-messages per update. */
|
||||
private static final int MAX_IMAGE_DRAWS = 60;
|
||||
/** Cap on mode-15 builtin-font string sub-messages per update. */
|
||||
private static final int MAX_FWTEXT_RUNS = 80;
|
||||
/** Mode-12 payload size that fits one BLE image message comfortably. */
|
||||
private static final int UPLOAD_PAYLOAD_MAX = 3600;
|
||||
/** Max x-adjust control bytes between two glyphs before starting a new run. */
|
||||
@@ -52,13 +60,15 @@ public final class TexturePlanner {
|
||||
public final int drawnGlyphs;
|
||||
public final int runCount;
|
||||
public final int drawnImages;
|
||||
public final int fwGlyphs;
|
||||
public final int fwRuns;
|
||||
public final int bakedCandidates;
|
||||
public final int uploadBytes;
|
||||
public final boolean fullFrame;
|
||||
|
||||
Result(byte[] payload, List<byte[]> uploads, int nextFid, int rectCount,
|
||||
int drawnGlyphs, int runCount, int drawnImages, int bakedCandidates,
|
||||
int uploadBytes, boolean fullFrame) {
|
||||
int drawnGlyphs, int runCount, int drawnImages, int fwGlyphs, int fwRuns,
|
||||
int bakedCandidates, int uploadBytes, boolean fullFrame) {
|
||||
this.payload = payload;
|
||||
this.uploads = uploads;
|
||||
this.nextFid = nextFid;
|
||||
@@ -66,6 +76,8 @@ public final class TexturePlanner {
|
||||
this.drawnGlyphs = drawnGlyphs;
|
||||
this.runCount = runCount;
|
||||
this.drawnImages = drawnImages;
|
||||
this.fwGlyphs = fwGlyphs;
|
||||
this.fwRuns = fwRuns;
|
||||
this.bakedCandidates = bakedCandidates;
|
||||
this.uploadBytes = uploadBytes;
|
||||
this.fullFrame = fullFrame;
|
||||
@@ -93,15 +105,15 @@ public final class TexturePlanner {
|
||||
/**
|
||||
* Plan a cached-draw update. previous is the delta base (the frame the
|
||||
* shadow currently holds), or null/mismatched for a full-frame keyframe.
|
||||
* allowImages requires the teximg13 capability. Returns null when the
|
||||
* plain paths should run instead (no replayable draws, or identical
|
||||
* frames).
|
||||
* allowImages requires the teximg13 capability; allowFwText requires
|
||||
* font15. Returns null when the plain paths should run instead (no
|
||||
* replayable draws, or identical frames).
|
||||
*/
|
||||
public static Result plan(
|
||||
byte[] previous, byte[] next, int width, int height,
|
||||
SurfaceCompositor.ScreenDraw[] draws,
|
||||
TextureCacheState cache, int fidStart,
|
||||
boolean allowMultiRect, int maxRects, boolean allowImages) {
|
||||
boolean allowMultiRect, int maxRects, boolean allowImages, boolean allowFwText) {
|
||||
if (next == null || draws == null || draws.length == 0 || width <= 0 || height <= 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -136,6 +148,21 @@ public final class TexturePlanner {
|
||||
List<Selected> selected = new ArrayList<>();
|
||||
int bakedCandidates = 0;
|
||||
int selectedImages = 0;
|
||||
// Builtin-font (mode 15) runs: no cache residency, no uploads — the
|
||||
// firmware owns the font. Processed first because it has no cache
|
||||
// side effects; the counters feed the shared stats.
|
||||
List<byte[]> fwSubs = new ArrayList<>();
|
||||
List<FwPunch> fwPunches = new ArrayList<>();
|
||||
int fwGlyphCount = 0;
|
||||
int fwBaked = 0;
|
||||
if (allowFwText) {
|
||||
for (SurfaceCompositor.ScreenDraw draw : draws) {
|
||||
if (draw.kind != SurfaceCompositor.ScreenDraw.KIND_FWTEXT) continue;
|
||||
fwBaked += planFwRun(draw, rects, next, stride, width, height, fwSubs, fwPunches);
|
||||
}
|
||||
fwGlyphCount = fwPunches.size();
|
||||
bakedCandidates += fwBaked;
|
||||
}
|
||||
for (SurfaceCompositor.ScreenDraw draw : draws) {
|
||||
if (draw.kind == SurfaceCompositor.ScreenDraw.KIND_GLYPH) {
|
||||
GlyphAtlas.Glyph atlas = GlyphAtlas.get(draw.fontId, draw.encoding);
|
||||
@@ -155,7 +182,7 @@ public final class TexturePlanner {
|
||||
bakedCandidates++;
|
||||
continue;
|
||||
}
|
||||
if (selected.size() >= MAX_GLYPH_RUNS * 10) { // soft cap before run grouping
|
||||
if (selected.size() >= MAX_SELECTED_GLYPHS) {
|
||||
bakedCandidates++;
|
||||
continue;
|
||||
}
|
||||
@@ -180,21 +207,20 @@ public final class TexturePlanner {
|
||||
selectedImages++;
|
||||
}
|
||||
}
|
||||
if (selected.isEmpty()) {
|
||||
if (selected.isEmpty() && fwSubs.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Residency: ensure every selected draw is in the cache, retrying once
|
||||
// after a reset when the bump allocator fills. A draw that still fails
|
||||
// falls back to baked. IMPORTANT: from here on, every bail-out to the
|
||||
// plain path must cache.reset() — ensure* marked entries resident
|
||||
// and queued uploads that only a returned Result would enqueue.
|
||||
List<Selected> drawable = ensureResident(cache, selected);
|
||||
// falls back to baked. IMPORTANT: once ensure* has run, every bail-out
|
||||
// to the plain path must cache.reset() — ensure* marked entries
|
||||
// resident and queued uploads that only a returned Result would
|
||||
// enqueue. (Fw-text needs no residency, so a fw-only plan skips this.)
|
||||
List<Selected> drawable = selected.isEmpty()
|
||||
? Collections.<Selected>emptyList()
|
||||
: ensureResident(cache, selected);
|
||||
bakedCandidates += selected.size() - drawable.size();
|
||||
if (drawable.isEmpty()) {
|
||||
cache.reset();
|
||||
return null;
|
||||
}
|
||||
|
||||
// Group glyphs into mode-14 runs; leftover-budget glyphs bake.
|
||||
List<Selected> glyphDrawable = new ArrayList<>();
|
||||
@@ -208,8 +234,11 @@ public final class TexturePlanner {
|
||||
bakedCandidates += glyphDrawable.size() - drawnGlyphs.size();
|
||||
List<Selected> drawn = new ArrayList<>(drawnGlyphs);
|
||||
drawn.addAll(imageDrawable);
|
||||
if (drawn.isEmpty() || rects.size() + runs.size() + imageDrawable.size() > 255) {
|
||||
cache.reset();
|
||||
if ((drawn.isEmpty() && fwSubs.isEmpty())
|
||||
|| rects.size() + runs.size() + imageDrawable.size() + fwSubs.size() > 255) {
|
||||
if (!selected.isEmpty()) {
|
||||
cache.reset();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -219,6 +248,9 @@ public final class TexturePlanner {
|
||||
for (Selected sel : drawn) {
|
||||
punch(punched, stride, width, height, sel);
|
||||
}
|
||||
for (FwPunch fw : fwPunches) {
|
||||
punchFw(punched, stride, width, height, fw);
|
||||
}
|
||||
|
||||
List<byte[]> subs = new ArrayList<>();
|
||||
int fid = fidStart;
|
||||
@@ -234,12 +266,184 @@ public final class TexturePlanner {
|
||||
subs.add(encodeImageDraw(cache, sel));
|
||||
}
|
||||
subs.addAll(runs);
|
||||
subs.addAll(fwSubs);
|
||||
byte[] payload = assembleMode8(subs);
|
||||
|
||||
int uploadBytes = cache.pendingUploadBytes();
|
||||
List<byte[]> uploads = cache.drainUploadPayloads(UPLOAD_PAYLOAD_MAX);
|
||||
return new Result(payload, uploads, fid, rects.size(), drawnGlyphs.size(), runs.size(),
|
||||
imageDrawable.size(), bakedCandidates, uploadBytes, fullFrame);
|
||||
imageDrawable.size(), fwGlyphCount, fwSubs.size(),
|
||||
bakedCandidates, uploadBytes, fullFrame);
|
||||
}
|
||||
|
||||
/** One punch task for an emitted firmware-font glyph. */
|
||||
private static final class FwPunch {
|
||||
final FwGlyphAtlas.Entry entry;
|
||||
final int gx;
|
||||
final int gy;
|
||||
|
||||
FwPunch(FwGlyphAtlas.Entry entry, int gx, int gy) {
|
||||
this.entry = entry;
|
||||
this.gx = gx;
|
||||
this.gy = gy;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plan one firmware-font run (mode 15): classify every member, and when
|
||||
* any correct ink member intersects a sent rect, emit sub-messages over
|
||||
* the maximal correct stretches. A stretch never spans an incorrect
|
||||
* member — the sub-message boundary restarts the firmware's advance walk
|
||||
* at an explicit pen x, so occluded or unknown glyphs simply stay baked
|
||||
* without disturbing their neighbors' positions. Emitted ink members are
|
||||
* queued for punching. Returns how many ink members stay baked.
|
||||
*/
|
||||
private static int planFwRun(
|
||||
SurfaceCompositor.ScreenDraw draw, List<int[]> rects,
|
||||
byte[] next, int stride, int width, int height,
|
||||
List<byte[]> outSubs, List<FwPunch> outPunches) {
|
||||
int n = draw.fwCps.length;
|
||||
if (n == 0 || draw.y < 0 || draw.y > 0xffff) {
|
||||
return countInk(draw);
|
||||
}
|
||||
int top = BmpUtil.nibbleForGray(draw.value);
|
||||
boolean[] ok = new boolean[n];
|
||||
FwGlyphAtlas.Entry[] entries = new FwGlyphAtlas.Entry[n];
|
||||
boolean relevant = false;
|
||||
int baked = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (!draw.fwInk[i]) {
|
||||
ok[i] = true; // inkless connector (space): draws nothing
|
||||
continue;
|
||||
}
|
||||
FwGlyphAtlas.Entry entry = FwGlyphAtlas.get(draw.fwCps[i]);
|
||||
if (entry == null) {
|
||||
baked++;
|
||||
continue;
|
||||
}
|
||||
int gx = draw.x + draw.fwDx[i] + entry.ofsX;
|
||||
int gy = draw.y + entry.inkTop;
|
||||
if (!fwGlyphMatchesComposite(next, stride, width, height, entry, gx, gy, top)) {
|
||||
baked++;
|
||||
continue;
|
||||
}
|
||||
ok[i] = true;
|
||||
entries[i] = entry;
|
||||
if (intersectsAny(rects, gx, gy, entry.boxW, entry.boxH)) {
|
||||
relevant = true;
|
||||
}
|
||||
}
|
||||
if (!relevant) {
|
||||
return 0; // nothing in a sent rect: leave the run's pixels alone
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (i < n && outSubs.size() < MAX_FWTEXT_RUNS) {
|
||||
while (i < n && !(ok[i] && draw.fwInk[i])) i++;
|
||||
if (i >= n) break;
|
||||
int startX = draw.x + draw.fwDx[i];
|
||||
if (startX < 0 || startX > 0xffff) {
|
||||
baked++;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
// Extend across correct members while the UTF-8 payload fits,
|
||||
// tracking the last ink member so trailing connectors trim away.
|
||||
int j = i;
|
||||
int lastInk = -1;
|
||||
int bytesToLastInk = 0;
|
||||
int bytesSoFar = 0;
|
||||
while (j < n && ok[j]) {
|
||||
int encodedLength = utf8Length(draw.fwCps[j]);
|
||||
if (bytesSoFar + encodedLength > 255) break;
|
||||
bytesSoFar += encodedLength;
|
||||
if (draw.fwInk[j]) {
|
||||
lastInk = j;
|
||||
bytesToLastInk = bytesSoFar;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
if (lastInk < i) { // a single over-long codepoint; not realistic
|
||||
baked++;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
byte[] sub = new byte[7 + bytesToLastInk];
|
||||
sub[0] = 15;
|
||||
sub[1] = (byte) (startX & 0xff);
|
||||
sub[2] = (byte) ((startX >> 8) & 0xff);
|
||||
sub[3] = (byte) (draw.y & 0xff);
|
||||
sub[4] = (byte) ((draw.y >> 8) & 0xff);
|
||||
sub[5] = (byte) (top | 0x10); // top color + transparent
|
||||
sub[6] = (byte) bytesToLastInk;
|
||||
int pos = 7;
|
||||
for (int k = i; k <= lastInk; k++) {
|
||||
byte[] encoded = new StringBuilder().appendCodePoint(draw.fwCps[k])
|
||||
.toString().getBytes(java.nio.charset.StandardCharsets.UTF_8);
|
||||
System.arraycopy(encoded, 0, sub, pos, encoded.length);
|
||||
pos += encoded.length;
|
||||
}
|
||||
outSubs.add(sub);
|
||||
for (int k = i; k <= lastInk; k++) {
|
||||
if (draw.fwInk[k]) {
|
||||
outPunches.add(new FwPunch(entries[k],
|
||||
draw.x + draw.fwDx[k] + entries[k].ofsX,
|
||||
draw.y + entries[k].inkTop));
|
||||
}
|
||||
}
|
||||
i = lastInk + 1;
|
||||
}
|
||||
return baked;
|
||||
}
|
||||
|
||||
private static int utf8Length(int cp) {
|
||||
if (cp < 0x80) return 1;
|
||||
if (cp < 0x800) return 2;
|
||||
if (cp < 0x10000) return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
private static int countInk(SurfaceCompositor.ScreenDraw draw) {
|
||||
int count = 0;
|
||||
for (boolean ink : draw.fwInk) {
|
||||
if (ink) count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether every in-panel nonzero pixel of the builtin-font glyph lands
|
||||
* correct: the composite's 4bpp value must equal the firmware's LUT
|
||||
* output src*top/15 (integer division — a general LUT check, since these
|
||||
* glyphs are anti-aliased).
|
||||
*/
|
||||
private static boolean fwGlyphMatchesComposite(byte[] packed, int stride, int width, int height,
|
||||
FwGlyphAtlas.Entry entry, int gx, int gy, int top) {
|
||||
for (int row = 0; row < entry.boxH; row++) {
|
||||
int y = gy + row;
|
||||
if (y < 0 || y >= height) continue;
|
||||
for (int col = 0; col < entry.boxW; col++) {
|
||||
int source = entry.nibbleAt(col, row);
|
||||
if (source == 0) continue;
|
||||
int x = gx + col;
|
||||
if (x < 0 || x >= width) continue;
|
||||
if (nibbleAt(packed, stride, x, y) != (source * top) / 15) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void punchFw(byte[] packed, int stride, int width, int height, FwPunch fw) {
|
||||
for (int row = 0; row < fw.entry.boxH; row++) {
|
||||
int y = fw.gy + row;
|
||||
if (y < 0 || y >= height) continue;
|
||||
for (int col = 0; col < fw.entry.boxW; col++) {
|
||||
if (fw.entry.nibbleAt(col, row) == 0) continue;
|
||||
punchPixel(packed, stride, width, fw.gx + col, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean intersectsAny(List<int[]> rects, int x, int y, int w, int h) {
|
||||
|
||||
@@ -139,6 +139,11 @@ export function compositePage(page: EvenHubPage | null, size: { width: number; h
|
||||
for (const container of paintOrder(page.containers)) {
|
||||
switch (container.kind) {
|
||||
case "image":
|
||||
// Text painted so far is deferred draws (firmware-text runs), which
|
||||
// would otherwise render above this container's raster. Stock puts a
|
||||
// later image container OVER earlier text, so bake the pending draws
|
||||
// first; text painted after this container stays deferred (and above).
|
||||
image.bakeDeferredDrawsInPlace();
|
||||
paintImageContainer(image, container);
|
||||
break;
|
||||
case "text":
|
||||
|
||||
@@ -19,7 +19,7 @@ export type FirmwarePatchSet = {
|
||||
export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
"base": "g2_2.2.6.10.bin",
|
||||
"baseSha256": "f4dfb0b49ad3de3c2daf17f8a27a157c3dc98411d6a0d3ab2cfd0918f41b9afa",
|
||||
"outputSha256": "401598582a01b1fd8243cdd9eb53689183cbda37f1dc8a5e2967065dea310b0c",
|
||||
"outputSha256": "82726bbe4d1d82f06a3d345ba3e5a4a39161077e5d26dcd7af24c4677df87fd1",
|
||||
"patches": [
|
||||
{
|
||||
"offset": 1089903,
|
||||
@@ -48,61 +48,61 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
{
|
||||
"offset": 1447919,
|
||||
"old": "7ef7fefd",
|
||||
"new": "bcf272fb",
|
||||
"new": "bcf24cfa",
|
||||
"desc": "bl snapshot_side @ 0x4db968"
|
||||
},
|
||||
{
|
||||
"offset": 1448931,
|
||||
"old": "7ef704fc",
|
||||
"new": "bcf278f9",
|
||||
"new": "bcf252f8",
|
||||
"desc": "bl snapshot_side @ 0x4dbd5c"
|
||||
},
|
||||
{
|
||||
"offset": 1165461,
|
||||
"old": "45f0cefd",
|
||||
"new": "01f323fb",
|
||||
"new": "01f3fdf9",
|
||||
"desc": "bl image_deferred (deferred consumer -> FIFO restore + worker, both lenses)"
|
||||
},
|
||||
{
|
||||
"offset": 1186287,
|
||||
"old": "d9f7d4ff",
|
||||
"new": "fdf250fa",
|
||||
"new": "fdf258f8",
|
||||
"desc": "bl settings_send_wrapper (append caps field 100)"
|
||||
},
|
||||
{
|
||||
"offset": 1183983,
|
||||
"old": "f4f75aff",
|
||||
"new": "fdf210fc",
|
||||
"new": "fdf21afa",
|
||||
"desc": "bl settings_decode_wrapper (Faceclaw lease field 101)"
|
||||
},
|
||||
{
|
||||
"offset": 926945,
|
||||
"old": "08f068fa",
|
||||
"new": "3cf333f9",
|
||||
"new": "3bf33dff",
|
||||
"desc": "bl faceclaw_display_start @ 0x45c65a (fail-open double-tap takeover)"
|
||||
},
|
||||
{
|
||||
"offset": 927137,
|
||||
"old": "08f008fa",
|
||||
"new": "3cf3d3f8",
|
||||
"new": "3bf3ddfe",
|
||||
"desc": "bl faceclaw_display_start @ 0x45c71a (fail-open double-tap takeover)"
|
||||
},
|
||||
{
|
||||
"offset": 822553,
|
||||
"old": "28f003f8",
|
||||
"new": "56f315f9",
|
||||
"new": "55f34dff",
|
||||
"desc": "bl evenhub_longpress (Faceclaw lease gates custom event vs stock dialog)"
|
||||
},
|
||||
{
|
||||
"offset": 823369,
|
||||
"old": "1cf09bfb",
|
||||
"new": "55f3a3ff",
|
||||
"new": "55f3dbfd",
|
||||
"desc": "bl ring_release (forward ring release-long-press)"
|
||||
},
|
||||
{
|
||||
"offset": 1474137,
|
||||
"old": "7fb50600",
|
||||
"new": "b7f209b8",
|
||||
"new": "b6f211be",
|
||||
"desc": "even_ai_display_ctrl entry -> conditional Faceclaw lease trampoline"
|
||||
},
|
||||
{
|
||||
@@ -120,13 +120,13 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
{
|
||||
"offset": 1198787,
|
||||
"old": "dff770fb",
|
||||
"new": "f9f23cfd",
|
||||
"new": "f9f28cfb",
|
||||
"desc": "bl faceclaw_send_wear_event @ 0x49ec3c (outside onboarding)"
|
||||
},
|
||||
{
|
||||
"offset": 1198881,
|
||||
"old": "dff741fb",
|
||||
"new": "f9f20dfd",
|
||||
"new": "f9f25dfb",
|
||||
"desc": "bl faceclaw_send_wear_event @ 0x49ec9a (outside onboarding)"
|
||||
},
|
||||
{
|
||||
@@ -138,43 +138,43 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
{
|
||||
"offset": 4301227,
|
||||
"old": "",
|
||||
"new": "02fb01f000e000bfb0b546f27424c2f22a040146206846f23f52c5f28802b2eb500f40f2543044f281124cf67e25c2f20000c0f24802caf2101518bf25609047002804bf691c2160b0bd00bf0846ffe7014640f2543044f29f22c2f20000c0f24802104770b500284ed001684ef66662ccf2ff02914218bf70bd90f8081190f8095142f6c52c8d42c0f2500c2ad205eb8501014491f80d2191f80e4191f80ae191f80b3191f80c1142ea0424012c4ff0010298bf14466e1c054680f80961b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f80811bde870406047e047d5f8040138b149f29942c0f244022146bde87040104770bd00bf70b54ff6fd03c0f2450314460d46984746f27021c2f22a010e6831466ff39601b1f1005f0ad131684ef66662ccf2ff02914218bf0026412d03d070bd0026412dfbd1002cf9d04af26951c0f2450105468847002e01462846efd00129edd196f807120029e9d02168002948bf70bd47f25d02c0f2580208469047284670bd00bf2de9f04f9db046f2702ac2f22a0adaf800b058466ff39600b0f1005f40f07d81dbf800004ef66667ccf2ff07b84240f074819bf82802002800f05d81dbf82442002c00f0588140f2b870c2f20000d0f8008004a802f0d8ffb8f1000f00f02782032045f24075cff68070a4f1600108f160026ff0bf03c0f2020500bf0e6ed41826664e6ec03366668e6eab42a666ce6ee6660e6f26674e6f66678e6fa667ce6fe667d1f88060c4f88060d1f88460c4f88460d1f88860c4f88860d1f88c60c4f88c60d1f89060c4f89060d1f89460c4f89460d1f89860c4f89860d1f89c60c4f89c60d1f8a060c4f8a060d1f8a460c4f8a460d1f8a860c4f8a860d1f8ac60c4f8ac60d1f8b060c4f8b060d1f8b460c4f8b460d1f8b860c4f8b860d1f8bc60c4f8bc6051f8c06fc4f8c0604e68c4f8c4608e68c4f8c860ce68c4f8cc600e69c4f8d0604e69c4f8d4608e69c4f8d860ce69c4f8dc600e6ac4f8e0604e6ac4f8e4608e6ac4f8e860ce6ac4f8ec600e6bc4f8f0604e6bc4f8f4608e6bc4f8f860ce6bc4f8fc600e6cc4f800614e6cc4f804618e6cc4f80861ce6cc4f80c610e6dc4f810614e6dc4f814618e6dc4f81861ce6dc4f81c617ff462afdaf800603040b0f1005f40f0b2803068b84240f0ae8096f8ce00002840f07e8196f8dc10002000298df8140000f0f68105a90a5c002a00f0c9810a185378002b00f087819378002b00f08581d378002b00f083811379002b00f081815379002b00f07f819379002b00f07d81d379002b00f07b81137a002b00f07981537a002b00f07781937a002b00f07581d37a002b00f07381137b002b00f07181537b002b00f06f81937b002b00f06d81d37b002b00f06b81137c002b00f06981537c002b00f06781937c002b00f06581d37c002b00f06381137d002b00f06181537d002b00f05f81937d002b00f05d81d37d002b00f05b81137e002b00f05981537e002b00f05781937e002b00f05581d37e002b00f05381137f002b00f05181537f002b00f04f81937f002b00f04d81d27f002a00f04b81203060287ff47baf6ae19bf82a0270b1dbf82c0240b144f63421c2f207010968401a002800f3f88000208bf82a024cf61520c0f246001db0bde8f04f004704f0cdfc002800f0cd804ff6d051cff6ff71002200bf4318463183f8302283f8312283f8322283f8332283f8342283f8352283f8362283f8372283f8382283f8392283f83a2283f83b2283f83c2283f83d2283f83e2283f83f2283f8402283f8412283f8422283f8432283f8442283f8452283f8462283f8472283f8482283f8492283f84a2283f84b2283f84c2283f84d2283f84e2283f84f2283f8502283f8512283f8522283f8532283f8542283f8552283f8562283f8572283f8582283f8592283f85a2283f85b2283f85c2283f85d2283f85e2283f85f2283f8602283f8612283f8622283f8632283f8642283f8652283f8662283f8672283f8682283f8692283f86a2283f86b2283f86c2283f86d2283f86e2283f86f2283f8702283f8712283f8722283f8732283f8742283f875227ff470af012180f8ce104ff0ff310760a0f8e010a0f8e210a0f8e410a0f8e610a0f8e810a0f8ea10a0f8ec10a0f8ee10a0f8f010a0f8f210a0f8f410a0f8f610a0f8f810a0f8fa10a0f8fc10a0f8fe1010e000208bf82802cbf824028bf82a0201208bf829024cf61520c0f24600804715e00020caf8000000208bf82802cbf824024ff4163045f20f11069005a8c0f24701cdf81480884701208bf82a0204a802f0b8fecbf8d4001db0bde8f08f01303ae0023038e0033036e0043034e0053032e0063030e007302ee008302ce009302ae00a3028e00b3026e00c3024e00d3022e00e3020e00f301ee010301ce011301ae0123018e0133016e0143014e0153012e0163010e017300ee018300ce019300ae01a3008e01b3006e01c3004e01d3002e01e3000e01f305f2821d84ff052020a541dd0014445225e284a7018d04f225d288a7014d052225c28ca7010d044225b280a710cd045225a284a7108d0522259288a7104d020225828ca7142f0168500208df87300012096f8dd10002900f0c280002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf54e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2915d84ff05303535411d00a444b235e2953700cd049235d29937008d050235c29d37004d020235b29137140f0c28200218df87310013096f8de10002900f0be80002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f0Line truncated
|
||||
"new": "02fb01f000e000bfb0b546f27424c2f22a040146206846f23f52c5f28802b2eb500f40f2543044f281124cf67e25c2f20000c0f24802caf2101518bf25609047002804bf691c2160b0bd00bf0846ffe7014640f2543044f29f22c2f20000c0f24802104770b500284ed001684ef66762ccf2ff02914218bf70bd90f8081190f8095142f6c52c8d42c0f2500c2ad205eb8501014491f80d2191f80e4191f80ae191f80b3191f80c1142ea0424012c4ff0010298bf14466e1c054680f80961b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f80811bde870406047e047d5f8040138b149f29942c0f244022146bde87040104770bd00bf70b54ff6fd03c0f2450314460d46984746f27021c2f22a010e6831466ff39601b1f1005f0ad131684ef66762ccf2ff02914218bf0026412d03d070bd0026412dfbd1002cf9d04af26951c0f2450105468847002e01462846efd00129edd196f807120029e9d02168002948bf70bd47f25d02c0f2580208469047284670bd00bf2de9f04f9db046f2702ac2f22a0adaf800b058466ff39600b0f1005f40f07d81dbf800004ef66767ccf2ff07b84240f074819bf82802002800f05d81dbf82442002c00f0588140f2b870c2f20000d0f8008004a802f08effb8f1000f00f0dd81032045f24075cff68070a4f1600108f160026ff0bf03c0f2020500bf0e6ed41826664e6ec03366668e6eab42a666ce6ee6660e6f26674e6f66678e6fa667ce6fe667d1f88060c4f88060d1f88460c4f88460d1f88860c4f88860d1f88c60c4f88c60d1f89060c4f89060d1f89460c4f89460d1f89860c4f89860d1f89c60c4f89c60d1f8a060c4f8a060d1f8a460c4f8a460d1f8a860c4f8a860d1f8ac60c4f8ac60d1f8b060c4f8b060d1f8b460c4f8b460d1f8b860c4f8b860d1f8bc60c4f8bc6051f8c06fc4f8c0604e68c4f8c4608e68c4f8c860ce68c4f8cc600e69c4f8d0604e69c4f8d4608e69c4f8d860ce69c4f8dc600e6ac4f8e0604e6ac4f8e4608e6ac4f8e860ce6ac4f8ec600e6bc4f8f0604e6bc4f8f4608e6bc4f8f860ce6bc4f8fc600e6cc4f800614e6cc4f804618e6cc4f80861ce6cc4f80c610e6dc4f810614e6dc4f814618e6dc4f81861ce6dc4f81c617ff462afdaf800603040b0f1005f40f0b2803068b84240f0ae8096f8ce00002840f0348196f8dc10002000298df8140000f0ac8105a90a5c002a00f07f810a185378002b00f03d819378002b00f03b81d378002b00f039811379002b00f037815379002b00f035819379002b00f03381d379002b00f03181137a002b00f02f81537a002b00f02d81937a002b00f02b81d37a002b00f02981137b002b00f02781537b002b00f02581937b002b00f02381d37b002b00f02181137c002b00f01f81537c002b00f01d81937c002b00f01b81d37c002b00f01981137d002b00f01781537d002b00f01581937d002b00f01381d37d002b00f01181137e002b00f00f81537e002b00f00d81937e002b00f00b81d37e002b00f00981137f002b00f00781537f002b00f00581937f002b00f00381d27f002a00f00181203060287ff47baf20e19bf82a0270b1dbf82c0240b144f63421c2f207010968401a002800f3ae8000208bf82a024cf61520c0f246001db0bde8f04f004704f005fb002800f0838000216ff017020023c518c1542f338618b3f50d7f02f12f026970a970e97029716971a971e97129726972a972e97229736973a973e97329746974a974e97429756975a97586f82f1086f830106976a976e97629776977a977e97785f8201085f8211085f8221085f8231085f8241085f8251085f8261085f8271085f8281085f8291085f82a1085f82b1085f82c1085f82d1085f82e10b7d1012180f8ce104ff0ff310760a0f8e010a0f8e210a0f8e410a0f8e610a0f8e810a0f8ea10a0f8ec10a0f8ee10a0f8f010a0f8f210a0f8f410a0f8f610a0f8f810a0f8fa10a0f8fc10a0f8fe1010e000208bf82802cbf824028bf82a0201208bf829024cf61520c0f24600804715e00020caf8000000208bf82802cbf824024ff4163045f20f11069005a8c0f24701cdf81480884701208bf82a0204a802f06efecbf8d4001db0bde8f08f01303ae0023038e0033036e0043034e0053032e0063030e007302ee008302ce009302ae00a3028e00b3026e00c3024e00d3022e00e3020e00f301ee010301ce011301ae0123018e0133016e0143014e0153012e0163010e017300ee018300ce019300ae01a3008e01b3006e01c3004e01d3002e01e3000e01f305f2821d84ff052020a541dd0014445225e284a7018d04f225d288a7014d052225c28ca7010d044225b280a710cd045225a284a7108d0522259288a7104d020225828ca7142f0168500208df87300012096f8dd10002900f0c280002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf54e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2915d84ff05303535411d00a444b235e2953700cd049235d29937008d050235c29d37004d020235b29137140f0c28200218df87310013096f8de10002900f0be80002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf50e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2911d84ff0440353540dd00Line truncated
|
||||
"desc": "append injected blobs to main-app payload"
|
||||
},
|
||||
{
|
||||
"offset": 777711,
|
||||
"old": "44c33500",
|
||||
"new": "12353600",
|
||||
"new": "604b3600",
|
||||
"desc": "main-app subheader payload size (ps)"
|
||||
},
|
||||
{
|
||||
"offset": 152,
|
||||
"old": "c4c33500",
|
||||
"new": "92353600",
|
||||
"new": "e04b3600",
|
||||
"desc": "main-app TOC entry size (ps + 128)"
|
||||
},
|
||||
{
|
||||
"offset": 777831,
|
||||
"old": "44c33504",
|
||||
"new": "12353604",
|
||||
"new": "604b3604",
|
||||
"desc": "main-app preamble length (low 24 bits)"
|
||||
},
|
||||
{
|
||||
"offset": 777835,
|
||||
"old": "df8110c9",
|
||||
"new": "cb656261",
|
||||
"new": "562ec508",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
|
||||
},
|
||||
{
|
||||
"offset": 156,
|
||||
"old": "c1be0fb1",
|
||||
"new": "b053052f",
|
||||
"new": "ef84d21c",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
|
||||
},
|
||||
{
|
||||
"offset": 777715,
|
||||
"old": "c1be0fb1",
|
||||
"new": "b053052f",
|
||||
"new": "ef84d21c",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ import { File, knownFolders } from "@nativescript/core";
|
||||
import { getTextWidth } from "@evenrealities/pretext";
|
||||
import { EVENHUB_RUNTIME_FONT_FILENAME, isEvenHubFontAsset } from "../g2/firmware-fonts";
|
||||
import { toUint8Array } from "../util/array-util";
|
||||
import { GrayImage } from "./image";
|
||||
import { GrayImage, type FwTextFont, type PlacedFwText, type PlacedFwTextGlyph } from "./image";
|
||||
|
||||
declare const com: any;
|
||||
|
||||
@@ -61,7 +61,35 @@ function base64Decode(text: string): Uint8Array {
|
||||
return out.subarray(0, outIndex);
|
||||
}
|
||||
|
||||
export class EvenHubFont {
|
||||
/**
|
||||
* Codepoint ranges whose glyphs the font asset merged from the flash CJK
|
||||
* font with a baseline-shifted ofsY (see scripts/build-evenhub-font.mjs).
|
||||
* The shift keeps the phone-side composite right, but the firmware's mode-15
|
||||
* draw uses the root font's baseline with the glyph's TRUE ofsY, so the two
|
||||
* may disagree by the shift — keep these baked until the fallback placement
|
||||
* is hardware-verified. Mirrors the build script's SYMBOL_RANGES.
|
||||
*/
|
||||
const MODE15_UNCERTAIN_RANGES: ReadonlyArray<readonly [number, number]> = [
|
||||
[0x2000, 0x206f], [0x2100, 0x214f], [0x2190, 0x21ff], [0x2200, 0x22ff],
|
||||
[0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff],
|
||||
[0x2700, 0x27bf], [0x3000, 0x303f], [0xff00, 0xffef],
|
||||
];
|
||||
|
||||
function inMode15UncertainRange(cp: number): boolean {
|
||||
for (const [start, end] of MODE15_UNCERTAIN_RANGES) {
|
||||
if (cp >= start && cp <= end) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** The 4bpp level an 8-bit value packs to (BmpUtil's GRAY_TO_NIBBLE). */
|
||||
function quantNibble(value: number): number {
|
||||
return value <= 0 ? 0 : Math.min(15, (value + 8) >> 4);
|
||||
}
|
||||
|
||||
export class EvenHubFont implements FwTextFont {
|
||||
/** One builtin firmware font today; see FwTextFont. */
|
||||
readonly atlasTag = 1;
|
||||
readonly lineHeight: number;
|
||||
readonly baseline: number;
|
||||
private readonly glyphs: Map<number, GlyphRecord>;
|
||||
@@ -195,22 +223,110 @@ export class EvenHubFont {
|
||||
return lines;
|
||||
}
|
||||
|
||||
/** Draw one line of text with its top-left at (x, y). Missing glyphs are skipped. */
|
||||
/**
|
||||
* Draw one line of text with its top-left at (x, y). Missing glyphs are
|
||||
* skipped.
|
||||
*
|
||||
* Glyphs the firmware's mode-15 builtin-font draw renders identically to
|
||||
* our raster (native-table entries outside MODE15_UNCERTAIN_RANGES) are
|
||||
* recorded as deferred firmware-text runs: maximal stretches laid out with
|
||||
* consecutive pretext advances, spaces included as inkless connectors so
|
||||
* the firmware's own advance/kerning walk stays in lockstep. Anything else
|
||||
* (CJK fallback, shifted symbols, unknown codepoints) rasters immediately
|
||||
* and breaks the run — a break means the next run restarts at an explicit
|
||||
* pen x, so no cursor prediction ever spans an uncertain glyph.
|
||||
*/
|
||||
drawText(image: GrayImage, x: number, y: number, text: string, value = 255): void {
|
||||
const cps = Array.from(text).map((c) => c.codePointAt(0)!);
|
||||
const baselineY = y + this.baseline;
|
||||
let penX = x;
|
||||
let run: PlacedFwTextGlyph[] = [];
|
||||
let runX = 0;
|
||||
const flushRun = () => {
|
||||
if (run.length) {
|
||||
this.emitRun(image, runX, y, value, run);
|
||||
run = [];
|
||||
}
|
||||
};
|
||||
for (let i = 0; i < cps.length; i++) {
|
||||
const cp = cps[i]!;
|
||||
const glyph = this.glyphs.get(cp);
|
||||
if (glyph) {
|
||||
if (glyph && !inMode15UncertainRange(cp)) {
|
||||
if (run.length === 0) runX = penX;
|
||||
run.push({
|
||||
cp,
|
||||
dx: penX - runX,
|
||||
ink: glyph[0] > 0 && glyph[1] > 0 && glyph[5] > 0,
|
||||
});
|
||||
} else if (glyph) {
|
||||
flushRun();
|
||||
this.drawGlyph(image, glyph, this.bitmap, penX, baselineY, value);
|
||||
} else {
|
||||
flushRun();
|
||||
const cjk = this.getCjkGlyph(cp);
|
||||
if (cjk) this.drawGlyph(image, cjk.record, cjk.bitmap, penX, y + this.cjkBaseline, value);
|
||||
}
|
||||
penX += this.advanceOf(cp, cps[i + 1] ?? 0);
|
||||
}
|
||||
flushRun();
|
||||
}
|
||||
|
||||
/** Record one run, trimmed of inkless leading/trailing connectors. */
|
||||
private emitRun(
|
||||
image: GrayImage,
|
||||
runX: number,
|
||||
lineY: number,
|
||||
value: number,
|
||||
members: PlacedFwTextGlyph[],
|
||||
): void {
|
||||
let first = 0;
|
||||
let last = members.length - 1;
|
||||
while (first <= last && !members[first]!.ink) first++;
|
||||
while (last >= first && !members[last]!.ink) last--;
|
||||
if (first > last) return; // nothing visible
|
||||
const startX = runX + members[first]!.dx;
|
||||
const trimmed = members.slice(first, last + 1).map((member) =>
|
||||
first === 0 ? member : { ...member, dx: member.dx - members[first]!.dx },
|
||||
);
|
||||
image.drawFwText(this, startX, lineY, value, trimmed);
|
||||
}
|
||||
|
||||
/** FwTextFont: bake a recorded run with firmware-exact pixel math. */
|
||||
bakeFwTextRun(target: GrayImage, run: PlacedFwText, dx: number, dy: number): void {
|
||||
const baselineY = run.y + dy + this.baseline;
|
||||
for (const member of run.glyphs) {
|
||||
if (!member.ink) continue;
|
||||
const glyph = this.glyphs.get(member.cp);
|
||||
if (glyph) this.drawGlyph(target, glyph, this.bitmap, run.x + member.dx + dx, baselineY, run.value);
|
||||
}
|
||||
}
|
||||
|
||||
/** FwTextFont: raster registration data for the Java-side planner. */
|
||||
fwGlyphWireData(cp: number): {
|
||||
ofsX: number;
|
||||
inkTop: number;
|
||||
boxW: number;
|
||||
boxH: number;
|
||||
nibbles: Uint8Array;
|
||||
} | null {
|
||||
const glyph = this.glyphs.get(cp);
|
||||
if (!glyph) return null;
|
||||
const [boxW, boxH, ofsX, ofsY, off, len] = glyph;
|
||||
if (boxW <= 0 || boxH <= 0 || len <= 0 || boxW > 255 || boxH > 255) return null;
|
||||
if (ofsX < -32768 || ofsX > 32767) return null;
|
||||
const inkTop = this.baseline - boxH - ofsY;
|
||||
if (inkTop < -32768 || inkTop > 32767) return null;
|
||||
// Repack from the source stride (floor(boxW/2)+1, pad nibble at odd
|
||||
// widths) to the wire stride ceil(boxW/2).
|
||||
const srcStride = Math.floor(boxW / 2) + 1;
|
||||
const outStride = (boxW + 1) >> 1;
|
||||
const nibbles = new Uint8Array(outStride * boxH);
|
||||
for (let row = 0; row < boxH; row++) {
|
||||
for (let byte = 0; byte < outStride; byte++) {
|
||||
nibbles[row * outStride + byte] = this.bitmap[off + row * srcStride + byte] ?? 0;
|
||||
}
|
||||
}
|
||||
return { ofsX, inkTop, boxW, boxH, nibbles };
|
||||
}
|
||||
|
||||
/** Draw wrapped text within a box; returns the number of lines drawn. */
|
||||
@@ -257,13 +373,19 @@ export class EvenHubFont {
|
||||
const stride = Math.floor(boxW / 2) + 1;
|
||||
const left = penX + ofsX;
|
||||
const top = baselineY - boxH - ofsY;
|
||||
// Firmware-exact shading: the CFW draws through a LUT mapping source
|
||||
// nibble n to n*top/15 (integer), skipping only n == 0. Writing 16*level
|
||||
// makes the composite quantize (min(15, (v+8)>>4)) back to exactly that
|
||||
// level, so the texture-cache planner's pixel checks — and the shadow
|
||||
// after an on-glasses mode-15 draw — match this bake bit-for-bit.
|
||||
const top4 = quantNibble(value);
|
||||
for (let row = 0; row < boxH; row++) {
|
||||
const rowStart = off + row * stride;
|
||||
for (let col = 0; col < boxW; col++) {
|
||||
const byte = bitmap[rowStart + (col >> 1)] ?? 0;
|
||||
const nibble = col % 2 === 0 ? byte >> 4 : byte & 0x0f;
|
||||
if (nibble === 0) continue;
|
||||
image.setPixel(left + col, top + row, Math.round((nibble / 15) * value));
|
||||
image.setPixel(left + col, top + row, Math.floor((nibble * top4) / 15) * 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
* only means "no wire savings for this draw".
|
||||
*/
|
||||
import { BdfFont, Glyph } from "./bdffont";
|
||||
import { GrayImage, type DeferredDraw, type PlacedImage } from "./image";
|
||||
import { GrayImage, type DeferredDraw, type PlacedFwText, type PlacedImage } from "./image";
|
||||
|
||||
declare const com: any;
|
||||
|
||||
const GLYPH_RECORD_BYTES = 12; // [0][fontId u16][encoding u32][penX s16][lineY s16][value u8]
|
||||
const IMAGE_RECORD_BYTES = 9; // [1][imageId u32][x s16][y s16]
|
||||
const GLYPH_RECORD_BYTES = 12; // [0][fontId u16][encoding u32][penX s16][lineY s16][value u8]
|
||||
const IMAGE_RECORD_BYTES = 9; // [1][imageId u32][x s16][y s16]
|
||||
const FWTEXT_HEADER_BYTES = 7; // [2][x s16][y s16][value u8][count u8]
|
||||
const FWTEXT_MEMBER_BYTES = 7; // [cp u32][dx s16][ink u8]
|
||||
|
||||
type FontWireState = {
|
||||
fontId: number;
|
||||
@@ -74,6 +76,51 @@ function representableGlyph(font: BdfFont, glyph: Glyph): boolean {
|
||||
return inkTop >= 0 && inkTop + glyph.bbxHeight <= font.lineHeight;
|
||||
}
|
||||
|
||||
/** Firmware-font codepoints already registered with the Java FwGlyphAtlas. */
|
||||
const fwRegistered = new Set<string>();
|
||||
|
||||
/**
|
||||
* Whether a firmware-text run is expressible on the wire, registering any
|
||||
* unseen ink members' rasters with the Java FwGlyphAtlas as a side effect.
|
||||
*/
|
||||
function prepareFwTextRun(placed: PlacedFwText): boolean {
|
||||
if (!inRange16(placed.x) || !inRange16(placed.y)) return false;
|
||||
if (placed.glyphs.length === 0 || placed.glyphs.length > 255) return false;
|
||||
let registration: Array<{ cp: number; data: NonNullable<ReturnType<PlacedFwText["font"]["fwGlyphWireData"]>> }> | null = null;
|
||||
for (const member of placed.glyphs) {
|
||||
if (member.cp < 0 || member.cp > 0x10ffff || !inRange16(member.dx)) return false;
|
||||
if (!member.ink) continue;
|
||||
const key = `${placed.font.atlasTag}:${member.cp}`;
|
||||
if (fwRegistered.has(key)) continue;
|
||||
const data = placed.font.fwGlyphWireData(member.cp);
|
||||
if (!data) return false; // ink without raster data: keep the run baked
|
||||
fwRegistered.add(key);
|
||||
registration ??= [];
|
||||
registration.push({ cp: member.cp, data });
|
||||
}
|
||||
if (registration) {
|
||||
let total = 0;
|
||||
for (const entry of registration) {
|
||||
total += 10 + entry.data.nibbles.length;
|
||||
}
|
||||
const buffer = new ArrayBuffer(total);
|
||||
const view = new DataView(buffer);
|
||||
const bytes = new Uint8Array(buffer);
|
||||
let offset = 0;
|
||||
for (const entry of registration) {
|
||||
view.setUint32(offset, entry.cp, true);
|
||||
view.setInt16(offset + 4, entry.data.ofsX, true);
|
||||
view.setInt16(offset + 6, entry.data.inkTop, true);
|
||||
view.setUint8(offset + 8, entry.data.boxW);
|
||||
view.setUint8(offset + 9, entry.data.boxH);
|
||||
bytes.set(entry.data.nibbles, offset + 10);
|
||||
offset += 10 + entry.data.nibbles.length;
|
||||
}
|
||||
com.faceclaw.app.FwGlyphAtlas.register(buffer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Resolve (registering on first sight) the Java image id for a drawImage source. */
|
||||
function imageId(placed: PlacedImage): number | null {
|
||||
if (!global.isAndroid) return null;
|
||||
@@ -100,13 +147,16 @@ function inRange16(v: number): boolean {
|
||||
* alongside the frame's pixels: little-endian tagged records
|
||||
* [0][fontId u16][encoding u32][penX s16][lineY s16][value u8] (glyph)
|
||||
* [1][imageId u32][x s16][y s16] (image)
|
||||
* [2][x s16][y s16][value u8][count u8] (fw text run)
|
||||
* then count x [cp u32][dx s16][ink u8]
|
||||
* in draw order. Returns null when nothing is expressible (or off-Android).
|
||||
*/
|
||||
export function prepareFrameDraws(draws: readonly DeferredDraw[]): ArrayBuffer | null {
|
||||
if (!global.isAndroid || draws.length === 0) return null;
|
||||
|
||||
// Pass 1: resolve ids, collect unregistered glyph rasters, size the buffer.
|
||||
// Pass 1: resolve ids, register unseen rasters, size the buffer.
|
||||
let registration: Map<FontWireState, { font: BdfFont; glyphs: Glyph[] }> | null = null;
|
||||
const fwRunOk = new Map<PlacedFwText, boolean>();
|
||||
let bytes = 0;
|
||||
for (const placed of draws) {
|
||||
if (placed.kind === "glyph") {
|
||||
@@ -123,9 +173,13 @@ export function prepareFrameDraws(draws: readonly DeferredDraw[]): ArrayBuffer |
|
||||
registration.set(state, group);
|
||||
}
|
||||
group.glyphs.push(placed.glyph);
|
||||
} else {
|
||||
} else if (placed.kind === "image") {
|
||||
if (!inRange16(placed.x) || !inRange16(placed.y)) continue;
|
||||
if (imageId(placed) !== null) bytes += IMAGE_RECORD_BYTES;
|
||||
} else {
|
||||
const ok = prepareFwTextRun(placed);
|
||||
fwRunOk.set(placed, ok);
|
||||
if (ok) bytes += FWTEXT_HEADER_BYTES + placed.glyphs.length * FWTEXT_MEMBER_BYTES;
|
||||
}
|
||||
}
|
||||
if (registration) {
|
||||
@@ -137,8 +191,8 @@ export function prepareFrameDraws(draws: readonly DeferredDraw[]): ArrayBuffer |
|
||||
const out = new DataView(new ArrayBuffer(bytes));
|
||||
let offset = 0;
|
||||
for (const placed of draws) {
|
||||
if (!inRange16(placed.x) || !inRange16(placed.y)) continue;
|
||||
if (placed.kind === "glyph") {
|
||||
if (!inRange16(placed.x) || !inRange16(placed.y)) continue;
|
||||
const state = fontWireState(placed.font);
|
||||
if (!state || !representableGlyph(placed.font, placed.glyph)) continue;
|
||||
out.setUint8(offset, 0);
|
||||
@@ -148,7 +202,8 @@ export function prepareFrameDraws(draws: readonly DeferredDraw[]): ArrayBuffer |
|
||||
out.setInt16(offset + 9, placed.y, true);
|
||||
out.setUint8(offset + 11, placed.value);
|
||||
offset += GLYPH_RECORD_BYTES;
|
||||
} else {
|
||||
} else if (placed.kind === "image") {
|
||||
if (!inRange16(placed.x) || !inRange16(placed.y)) continue;
|
||||
const id = imageId(placed);
|
||||
if (id === null) continue;
|
||||
out.setUint8(offset, 1);
|
||||
@@ -156,6 +211,20 @@ export function prepareFrameDraws(draws: readonly DeferredDraw[]): ArrayBuffer |
|
||||
out.setInt16(offset + 5, placed.x, true);
|
||||
out.setInt16(offset + 7, placed.y, true);
|
||||
offset += IMAGE_RECORD_BYTES;
|
||||
} else {
|
||||
if (!fwRunOk.get(placed)) continue;
|
||||
out.setUint8(offset, 2);
|
||||
out.setInt16(offset + 1, placed.x, true);
|
||||
out.setInt16(offset + 3, placed.y, true);
|
||||
out.setUint8(offset + 5, placed.value);
|
||||
out.setUint8(offset + 6, placed.glyphs.length);
|
||||
offset += FWTEXT_HEADER_BYTES;
|
||||
for (const member of placed.glyphs) {
|
||||
out.setUint32(offset, member.cp, true);
|
||||
out.setInt16(offset + 4, member.dx, true);
|
||||
out.setUint8(offset + 6, member.ink ? 1 : 0);
|
||||
offset += FWTEXT_MEMBER_BYTES;
|
||||
}
|
||||
}
|
||||
}
|
||||
return out.buffer;
|
||||
|
||||
+97
-3
@@ -50,13 +50,62 @@ export type PlacedImage = {
|
||||
y: number;
|
||||
};
|
||||
|
||||
/** One member of a firmware-font text run: codepoint at run.x + dx; ink =
|
||||
* whether it has visible pixels (spaces are inkless connectors kept for the
|
||||
* firmware's own advance/kerning continuity). */
|
||||
export type PlacedFwTextGlyph = {
|
||||
cp: number;
|
||||
dx: number;
|
||||
ink: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The provider behind firmware-font text runs (implemented by EvenHubFont).
|
||||
* Structural interface so image.ts needs no import: the font both bakes runs
|
||||
* phone-side (with firmware-exact pixel math) and serves per-glyph raster
|
||||
* data for the Java-side eligibility checks.
|
||||
*/
|
||||
export interface FwTextFont {
|
||||
/** Stable tag for fingerprints/registration (one builtin font today). */
|
||||
readonly atlasTag: number;
|
||||
bakeFwTextRun(target: GrayImage, run: PlacedFwText, dx: number, dy: number): void;
|
||||
/** Wire-registration raster for a run member, or null when unavailable. */
|
||||
fwGlyphWireData(cp: number): {
|
||||
ofsX: number;
|
||||
/** First ink row relative to the run's line-top y. */
|
||||
inkTop: number;
|
||||
boxW: number;
|
||||
boxH: number;
|
||||
/** 4bpp rows, stride ceil(boxW/2), high nibble = left pixel. */
|
||||
nibbles: Uint8Array;
|
||||
} | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* One deferred firmware-font text run (CFW mode 15): a maximal stretch of
|
||||
* text that EvenHubFont laid out with consecutive pretext advances, drawn by
|
||||
* the glasses' builtin 20px font chain. Members' dx are relative to x so
|
||||
* translation only touches x/y. Runs must only be built over glyphs whose
|
||||
* on-glasses rendering the phone predicts exactly (the font enforces this).
|
||||
*/
|
||||
export type PlacedFwText = {
|
||||
kind: "fwtext";
|
||||
font: FwTextFont;
|
||||
/** Pen x of the first member; the wire draw starts exactly here. */
|
||||
x: number;
|
||||
/** Line top y (the mode-15 y argument). */
|
||||
y: number;
|
||||
value: number;
|
||||
glyphs: readonly PlacedFwTextGlyph[];
|
||||
};
|
||||
|
||||
/**
|
||||
* A retained draw, always rendered on top of the raster pixels regardless of
|
||||
* draw order (deferred draws keep their order among themselves). An overlay
|
||||
* that must cover deferred draws below it needs its own plane (see plane.ts)
|
||||
* or must suppress the covered draws.
|
||||
*/
|
||||
export type DeferredDraw = PlacedGlyph | PlacedImage;
|
||||
export type DeferredDraw = PlacedGlyph | PlacedImage | PlacedFwText;
|
||||
|
||||
export class GrayImage {
|
||||
readonly width: number;
|
||||
@@ -321,11 +370,19 @@ export class GrayImage {
|
||||
hash = mixInt(hash, placed.font.fingerprintId);
|
||||
hash = mixInt(hash, placed.glyph.encoding);
|
||||
hash = mixInt(hash, placed.value);
|
||||
} else {
|
||||
} else if (placed.kind === "image") {
|
||||
hash = mixInt(hash, 0x1c0e5);
|
||||
hash = mixInt(hash, placed.source.width);
|
||||
hash = mixInt(hash, placed.source.height);
|
||||
hash = mixInt(hash, placed.source.contentHash32());
|
||||
} else {
|
||||
hash = mixInt(hash, 0xf17e);
|
||||
hash = mixInt(hash, placed.font.atlasTag);
|
||||
hash = mixInt(hash, placed.value);
|
||||
for (const member of placed.glyphs) {
|
||||
hash = mixInt(hash, member.cp);
|
||||
hash = mixInt(hash, member.dx);
|
||||
}
|
||||
}
|
||||
hash = mixInt(hash, placed.x);
|
||||
hash = mixInt(hash, placed.y);
|
||||
@@ -373,6 +430,41 @@ export class GrayImage {
|
||||
this.drawList.push({ kind: "image", source: source.withDrawsBaked(), x, y });
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a firmware-font text run (see PlacedFwText). Called by
|
||||
* EvenHubFont, which owns run construction; the members array must be
|
||||
* immutable from here on.
|
||||
*/
|
||||
drawFwText(
|
||||
font: FwTextFont,
|
||||
x: number,
|
||||
y: number,
|
||||
value: number,
|
||||
glyphs: readonly PlacedFwTextGlyph[],
|
||||
): void {
|
||||
if (glyphs.length === 0) return;
|
||||
this.drawList.push({ kind: "fwtext", font, x, y, value: clampByte(value), glyphs });
|
||||
}
|
||||
|
||||
/**
|
||||
* Bake this image's deferred draws into its own pixels and clear the list.
|
||||
* Used where later raster must be able to cover earlier draws within the
|
||||
* same image (e.g. the EvenHub compositor's image-over-text z-order).
|
||||
*/
|
||||
bakeDeferredDrawsInPlace(): void {
|
||||
if (!this.drawList.length) return;
|
||||
const draws = this.drawList.splice(0, this.drawList.length);
|
||||
for (const placed of draws) {
|
||||
if (placed.kind === "glyph") {
|
||||
rasterizeGlyph(this, placed.font, placed.glyph, placed.x, placed.y, placed.value);
|
||||
} else if (placed.kind === "image") {
|
||||
this.bitBlt(placed.source, placed.x, placed.y, { transparentZero: true });
|
||||
} else {
|
||||
placed.font.bakeFwTextRun(this, placed, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This image with its deferred draws rasterized into the pixel buffer.
|
||||
* Returns this image unchanged when there are none, otherwise a baked copy
|
||||
@@ -391,8 +483,10 @@ export class GrayImage {
|
||||
for (const placed of this.drawList) {
|
||||
if (placed.kind === "glyph") {
|
||||
rasterizeGlyph(target, placed.font, placed.glyph, placed.x + dx, placed.y + dy, placed.value);
|
||||
} else {
|
||||
} else if (placed.kind === "image") {
|
||||
target.bitBlt(placed.source, placed.x + dx, placed.y + dy, { transparentZero: true });
|
||||
} else {
|
||||
placed.font.bakeFwTextRun(target, placed, dx, dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user