@geastack/engine 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/canvas.cpp +25 -1
- package/package.json +3 -4
- package/ui/document.cpp +1 -1
- package/ui/render.cpp +14 -2
- package/ui/style.cpp +6 -0
- package/ui/style.h +1 -0
- package/ui/tree_render.cpp +27 -0
- package/ui/tree_style.cpp +6 -10
package/canvas.cpp
CHANGED
|
@@ -3938,7 +3938,7 @@ void Canvas::drawImage(
|
|
|
3938
3938
|
pixel::packed::writeUnpacked(packedRow(rowToPhysical(dy + sy)), dst_x, src_row, row_w);
|
|
3939
3939
|
#else
|
|
3940
3940
|
pixel::native_t *dst_row = &pixels_[rowToPhysical(dy + sy) * stride_ + dst_x];
|
|
3941
|
-
|
|
3941
|
+
pixel::copyNative(dst_row, src_row, row_w);
|
|
3942
3942
|
#endif
|
|
3943
3943
|
#if GEA_EMBEDDED_DISPLAY_ROTATE_LANDSCAPE
|
|
3944
3944
|
}
|
|
@@ -4253,6 +4253,30 @@ void Canvas::drawImage(
|
|
|
4253
4253
|
}
|
|
4254
4254
|
const int wx0 = 256 - fx;
|
|
4255
4255
|
const int wx1 = fx;
|
|
4256
|
+
#if GEA_EMBEDDED_PIXEL_FORMAT == GEA_PIXEL_RGB565
|
|
4257
|
+
if (!alpha) {
|
|
4258
|
+
// Opaque pixels have a constant alpha denominator. Keep bilinear
|
|
4259
|
+
// filtering, but cancel that factor instead of doing four floating
|
|
4260
|
+
// point alpha products and a reciprocal for every video pixel.
|
|
4261
|
+
// Channel * combined weight sums fit in 24 bits (255 * 65536).
|
|
4262
|
+
unsigned rSum = 0, gSum = 0, bSum = 0;
|
|
4263
|
+
auto addOpaque = [&](int sx, int sy, unsigned weight) {
|
|
4264
|
+
if (!weight) return;
|
|
4265
|
+
int r = 0, g = 0, b = 0, unused = 0;
|
|
4266
|
+
pixel::unpackNative8(src[sy * src_w + sx], &r, &g, &b, &unused);
|
|
4267
|
+
rSum += static_cast<unsigned>(r) * weight;
|
|
4268
|
+
gSum += static_cast<unsigned>(g) * weight;
|
|
4269
|
+
bSum += static_cast<unsigned>(b) * weight;
|
|
4270
|
+
};
|
|
4271
|
+
addOpaque(sx0, sy0, wx0 * wy0);
|
|
4272
|
+
addOpaque(sx1, sy0, wx1 * wy0);
|
|
4273
|
+
addOpaque(sx0, sy1, wx0 * wy1);
|
|
4274
|
+
addOpaque(sx1, sy1, wx1 * wy1);
|
|
4275
|
+
writePixel(px, py, pixel::packNative8((rSum + 32768) >> 16,
|
|
4276
|
+
(gSum + 32768) >> 16, (bSum + 32768) >> 16, 255));
|
|
4277
|
+
continue;
|
|
4278
|
+
}
|
|
4279
|
+
#endif
|
|
4256
4280
|
// FLOAT accumulators (no int64 anywhere). The previous int64 version cost
|
|
4257
4281
|
// ~160ms for a 220x220 icon on this board: Xtensa LX7 has NO hardware
|
|
4258
4282
|
// 64-bit divide AND no hardware int64->float, so both int64 divides and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "GeaStack rendering engine, intrinsic JSX primitives, and native engine backends.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
},
|
|
58
58
|
"sideEffects": false,
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@geastack/core": "^0.1.
|
|
61
|
-
}
|
|
62
|
-
"gitHead": "e375eddd8f725d7cc5de3fd46baca63e35936027"
|
|
60
|
+
"@geastack/core": "^0.1.34"
|
|
61
|
+
}
|
|
63
62
|
}
|
package/ui/document.cpp
CHANGED
|
@@ -150,7 +150,7 @@ NodeHandle Document::createElement(const char *tag) const
|
|
|
150
150
|
if (lowered == "button") node = createButton();
|
|
151
151
|
else if (lowered == "canvas") node = createCanvas();
|
|
152
152
|
else if (lowered == "audio") node = createAudio();
|
|
153
|
-
else if (lowered == "img" || lowered == "image") node = createImage();
|
|
153
|
+
else if (lowered == "img" || lowered == "image" || lowered == "video") node = createImage();
|
|
154
154
|
else if (lowered == "virtual-list") node = createVirtualList();
|
|
155
155
|
else node = createView();
|
|
156
156
|
if (!lowered.empty()) node.setTagName(lowered.c_str());
|
package/ui/render.cpp
CHANGED
|
@@ -10246,11 +10246,23 @@ int gLastScrollUiFrame = -1000;
|
|
|
10246
10246
|
bool DisplayList::patchNodeAlpha(int node, uint8_t opacity)
|
|
10247
10247
|
{
|
|
10248
10248
|
// The OPEN SetAlpha wrapping a node's subtree lives OUTSIDE the node's
|
|
10249
|
-
// [drawStart,drawEnd] range,
|
|
10250
|
-
//
|
|
10249
|
+
// [drawStart,drawEnd] range, immediately before drawStart. Recompute
|
|
10250
|
+
// from the record-time parent alpha so nested scopes stay
|
|
10251
10251
|
// correct: alpha = recordParentAlpha * opacity / 255.
|
|
10252
10252
|
if (!state.commands || node < 0 || node >= Tree::instance().nodeCount())
|
|
10253
10253
|
return false;
|
|
10254
|
+
// Reuse the existing range index. Scanning the entire retained list for
|
|
10255
|
+
// each fading leaf makes an N-lamp animation quadratic in command count.
|
|
10256
|
+
if (state.hasNodeScratchFor(node)) {
|
|
10257
|
+
const int ci = state.nodeDrawStart[node] - 1;
|
|
10258
|
+
if (ci >= 0 && ci < state.commandCount) {
|
|
10259
|
+
auto &command = state.commands[ci];
|
|
10260
|
+
if (command.type == DisplayCommandType::SetAlpha && command.alpha.nodeId == node) {
|
|
10261
|
+
command.alpha.alpha = static_cast<uint8_t>((static_cast<int>(command.alpha.recordParentAlpha) * opacity) / 255);
|
|
10262
|
+
return true;
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10254
10266
|
for (int ci = 0; ci < state.commandCount; ci++)
|
|
10255
10267
|
{
|
|
10256
10268
|
DisplayCommand *c = &state.commands[ci];
|
package/ui/style.cpp
CHANGED
|
@@ -9101,6 +9101,12 @@ void Style::setProperty(const std::string &property, const std::string &value) c
|
|
|
9101
9101
|
StyleSheet::instance().applyProperty(NodeHandle(nodeId_), property, value);
|
|
9102
9102
|
}
|
|
9103
9103
|
|
|
9104
|
+
bool Style::setNumberProperty(const std::string &property, double value) const
|
|
9105
|
+
{
|
|
9106
|
+
if (nodeId_ < 0) return false;
|
|
9107
|
+
return StyleSheet::instance().applyNumberProperty(NodeHandle(nodeId_), property.c_str(), value);
|
|
9108
|
+
}
|
|
9109
|
+
|
|
9104
9110
|
bool Style::removeProperty(const std::string &property) const
|
|
9105
9111
|
{
|
|
9106
9112
|
if (nodeId_ < 0) return false;
|
package/ui/style.h
CHANGED
|
@@ -367,6 +367,7 @@ public:
|
|
|
367
367
|
// one the CSS parser feeds), rather than duplicating property-name
|
|
368
368
|
// parsing here.
|
|
369
369
|
void setProperty(const std::string &property, const std::string &value) const;
|
|
370
|
+
bool setNumberProperty(const std::string &property, double value) const;
|
|
370
371
|
bool removeProperty(const std::string &property) const;
|
|
371
372
|
|
|
372
373
|
private:
|
package/ui/tree_render.cpp
CHANGED
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
#include <cstdlib>
|
|
18
18
|
#include <cstring>
|
|
19
19
|
|
|
20
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
21
|
+
#include "esp_timer.h"
|
|
22
|
+
#include "esp_log.h"
|
|
23
|
+
#endif
|
|
24
|
+
|
|
20
25
|
#ifndef GEA_EMBEDDED_FLUSH_ANCHOR_LEFT_PARTIAL_RECTS
|
|
21
26
|
#define GEA_EMBEDDED_FLUSH_ANCHOR_LEFT_PARTIAL_RECTS 1
|
|
22
27
|
#endif
|
|
@@ -1846,6 +1851,9 @@ namespace gea::embedded::ui
|
|
|
1846
1851
|
|
|
1847
1852
|
void Tree::refresh(int root, int width, int height)
|
|
1848
1853
|
{
|
|
1854
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
1855
|
+
const auto diagnosticStart = esp_timer_get_time();
|
|
1856
|
+
#endif
|
|
1849
1857
|
auto &state = treeState();
|
|
1850
1858
|
if (root < 0 || root >= state.nodeCount)
|
|
1851
1859
|
return;
|
|
@@ -2051,6 +2059,9 @@ namespace gea::embedded::ui
|
|
|
2051
2059
|
GEA_REFRESH_PERF(perf.treeLayoutUs += refreshPerfNowUs() - layoutStartUs);
|
|
2052
2060
|
|
|
2053
2061
|
const std::int64_t displayListStartUs = refreshPerfNowUs();
|
|
2062
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
2063
|
+
const auto diagnosticLayoutEnd = esp_timer_get_time();
|
|
2064
|
+
#endif
|
|
2054
2065
|
const bool display_list_was_dirty = state.displayListDirty;
|
|
2055
2066
|
// Consume the structural flag for this frame's rebuild decision. A
|
|
2056
2067
|
// content-only rebuild (appearance change on existing nodes — partial
|
|
@@ -2726,6 +2737,9 @@ namespace gea::embedded::ui
|
|
|
2726
2737
|
g_broadDirtyBbox = false;
|
|
2727
2738
|
|
|
2728
2739
|
const std::int64_t dirtyCoalesceStartUs = refreshPerfNowUs();
|
|
2740
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
2741
|
+
const auto diagnosticCollectEnd = esp_timer_get_time();
|
|
2742
|
+
#endif
|
|
2729
2743
|
if (!unifiedRectPath || GEA_EMBEDDED_REPLAY_COALESCE_DIRTY_REGIONS)
|
|
2730
2744
|
coalesceLowCostDirtyRegions(rects, &rect_count);
|
|
2731
2745
|
if (!preserveFlatTransformedReplayRects)
|
|
@@ -3067,6 +3081,9 @@ namespace gea::embedded::ui
|
|
|
3067
3081
|
staticBackdropEligible);
|
|
3068
3082
|
|
|
3069
3083
|
const std::int64_t flushRectsStartUs = refreshPerfNowUs();
|
|
3084
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
3085
|
+
const auto diagnosticReplayEnd = esp_timer_get_time();
|
|
3086
|
+
#endif
|
|
3070
3087
|
if (!simpleUnifiedReplay && !interleavedUnifiedFlush)
|
|
3071
3088
|
{
|
|
3072
3089
|
for (int i = 0; i < flush_rect_count; i++)
|
|
@@ -3109,6 +3126,16 @@ namespace gea::embedded::ui
|
|
|
3109
3126
|
displayCanvas->resetDirty();
|
|
3110
3127
|
#endif
|
|
3111
3128
|
GEA_REFRESH_PERF(perf.treeSnapshotUs += refreshPerfNowUs() - snapshotStartUs);
|
|
3129
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
3130
|
+
const auto diagnosticEnd = esp_timer_get_time();
|
|
3131
|
+
if (diagnosticEnd - diagnosticStart > 30000)
|
|
3132
|
+
ESP_LOGW("tree_phase", "layout_ms=%lld collect_ms=%lld replay_ms=%lld flush_ms=%lld rects=%d direct=%d commands=%d structural=%d",
|
|
3133
|
+
(long long)((diagnosticLayoutEnd - diagnosticStart) / 1000),
|
|
3134
|
+
(long long)((diagnosticCollectEnd - diagnosticLayoutEnd) / 1000),
|
|
3135
|
+
(long long)((diagnosticReplayEnd - diagnosticCollectEnd) / 1000),
|
|
3136
|
+
(long long)((diagnosticEnd - diagnosticReplayEnd) / 1000),
|
|
3137
|
+
rect_count, direct_replay, DisplayList::instance().commandCount(), int(display_list_was_structural));
|
|
3138
|
+
#endif
|
|
3112
3139
|
}
|
|
3113
3140
|
|
|
3114
3141
|
void Tree::frame(int timestamp_ms)
|
package/ui/tree_style.cpp
CHANGED
|
@@ -1233,16 +1233,12 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
1233
1233
|
if (prop == Property::Display) {
|
|
1234
1234
|
forceFull = !stayLocal;
|
|
1235
1235
|
} else if (prop == Property::Opacity) {
|
|
1236
|
-
//
|
|
1237
|
-
//
|
|
1238
|
-
// and
|
|
1239
|
-
//
|
|
1240
|
-
// so the
|
|
1241
|
-
|
|
1242
|
-
// [drawStart,drawEnd], which excludes the scope — which is why
|
|
1243
|
-
// canReplayDirectDirtyRegions still bails and we fall to the safe
|
|
1244
|
-
// full-per-rect replay. The record stays incremental either way.)
|
|
1245
|
-
if (stayLocal && prevOpacity < 255 && style.opacity < 255 &&
|
|
1236
|
+
// An existing leaf alpha scope can represent every opacity, including
|
|
1237
|
+
// full brightness. Keep it across 255 instead of repeatedly removing
|
|
1238
|
+
// and recreating it during a fade. patchNodeAlpha returns false when
|
|
1239
|
+
// no scope exists (for example, an initially opaque or culled node),
|
|
1240
|
+
// so those cases still take the ordinary recording path below.
|
|
1241
|
+
if (stayLocal &&
|
|
1246
1242
|
DisplayList::instance().patchNodeAlpha(node, static_cast<uint8_t>(style.opacity)))
|
|
1247
1243
|
return;
|
|
1248
1244
|
// Crossing the 255 boundary (scope appears/disappears) or a non-leaf:
|