@geastack/engine 0.1.7 → 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 +84 -25
- package/css/engine.h +1 -0
- package/package.json +2 -2
- package/ui/absolute_leaf_refresh.cpp +65 -52
- package/ui/core.cpp +4 -4
- package/ui/css_features.h +87 -0
- package/ui/document.cpp +12 -1
- package/ui/image_node.cpp +24 -24
- package/ui/input.cpp +24 -24
- package/ui/input_render.cpp +27 -27
- package/ui/internal.h +22 -0
- package/ui/layout.cpp +771 -573
- package/ui/layout_snapshot.cpp +1 -1
- package/ui/node_features.h +18 -0
- package/ui/node_lifecycle.cpp +167 -1
- package/ui/node_model.h +216 -56
- package/ui/node_text.h +2 -0
- package/ui/refresh_perf.h +19 -17
- package/ui/render.cpp +217 -191
- package/ui/renderer_features.h +5 -0
- package/ui/root_scroll_refresh.cpp +65 -65
- package/ui/storage_usage.h +45 -0
- package/ui/style.cpp +438 -146
- package/ui/style.h +1 -0
- package/ui/style_values.h +2 -2
- package/ui/text.cpp +151 -153
- package/ui/tree_events.cpp +86 -0
- package/ui/tree_events.h +16 -0
- package/ui/tree_nodes.cpp +21 -17
- package/ui/tree_render.cpp +154 -123
- package/ui/tree_scroll_mirror.cpp +4 -4
- package/ui/tree_state.cpp +78 -6
- package/ui/tree_state.h +49 -4
- package/ui/tree_style.cpp +414 -309
- package/ui/view.cpp +207 -207
- package/ui/virtual_keyboard.cpp +11 -11
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
|
|
@@ -176,13 +181,13 @@ namespace gea::embedded::ui
|
|
|
176
181
|
node.layout.scroll_y = static_cast<int32_t>(y);
|
|
177
182
|
continue;
|
|
178
183
|
}
|
|
179
|
-
if (node.
|
|
184
|
+
if (node.computedStyle().overflow != 2)
|
|
180
185
|
{
|
|
181
186
|
node.layout.scroll_x = 0;
|
|
182
187
|
node.layout.scroll_y = 0;
|
|
183
188
|
continue;
|
|
184
189
|
}
|
|
185
|
-
if (scrollsOverflowX(node.
|
|
190
|
+
if (scrollsOverflowX(node.computedStyle()))
|
|
186
191
|
{
|
|
187
192
|
int x = offsets[i].x;
|
|
188
193
|
const int maxX = ViewRenderer::scrollMaxX(node);
|
|
@@ -197,7 +202,7 @@ namespace gea::embedded::ui
|
|
|
197
202
|
node.layout.scroll_x = 0;
|
|
198
203
|
}
|
|
199
204
|
|
|
200
|
-
if (scrollsOverflowY(node.
|
|
205
|
+
if (scrollsOverflowY(node.computedStyle()))
|
|
201
206
|
{
|
|
202
207
|
int y = offsets[i].y;
|
|
203
208
|
const int maxY = ViewRenderer::scrollMaxY(node);
|
|
@@ -259,15 +264,15 @@ namespace gea::embedded::ui
|
|
|
259
264
|
|
|
260
265
|
bool dirtyRectNeedsRasterGuard(const Node &node)
|
|
261
266
|
{
|
|
262
|
-
if (hasAnyBorder(node.
|
|
267
|
+
if (hasAnyBorder(node.computedStyle()))
|
|
263
268
|
return true;
|
|
264
|
-
if ((GEA_CSS_FILTERS ? rstyle(node.
|
|
269
|
+
if ((GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0) > 0 || node.render.previous_filter_blur_radius > 0)
|
|
265
270
|
return true;
|
|
266
|
-
if (node.
|
|
271
|
+
if (node.computedStyle().mask_right_fade_width > 0)
|
|
267
272
|
return true;
|
|
268
|
-
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.
|
|
273
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0) > 0)
|
|
269
274
|
return true;
|
|
270
|
-
return node.
|
|
275
|
+
return node.computedStyle().has_bg && (styleHasRoundedRasterEdge(node.computedStyle()) || node.computedStyle().bg_alpha < 255);
|
|
271
276
|
}
|
|
272
277
|
|
|
273
278
|
constexpr int kRetainedMoveDirtyGuardPx = GEA_EMBEDDED_RETAINED_MOVE_DIRTY_GUARD_PX;
|
|
@@ -407,12 +412,12 @@ namespace gea::embedded::ui
|
|
|
407
412
|
|
|
408
413
|
int nodeBoxRotation(const Node &node, bool usePrevious)
|
|
409
414
|
{
|
|
410
|
-
return usePrevious ? node.render.previous_transform_rotate : rstyle(node.
|
|
415
|
+
return usePrevious ? node.render.previous_transform_rotate : rstyle(node.computedStyle()).transform_rotate;
|
|
411
416
|
}
|
|
412
417
|
|
|
413
418
|
bool hasTransformState(const Node &node)
|
|
414
419
|
{
|
|
415
|
-
const RareStyle &rs = rstyle(node.
|
|
420
|
+
const RareStyle &rs = rstyle(node.computedStyle()); // one pool lookup, not 11
|
|
416
421
|
return hasIndividualLinearTransform(rs) || hadIndividualLinearTransform(node.render) ||
|
|
417
422
|
rs.transform_rotate != 0 ||
|
|
418
423
|
node.render.previous_transform_rotate != 0 ||
|
|
@@ -442,17 +447,17 @@ namespace gea::embedded::ui
|
|
|
442
447
|
|
|
443
448
|
bool hasThreeDimensionalTransformState(const Node &node)
|
|
444
449
|
{
|
|
445
|
-
const auto &r = rstyle(node.
|
|
450
|
+
const auto &r = rstyle(node.computedStyle());
|
|
446
451
|
return ((r.rotate_angle % 3600) && (r.rotate_axis_x || r.rotate_axis_y)) ||
|
|
447
452
|
((node.render.previous_rotate_angle % 3600) && (node.render.previous_rotate_axis_x || node.render.previous_rotate_axis_y)) ||
|
|
448
453
|
r.scale_z != 1000 || node.render.previous_scale_z != 1000 ||
|
|
449
|
-
rstyle(node.
|
|
454
|
+
rstyle(node.computedStyle()).transform_rotate_x != 0 ||
|
|
450
455
|
node.render.previous_transform_rotate_x != 0 ||
|
|
451
|
-
rstyle(node.
|
|
456
|
+
rstyle(node.computedStyle()).transform_rotate_y != 0 ||
|
|
452
457
|
node.render.previous_transform_rotate_y != 0 ||
|
|
453
|
-
composedTranslateZ(rstyle(node.
|
|
458
|
+
composedTranslateZ(rstyle(node.computedStyle())) != 0 ||
|
|
454
459
|
node.render.previous_transform_translate_z != 0 ||
|
|
455
|
-
rstyle(node.
|
|
460
|
+
rstyle(node.computedStyle()).perspective > 0 ||
|
|
456
461
|
node.render.previous_perspective > 0;
|
|
457
462
|
}
|
|
458
463
|
|
|
@@ -516,16 +521,16 @@ namespace gea::embedded::ui
|
|
|
516
521
|
for (int i = 0; i < 4; ++i)
|
|
517
522
|
{
|
|
518
523
|
#if GEA_CSS_PERCENT_RADIUS
|
|
519
|
-
if (node.
|
|
524
|
+
if (node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] != kUnset)
|
|
520
525
|
{
|
|
521
|
-
const double p = static_cast<double>(node.
|
|
526
|
+
const double p = static_cast<double>(node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(i)]) / 1000.0;
|
|
522
527
|
rx[i] = std::max(0.0, width * p);
|
|
523
528
|
ry[i] = std::max(0.0, height * p);
|
|
524
529
|
}
|
|
525
530
|
else
|
|
526
531
|
#endif
|
|
527
532
|
{
|
|
528
|
-
const double r = static_cast<double>(std::max(0, static_cast<int>(node.
|
|
533
|
+
const double r = static_cast<double>(std::max(0, static_cast<int>(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(i)])));
|
|
529
534
|
rx[i] = r;
|
|
530
535
|
ry[i] = r;
|
|
531
536
|
}
|
|
@@ -630,9 +635,9 @@ namespace gea::embedded::ui
|
|
|
630
635
|
{
|
|
631
636
|
return isViewLikeNodeType(node.type) &&
|
|
632
637
|
node.first_child < 0 &&
|
|
633
|
-
node.
|
|
634
|
-
node.
|
|
635
|
-
!hasAnyBorder(node.
|
|
638
|
+
node.computedStyle().display != 1 &&
|
|
639
|
+
node.computedStyle().has_bg &&
|
|
640
|
+
!hasAnyBorder(node.computedStyle()) &&
|
|
636
641
|
hasTransformState(node);
|
|
637
642
|
}
|
|
638
643
|
|
|
@@ -651,11 +656,11 @@ namespace gea::embedded::ui
|
|
|
651
656
|
node.type == NodeType::Image ||
|
|
652
657
|
node.type == NodeType::Canvas)
|
|
653
658
|
return true;
|
|
654
|
-
if (node.
|
|
659
|
+
if (node.computedStyle().has_bg || hasAnyBorder(node.computedStyle()))
|
|
655
660
|
return true;
|
|
656
|
-
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.
|
|
661
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0) > 0 || (GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0) > 0)
|
|
657
662
|
return true;
|
|
658
|
-
if (node.
|
|
663
|
+
if (node.computedStyle().mask_right_fade_width > 0)
|
|
659
664
|
return true;
|
|
660
665
|
return false;
|
|
661
666
|
}
|
|
@@ -867,7 +872,7 @@ namespace gea::embedded::ui
|
|
|
867
872
|
if (node < 0 || node >= state.nodeCount)
|
|
868
873
|
return;
|
|
869
874
|
Node &n = state.nodes[node];
|
|
870
|
-
if (n.
|
|
875
|
+
if (n.computedStyle().display != 1 && n.layout.width > 0 && n.layout.height > 0)
|
|
871
876
|
{
|
|
872
877
|
int nx0, ny0, nx1, ny1;
|
|
873
878
|
ViewRenderer::transformedBounds(n, usePrevious, &nx0, &ny0, &nx1, &ny1);
|
|
@@ -912,7 +917,7 @@ namespace gea::embedded::ui
|
|
|
912
917
|
|
|
913
918
|
int filterBlurRadiusForNode(const Node &node, bool usePrevious)
|
|
914
919
|
{
|
|
915
|
-
return usePrevious ? node.render.previous_filter_blur_radius : (GEA_CSS_FILTERS ? rstyle(node.
|
|
920
|
+
return usePrevious ? node.render.previous_filter_blur_radius : (GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0);
|
|
916
921
|
}
|
|
917
922
|
|
|
918
923
|
DirtyRegions::Rect filterBlurBoundsRect(const Node &node, bool usePrevious, int origin)
|
|
@@ -935,7 +940,7 @@ namespace gea::embedded::ui
|
|
|
935
940
|
for (int i = 0; i < state.nodeCount; i++)
|
|
936
941
|
{
|
|
937
942
|
const Node &node = state.nodes[i];
|
|
938
|
-
if (node.
|
|
943
|
+
if (node.computedStyle().display == 1)
|
|
939
944
|
continue;
|
|
940
945
|
for (int pass = 0; pass < 2; pass++)
|
|
941
946
|
{
|
|
@@ -1172,18 +1177,18 @@ namespace gea::embedded::ui
|
|
|
1172
1177
|
|
|
1173
1178
|
bool panNodeHasTransform(const Node &n)
|
|
1174
1179
|
{
|
|
1175
|
-
return hasIndividualLinearTransform(rstyle(n.
|
|
1176
|
-
rstyle(n.
|
|
1177
|
-
rstyle(n.
|
|
1178
|
-
rstyle(n.
|
|
1179
|
-
composedTranslateX(rstyle(n.
|
|
1180
|
-
composedTranslateY(rstyle(n.
|
|
1181
|
-
composedTranslateZ(rstyle(n.
|
|
1182
|
-
composedTranslateXPercent(rstyle(n.
|
|
1183
|
-
composedTranslateYPercent(rstyle(n.
|
|
1184
|
-
rstyle(n.
|
|
1185
|
-
rstyle(n.
|
|
1186
|
-
rstyle(n.
|
|
1180
|
+
return hasIndividualLinearTransform(rstyle(n.computedStyle())) || hadIndividualLinearTransform(n.render) ||
|
|
1181
|
+
rstyle(n.computedStyle()).transform_rotate != 0 || n.render.previous_transform_rotate != 0 ||
|
|
1182
|
+
rstyle(n.computedStyle()).transform_rotate_x != 0 || n.render.previous_transform_rotate_x != 0 ||
|
|
1183
|
+
rstyle(n.computedStyle()).transform_rotate_y != 0 || n.render.previous_transform_rotate_y != 0 ||
|
|
1184
|
+
composedTranslateX(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_x != 0 ||
|
|
1185
|
+
composedTranslateY(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_y != 0 ||
|
|
1186
|
+
composedTranslateZ(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_z != 0 ||
|
|
1187
|
+
composedTranslateXPercent(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_x_percent != 0 ||
|
|
1188
|
+
composedTranslateYPercent(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_y_percent != 0 ||
|
|
1189
|
+
rstyle(n.computedStyle()).transform_scale_x != 1000 || n.render.previous_transform_scale_x != 1000 ||
|
|
1190
|
+
rstyle(n.computedStyle()).transform_scale_y != 1000 || rstyle(n.computedStyle()).transform_scale_z != 1000 || n.render.previous_transform_scale_y != 1000 || n.render.previous_transform_scale_z != 1000 ||
|
|
1191
|
+
rstyle(n.computedStyle()).perspective > 0 || n.render.previous_perspective > 0;
|
|
1187
1192
|
}
|
|
1188
1193
|
|
|
1189
1194
|
bool panIsDescendantOf(int node, int ancestor)
|
|
@@ -1206,43 +1211,43 @@ namespace gea::embedded::ui
|
|
|
1206
1211
|
{
|
|
1207
1212
|
if (n.type != NodeType::View)
|
|
1208
1213
|
return false;
|
|
1209
|
-
if (n.
|
|
1214
|
+
if (n.computedStyle().opacity != 255)
|
|
1210
1215
|
return false;
|
|
1211
|
-
if (hasAnyBorder(n.
|
|
1216
|
+
if (hasAnyBorder(n.computedStyle()))
|
|
1212
1217
|
return false;
|
|
1213
1218
|
for (int r = 0; r < 4; r++)
|
|
1214
1219
|
{
|
|
1215
|
-
if (n.
|
|
1220
|
+
if (n.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(r)] != 0)
|
|
1216
1221
|
return false;
|
|
1217
1222
|
#if GEA_CSS_PERCENT_RADIUS
|
|
1218
|
-
if (n.
|
|
1223
|
+
if (n.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != kUnset && n.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != 0)
|
|
1219
1224
|
return false;
|
|
1220
1225
|
#endif
|
|
1221
1226
|
}
|
|
1222
|
-
if ((GEA_CSS_FILTERS ? rstyle(n.
|
|
1227
|
+
if ((GEA_CSS_FILTERS ? rstyle(n.computedStyle()).filter_blur_radius : 0) > 0)
|
|
1223
1228
|
return false;
|
|
1224
|
-
if (n.
|
|
1229
|
+
if (n.computedStyle().mask_right_fade_width > 0)
|
|
1225
1230
|
return false;
|
|
1226
|
-
if ((GEA_CSS_BOX_SHADOW ? rstyle(n.
|
|
1227
|
-
((GEA_CSS_BOX_SHADOW ? rstyle(n.
|
|
1228
|
-
(GEA_CSS_BOX_SHADOW ? rstyle(n.
|
|
1231
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_alpha : 0) > 0 &&
|
|
1232
|
+
((GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_offset_x : 0) != 0 || (GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_offset_y : 0) != 0 ||
|
|
1233
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_blur_radius : 0) != 0 || (GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_spread : 0) != 0))
|
|
1229
1234
|
return false;
|
|
1230
|
-
if (n.
|
|
1235
|
+
if (n.computedStyle().has_bg)
|
|
1231
1236
|
{
|
|
1232
1237
|
// A narrow solid rectangle still has horizontal edges: scrolling
|
|
1233
1238
|
// it creates a ghost just like scrolling text or a rounded control.
|
|
1234
|
-
if (n.
|
|
1239
|
+
if (n.computedStyle().bg_alpha != 255 || panNodeHasTransform(n) ||
|
|
1235
1240
|
n.layout.x > viewportX || n.layout.x + n.layout.width < viewportX + viewportWidth)
|
|
1236
1241
|
return false;
|
|
1237
1242
|
for (int parent = n.parent; parent >= 0; parent = treeState().nodes[parent].parent) {
|
|
1238
1243
|
const Node &clip = treeState().nodes[parent];
|
|
1239
|
-
if (panNodeHasTransform(clip) || (clip.
|
|
1244
|
+
if (panNodeHasTransform(clip) || (clip.computedStyle().overflow &&
|
|
1240
1245
|
(clip.layout.x > viewportX || clip.layout.x + clip.layout.width < viewportX + viewportWidth)))
|
|
1241
1246
|
return false;
|
|
1242
1247
|
}
|
|
1243
|
-
if (styleHasBackgroundImage(n.
|
|
1248
|
+
if (styleHasBackgroundImage(n.computedStyle()))
|
|
1244
1249
|
return false; // gradient fill (linear/radial/overlay)
|
|
1245
|
-
if (rstyle(n.
|
|
1250
|
+
if (rstyle(n.computedStyle()).bg_grid_axes != 0)
|
|
1246
1251
|
return false; // grid overlay
|
|
1247
1252
|
}
|
|
1248
1253
|
return true;
|
|
@@ -1257,7 +1262,7 @@ namespace gea::embedded::ui
|
|
|
1257
1262
|
gea::platform::display::Display::resetClip();
|
|
1258
1263
|
gea::platform::display::Display::setAlpha(255);
|
|
1259
1264
|
DisplayList::instance().replayDirectDirtyRegion(rx, ry, rx + rw - 1, ry + rh - 1, origin);
|
|
1260
|
-
refreshPerfStatsMutable().treePanRepaintArea += rw * rh;
|
|
1265
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treePanRepaintArea += rw * rh);
|
|
1261
1266
|
return true;
|
|
1262
1267
|
}
|
|
1263
1268
|
|
|
@@ -1321,14 +1326,14 @@ namespace gea::embedded::ui
|
|
|
1321
1326
|
Node *n = &state.nodes[i];
|
|
1322
1327
|
if (!n->render.dirty)
|
|
1323
1328
|
continue;
|
|
1324
|
-
if (n->
|
|
1329
|
+
if (n->computedStyle().display == kDisplayNone)
|
|
1325
1330
|
continue;
|
|
1326
1331
|
if (n->first_child < 0)
|
|
1327
1332
|
continue;
|
|
1328
1333
|
if (n->parent < 0)
|
|
1329
1334
|
continue;
|
|
1330
1335
|
Node *p = &state.nodes[n->parent];
|
|
1331
|
-
if (p->
|
|
1336
|
+
if (p->computedStyle().overflow != 1)
|
|
1332
1337
|
continue; // parent must clip (overflow:hidden)
|
|
1333
1338
|
const int dx = n->layout.x - n->layout.previous_x;
|
|
1334
1339
|
const int dy = n->layout.y - n->layout.previous_y;
|
|
@@ -1340,7 +1345,7 @@ namespace gea::embedded::ui
|
|
|
1340
1345
|
continue;
|
|
1341
1346
|
if (n->layout.previous_width <= 0 || n->layout.previous_height <= 0)
|
|
1342
1347
|
continue;
|
|
1343
|
-
if (n->
|
|
1348
|
+
if (n->computedStyle().opacity != 255)
|
|
1344
1349
|
continue;
|
|
1345
1350
|
if (panNodeHasTransform(*n))
|
|
1346
1351
|
continue;
|
|
@@ -1459,7 +1464,7 @@ namespace gea::embedded::ui
|
|
|
1459
1464
|
panCoverageWrapperX = W->layout.x;
|
|
1460
1465
|
panCoveragePadding = kPanRecordPadding;
|
|
1461
1466
|
panCoverageSerial = DisplayList::instance().recordSerial();
|
|
1462
|
-
refreshPerfStatsMutable().treeRecordNodeUs += refreshPerfNowUs() - rebuildStartUs;
|
|
1467
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treeRecordNodeUs += refreshPerfNowUs() - rebuildStartUs);
|
|
1463
1468
|
}
|
|
1464
1469
|
|
|
1465
1470
|
// ---- Commit: shift the framebuffer and repaint only what the shift can't. ----
|
|
@@ -1489,7 +1494,7 @@ namespace gea::embedded::ui
|
|
|
1489
1494
|
for (int i = 0; i < state.nodeCount; i++)
|
|
1490
1495
|
{
|
|
1491
1496
|
Node *n = &state.nodes[i];
|
|
1492
|
-
if (n->
|
|
1497
|
+
if (n->computedStyle().display == kDisplayNone)
|
|
1493
1498
|
continue;
|
|
1494
1499
|
if (i == wrapper || panIsDescendantOf(i, wrapper))
|
|
1495
1500
|
continue;
|
|
@@ -1550,9 +1555,9 @@ namespace gea::embedded::ui
|
|
|
1550
1555
|
state.canvases.forEach([](CanvasSurfaceState &surface)
|
|
1551
1556
|
{
|
|
1552
1557
|
if (auto *canvas = surface.canvas()) canvas->resetDirty(); });
|
|
1553
|
-
refreshPerfStatsMutable().treePanReplayCalls
|
|
1558
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treePanReplayCalls++);
|
|
1554
1559
|
if (directRegions > 0)
|
|
1555
|
-
refreshPerfStatsMutable().treeDirectReplayCalls
|
|
1560
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treeDirectReplayCalls++);
|
|
1556
1561
|
return true;
|
|
1557
1562
|
}
|
|
1558
1563
|
|
|
@@ -1655,10 +1660,12 @@ namespace gea::embedded::ui
|
|
|
1655
1660
|
gea::platform::display::Display::resetClip();
|
|
1656
1661
|
gea::platform::display::Display::setAlpha(255);
|
|
1657
1662
|
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1663
|
+
{
|
|
1664
|
+
LayoutEngine::Pass layoutPass;
|
|
1665
|
+
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1666
|
+
applyPendingScrollIntoView();
|
|
1667
|
+
LayoutEngine::instance().resolveAbsoluteCoords(root, 0, 0);
|
|
1668
|
+
}
|
|
1662
1669
|
noteLaidOutViewport(root, width, height);
|
|
1663
1670
|
state.refreshSerial++;
|
|
1664
1671
|
if (state.refreshSerial == 0)
|
|
@@ -1729,7 +1736,7 @@ namespace gea::embedded::ui
|
|
|
1729
1736
|
PreservedScrollOffset scrollOffsets[kMaxNodes];
|
|
1730
1737
|
preserveScrollOffsets(scrollOffsets, kMaxNodes);
|
|
1731
1738
|
#endif
|
|
1732
|
-
LayoutEngine::
|
|
1739
|
+
LayoutEngine::Pass layoutPass;
|
|
1733
1740
|
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1734
1741
|
#if GEA_CSS_SCROLLING
|
|
1735
1742
|
restoreScrollOffsetsAfterLayout(scrollOffsets, kMaxNodes);
|
|
@@ -1835,7 +1842,7 @@ namespace gea::embedded::ui
|
|
|
1835
1842
|
const bool dimsStable = a.layout.width == a.layout.previous_width &&
|
|
1836
1843
|
a.layout.height == a.layout.previous_height &&
|
|
1837
1844
|
a.layout.width > 0 && a.layout.height > 0;
|
|
1838
|
-
if (dimsStable && a.
|
|
1845
|
+
if (dimsStable && a.computedStyle().display != kDisplayNone)
|
|
1839
1846
|
return scope;
|
|
1840
1847
|
}
|
|
1841
1848
|
return -1;
|
|
@@ -1844,6 +1851,9 @@ namespace gea::embedded::ui
|
|
|
1844
1851
|
|
|
1845
1852
|
void Tree::refresh(int root, int width, int height)
|
|
1846
1853
|
{
|
|
1854
|
+
#if defined(ESP_PLATFORM) && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
|
1855
|
+
const auto diagnosticStart = esp_timer_get_time();
|
|
1856
|
+
#endif
|
|
1847
1857
|
auto &state = treeState();
|
|
1848
1858
|
if (root < 0 || root >= state.nodeCount)
|
|
1849
1859
|
return;
|
|
@@ -1861,7 +1871,7 @@ namespace gea::embedded::ui
|
|
|
1861
1871
|
// moves content, so native renderers must re-sync.
|
|
1862
1872
|
state.refreshSerial++;
|
|
1863
1873
|
auto &perf = refreshPerfStatsMutable();
|
|
1864
|
-
perf.treeRefreshCalls
|
|
1874
|
+
GEA_REFRESH_PERF(perf.treeRefreshCalls++);
|
|
1865
1875
|
DisplayList::instance().clearRetainedBackgroundRecolors();
|
|
1866
1876
|
|
|
1867
1877
|
const bool textClipDependencies = DisplayList::instance().hasTextClippedBackgrounds();
|
|
@@ -1919,7 +1929,7 @@ namespace gea::embedded::ui
|
|
|
1919
1929
|
const bool framebuffer_was_dirty = false;
|
|
1920
1930
|
#endif
|
|
1921
1931
|
int layout_mode = AbsoluteLeafRefresh::mode();
|
|
1922
|
-
perf.treeLayoutModeUs += refreshPerfNowUs() - layoutModeStartUs;
|
|
1932
|
+
GEA_REFRESH_PERF(perf.treeLayoutModeUs += refreshPerfNowUs() - layoutModeStartUs);
|
|
1923
1933
|
if (layout_mode < 0)
|
|
1924
1934
|
{
|
|
1925
1935
|
if (!framebuffer_was_dirty && !state.displayListDirty && state.pendingScrollIntoViewNode < 0)
|
|
@@ -1970,13 +1980,13 @@ namespace gea::embedded::ui
|
|
|
1970
1980
|
if (scope >= 0)
|
|
1971
1981
|
scope = stableScopeAt(state, scope, root);
|
|
1972
1982
|
if (scope < 0)
|
|
1973
|
-
perf.treeScopedRejectReason = 1;
|
|
1983
|
+
GEA_REFRESH_PERF(perf.treeScopedRejectReason = 1);
|
|
1974
1984
|
for (int attempt = 0; scope >= 0 && attempt < 2; attempt++)
|
|
1975
1985
|
{
|
|
1976
1986
|
scoped = LayoutEngine::instance().layoutNodeScoped(scope, root);
|
|
1977
1987
|
if (scoped)
|
|
1978
1988
|
{
|
|
1979
|
-
perf.treeScopedLayouts
|
|
1989
|
+
GEA_REFRESH_PERF(perf.treeScopedLayouts++);
|
|
1980
1990
|
break;
|
|
1981
1991
|
}
|
|
1982
1992
|
// Most rejects mean the scope autosized to the new content —
|
|
@@ -1985,9 +1995,9 @@ namespace gea::embedded::ui
|
|
|
1985
1995
|
scope = stableScopeAt(state, state.nodes[scope].parent, root);
|
|
1986
1996
|
}
|
|
1987
1997
|
}
|
|
1998
|
+
LayoutEngine::Pass layoutPass(!scoped);
|
|
1988
1999
|
if (!scoped)
|
|
1989
2000
|
{
|
|
1990
|
-
LayoutEngine::instance().beginLayoutPass();
|
|
1991
2001
|
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1992
2002
|
}
|
|
1993
2003
|
#if GEA_CSS_SCROLLING
|
|
@@ -2012,7 +2022,7 @@ namespace gea::embedded::ui
|
|
|
2012
2022
|
continue;
|
|
2013
2023
|
if (n.parent < 0 && i != root)
|
|
2014
2024
|
continue;
|
|
2015
|
-
if (n.
|
|
2025
|
+
if (n.computedStyle().display == kDisplayNone)
|
|
2016
2026
|
continue;
|
|
2017
2027
|
if (n.layout.previous_width <= 0 && n.layout.previous_height <= 0 &&
|
|
2018
2028
|
n.layout.width <= 0 && n.layout.height <= 0)
|
|
@@ -2046,9 +2056,12 @@ namespace gea::embedded::ui
|
|
|
2046
2056
|
state.refreshSerial++;
|
|
2047
2057
|
if (state.refreshSerial == 0)
|
|
2048
2058
|
state.refreshSerial = 1;
|
|
2049
|
-
perf.treeLayoutUs += refreshPerfNowUs() - layoutStartUs;
|
|
2059
|
+
GEA_REFRESH_PERF(perf.treeLayoutUs += refreshPerfNowUs() - layoutStartUs);
|
|
2050
2060
|
|
|
2051
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
|
|
2052
2065
|
const bool display_list_was_dirty = state.displayListDirty;
|
|
2053
2066
|
// Consume the structural flag for this frame's rebuild decision. A
|
|
2054
2067
|
// content-only rebuild (appearance change on existing nodes — partial
|
|
@@ -2306,10 +2319,10 @@ namespace gea::embedded::ui
|
|
|
2306
2319
|
}
|
|
2307
2320
|
state.displayListDirty = false;
|
|
2308
2321
|
displayListFullRecord = !reprojected;
|
|
2309
|
-
perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs;
|
|
2310
|
-
perf.treeRecordCalls
|
|
2311
|
-
perf.treeRecordedNodes += state.nodeCount;
|
|
2312
|
-
perf.treeRecordedCommands += DisplayList::instance().commandCount();
|
|
2322
|
+
GEA_REFRESH_PERF(perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs);
|
|
2323
|
+
GEA_REFRESH_PERF(perf.treeRecordCalls++);
|
|
2324
|
+
GEA_REFRESH_PERF(perf.treeRecordedNodes += state.nodeCount);
|
|
2325
|
+
GEA_REFRESH_PERF(perf.treeRecordedCommands += DisplayList::instance().commandCount());
|
|
2313
2326
|
}
|
|
2314
2327
|
else if (!can_keep_display_list)
|
|
2315
2328
|
{
|
|
@@ -2329,16 +2342,16 @@ namespace gea::embedded::ui
|
|
|
2329
2342
|
DisplayList::instance().recordNode(root, 255);
|
|
2330
2343
|
DisplayList::instance().weldTransformedFaces();
|
|
2331
2344
|
state.displayListDirty = false;
|
|
2332
|
-
perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs;
|
|
2333
|
-
perf.treeRecordCalls
|
|
2334
|
-
perf.treeRecordedNodes += state.nodeCount;
|
|
2335
|
-
perf.treeRecordedCommands += DisplayList::instance().commandCount();
|
|
2345
|
+
GEA_REFRESH_PERF(perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs);
|
|
2346
|
+
GEA_REFRESH_PERF(perf.treeRecordCalls++);
|
|
2347
|
+
GEA_REFRESH_PERF(perf.treeRecordedNodes += state.nodeCount);
|
|
2348
|
+
GEA_REFRESH_PERF(perf.treeRecordedCommands += DisplayList::instance().commandCount());
|
|
2336
2349
|
}
|
|
2337
2350
|
if (displayListFullRecord)
|
|
2338
|
-
perf.treeFullRecords
|
|
2351
|
+
GEA_REFRESH_PERF(perf.treeFullRecords++);
|
|
2339
2352
|
if (reprojected)
|
|
2340
|
-
perf.treeReprojects
|
|
2341
|
-
perf.treeDisplayListUs += refreshPerfNowUs() - displayListStartUs;
|
|
2353
|
+
GEA_REFRESH_PERF(perf.treeReprojects++);
|
|
2354
|
+
GEA_REFRESH_PERF(perf.treeDisplayListUs += refreshPerfNowUs() - displayListStartUs);
|
|
2342
2355
|
|
|
2343
2356
|
// Horizontal-pan fast path: when a camera/world wrapper translated the viewport
|
|
2344
2357
|
// this frame (and nothing structural changed), memcpy-shift the viewport instead
|
|
@@ -2436,10 +2449,10 @@ namespace gea::embedded::ui
|
|
|
2436
2449
|
direct_replay &&
|
|
2437
2450
|
n->render.bg_recolor_pending &&
|
|
2438
2451
|
n->first_child < 0 &&
|
|
2439
|
-
!hasAnyBorder(n->
|
|
2440
|
-
n->
|
|
2441
|
-
(GEA_CSS_FILTERS ? rstyle(n->
|
|
2442
|
-
(GEA_CSS_BOX_SHADOW ? rstyle(n->
|
|
2452
|
+
!hasAnyBorder(n->computedStyle()) &&
|
|
2453
|
+
n->computedStyle().opacity == 255 &&
|
|
2454
|
+
(GEA_CSS_FILTERS ? rstyle(n->computedStyle()).filter_blur_radius : 0) <= 0 &&
|
|
2455
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(n->computedStyle()).box_shadow_blur_radius : 0) <= 0 &&
|
|
2443
2456
|
n->layout.x == n->layout.previous_x &&
|
|
2444
2457
|
n->layout.y == n->layout.previous_y &&
|
|
2445
2458
|
n->layout.width == n->layout.previous_width &&
|
|
@@ -2452,7 +2465,7 @@ namespace gea::embedded::ui
|
|
|
2452
2465
|
int recolorY1 = -1;
|
|
2453
2466
|
if (DisplayList::instance().recolorRetainedSolidBackground(i,
|
|
2454
2467
|
n->render.bg_recolor_from,
|
|
2455
|
-
n->
|
|
2468
|
+
n->computedStyle().bg_color,
|
|
2456
2469
|
&recolorX0,
|
|
2457
2470
|
&recolorY0,
|
|
2458
2471
|
&recolorX1,
|
|
@@ -2498,8 +2511,8 @@ namespace gea::embedded::ui
|
|
|
2498
2511
|
addDirtyRegion(flush_rects, &flush_rect_count, repair, width, height);
|
|
2499
2512
|
}
|
|
2500
2513
|
}
|
|
2501
|
-
perf.treeBgRecolorCalls
|
|
2502
|
-
perf.treeBgRecolorPixels += recolorPixels;
|
|
2514
|
+
GEA_REFRESH_PERF(perf.treeBgRecolorCalls++);
|
|
2515
|
+
GEA_REFRESH_PERF(perf.treeBgRecolorPixels += recolorPixels);
|
|
2503
2516
|
n->render.dirty = 0;
|
|
2504
2517
|
n->render.layout_dirty = 0;
|
|
2505
2518
|
#if GEA_CSS_SCROLLING
|
|
@@ -2718,12 +2731,15 @@ namespace gea::embedded::ui
|
|
|
2718
2731
|
// replay the full filtered source/output bounds so the cache never mixes
|
|
2719
2732
|
// retained pixels with the current frame.
|
|
2720
2733
|
expandDirtyRegionsForFilterBlur(rects, &rect_count, flush_rects, &flush_rect_count, unifiedRectPath, width, height);
|
|
2721
|
-
perf.treeDirtyCollectUs += refreshPerfNowUs() - dirtyCollectStartUs;
|
|
2734
|
+
GEA_REFRESH_PERF(perf.treeDirtyCollectUs += refreshPerfNowUs() - dirtyCollectStartUs);
|
|
2722
2735
|
// Done collecting (and the structural/framebuffer/filter adds above); clear the
|
|
2723
2736
|
// broad-bbox flag so it can't leak into any later addDirtyRegion path.
|
|
2724
2737
|
g_broadDirtyBbox = false;
|
|
2725
2738
|
|
|
2726
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
|
|
2727
2743
|
if (!unifiedRectPath || GEA_EMBEDDED_REPLAY_COALESCE_DIRTY_REGIONS)
|
|
2728
2744
|
coalesceLowCostDirtyRegions(rects, &rect_count);
|
|
2729
2745
|
if (!preserveFlatTransformedReplayRects)
|
|
@@ -2778,28 +2794,30 @@ namespace gea::embedded::ui
|
|
|
2778
2794
|
coalesceHighCoverageDirtyRegions(flush_rects, &flush_rect_count, width, height);
|
|
2779
2795
|
#endif
|
|
2780
2796
|
}
|
|
2781
|
-
perf.treeDirtyCoalesceUs += refreshPerfNowUs() - dirtyCoalesceStartUs;
|
|
2797
|
+
GEA_REFRESH_PERF(perf.treeDirtyCoalesceUs += refreshPerfNowUs() - dirtyCoalesceStartUs);
|
|
2782
2798
|
|
|
2783
2799
|
gea::platform::display::DisplayFlushRect flushRects[DirtyRegions::kMaxRects];
|
|
2784
2800
|
int flushRectCount = 0;
|
|
2801
|
+
#if GEA_EMBEDDED_UI_REFRESH_PERF
|
|
2785
2802
|
if (rect_count > 0)
|
|
2786
2803
|
{
|
|
2787
|
-
perf.treeReplayRegions += rect_count;
|
|
2804
|
+
GEA_REFRESH_PERF(perf.treeReplayRegions += rect_count);
|
|
2788
2805
|
for (int i = 0; i < rect_count; i++)
|
|
2789
2806
|
{
|
|
2790
2807
|
if (rects[i].origin >= 0)
|
|
2791
|
-
perf.treeReplayOriginRegions
|
|
2808
|
+
GEA_REFRESH_PERF(perf.treeReplayOriginRegions++);
|
|
2792
2809
|
if (perf.treeReplayRegionSampleCount < gea::embedded::ui::RefreshPerfStats::kMaxTreeReplayRegionSamples)
|
|
2793
2810
|
{
|
|
2794
2811
|
const int sample = perf.treeReplayRegionSampleCount++;
|
|
2795
|
-
perf.treeReplayRegionX0[sample] = static_cast<std::int16_t>(rects[i].x0);
|
|
2796
|
-
perf.treeReplayRegionY0[sample] = static_cast<std::int16_t>(rects[i].y0);
|
|
2797
|
-
perf.treeReplayRegionX1[sample] = static_cast<std::int16_t>(rects[i].x1);
|
|
2798
|
-
perf.treeReplayRegionY1[sample] = static_cast<std::int16_t>(rects[i].y1);
|
|
2799
|
-
perf.treeReplayRegionOrigin[sample] = static_cast<std::int16_t>(rects[i].origin);
|
|
2812
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionX0[sample] = static_cast<std::int16_t>(rects[i].x0));
|
|
2813
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionY0[sample] = static_cast<std::int16_t>(rects[i].y0));
|
|
2814
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionX1[sample] = static_cast<std::int16_t>(rects[i].x1));
|
|
2815
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionY1[sample] = static_cast<std::int16_t>(rects[i].y1));
|
|
2816
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionOrigin[sample] = static_cast<std::int16_t>(rects[i].origin));
|
|
2800
2817
|
}
|
|
2801
2818
|
}
|
|
2802
2819
|
}
|
|
2820
|
+
#endif
|
|
2803
2821
|
const bool hasFlushOnlyRecolorRegions = preserveFlushOnlyRecolorRegions && flush_rect_count > 0;
|
|
2804
2822
|
const bool simpleDirtyReplayAvailable =
|
|
2805
2823
|
direct_replay && unifiedRectPath && DisplayList::instance().canReplaySimpleDirtyRegions(width, height);
|
|
@@ -2818,7 +2836,7 @@ namespace gea::embedded::ui
|
|
|
2818
2836
|
#endif
|
|
2819
2837
|
if (simpleUnifiedReplay)
|
|
2820
2838
|
{
|
|
2821
|
-
perf.treeDirectReplayCalls
|
|
2839
|
+
GEA_REFRESH_PERF(perf.treeDirectReplayCalls++);
|
|
2822
2840
|
#if GEA_EMBEDDED_DISPLAY_FUSE_REPLAY_FLUSH
|
|
2823
2841
|
// Fused: skip the separate replay-into-framebuffer pass entirely. Hand the
|
|
2824
2842
|
// coalesced dirty windows to the flush, which chunks them and calls
|
|
@@ -2844,7 +2862,7 @@ namespace gea::embedded::ui
|
|
|
2844
2862
|
gea::platform::display::Display::flushRectsRasterized(sparseRects, sparseCount, fusedReplayRaster, &fctx, /*allowPerChunkDrain=*/false);
|
|
2845
2863
|
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
2846
2864
|
}
|
|
2847
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
2865
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2848
2866
|
}
|
|
2849
2867
|
#else
|
|
2850
2868
|
// A single wide flush of the dirty union avoids the per-window overhead and
|
|
@@ -2898,7 +2916,7 @@ namespace gea::embedded::ui
|
|
|
2898
2916
|
gea::platform::display::Display::pushClip(r->x0, r->y0, r->x1 - r->x0 + 1, r->y1 - r->y0 + 1);
|
|
2899
2917
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2900
2918
|
DisplayList::instance().replaySimpleClippedDirtyRegion(r->x0, r->y0, r->x1, r->y1, r->origin);
|
|
2901
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
2919
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2902
2920
|
gea::platform::display::Display::popClip();
|
|
2903
2921
|
}
|
|
2904
2922
|
}
|
|
@@ -2914,7 +2932,7 @@ namespace gea::embedded::ui
|
|
|
2914
2932
|
regions[i] = DisplayReplayRegion{r->x0, r->y0, r->x1, r->y1, r->origin};
|
|
2915
2933
|
}
|
|
2916
2934
|
DisplayList::instance().replayDirectDirtyRegions(regions, rect_count);
|
|
2917
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
2935
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2918
2936
|
}
|
|
2919
2937
|
}
|
|
2920
2938
|
else
|
|
@@ -2927,7 +2945,7 @@ namespace gea::embedded::ui
|
|
|
2927
2945
|
gea::platform::display::Display::pushClip(r->x0, r->y0, r->x1 - r->x0 + 1, r->y1 - r->y0 + 1);
|
|
2928
2946
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2929
2947
|
DisplayList::instance().replaySimpleClippedDirtyRegion(r->x0, r->y0, r->x1, r->y1, r->origin);
|
|
2930
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
2948
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2931
2949
|
gea::platform::display::Display::popClip();
|
|
2932
2950
|
}
|
|
2933
2951
|
}
|
|
@@ -2962,12 +2980,12 @@ namespace gea::embedded::ui
|
|
|
2962
2980
|
if (sparseCount > 0)
|
|
2963
2981
|
gea::platform::display::Display::flushRects(sparseRects, sparseCount);
|
|
2964
2982
|
}
|
|
2965
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
2983
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2966
2984
|
#endif
|
|
2967
2985
|
}
|
|
2968
2986
|
else if (interleavedUnifiedFlush)
|
|
2969
2987
|
{
|
|
2970
|
-
perf.treeDirectReplayCalls
|
|
2988
|
+
GEA_REFRESH_PERF(perf.treeDirectReplayCalls++);
|
|
2971
2989
|
#if GEA_EMBEDDED_DISPLAY_FUSE_REPLAY_FLUSH && GEA_EMBEDDED_DISPLAY_FUSE_INTERLEAVED_REPLAY_FLUSH
|
|
2972
2990
|
FusedReplayRasterCtx fctx{width, height};
|
|
2973
2991
|
gea::platform::display::DisplayFlushRect sparseRects[DirtyRegions::kMaxRects];
|
|
@@ -2986,7 +3004,7 @@ namespace gea::embedded::ui
|
|
|
2986
3004
|
gea::platform::display::Display::flushRectsRasterized(sparseRects, sparseCount, fusedDirectReplayRaster, &fctx, /*allowPerChunkDrain=*/false);
|
|
2987
3005
|
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
2988
3006
|
}
|
|
2989
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
3007
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2990
3008
|
#else
|
|
2991
3009
|
for (int i = 0; i < rect_count; i++)
|
|
2992
3010
|
{
|
|
@@ -2997,11 +3015,11 @@ namespace gea::embedded::ui
|
|
|
2997
3015
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2998
3016
|
const DisplayReplayRegion region{r->x0, r->y0, r->x1, r->y1, r->origin};
|
|
2999
3017
|
DisplayList::instance().replayDirectDirtyRegions(®ion, 1);
|
|
3000
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
3018
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
3001
3019
|
gea::platform::display::Display::popClip();
|
|
3002
3020
|
const std::int64_t flushStartUs = refreshPerfNowUs();
|
|
3003
3021
|
gea::platform::display::Display::flush();
|
|
3004
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
3022
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
3005
3023
|
}
|
|
3006
3024
|
#endif
|
|
3007
3025
|
}
|
|
@@ -3010,7 +3028,7 @@ namespace gea::embedded::ui
|
|
|
3010
3028
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
3011
3029
|
if (direct_replay && rect_count > 0)
|
|
3012
3030
|
{
|
|
3013
|
-
perf.treeDirectReplayCalls
|
|
3031
|
+
GEA_REFRESH_PERF(perf.treeDirectReplayCalls++);
|
|
3014
3032
|
gea::platform::display::Display::resetClip();
|
|
3015
3033
|
gea::platform::display::Display::setAlpha(255);
|
|
3016
3034
|
DisplayReplayRegion regions[DirtyRegions::kMaxRects];
|
|
@@ -3034,7 +3052,7 @@ namespace gea::embedded::ui
|
|
|
3034
3052
|
gea::platform::display::Display::popClip();
|
|
3035
3053
|
}
|
|
3036
3054
|
}
|
|
3037
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
3055
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
3038
3056
|
}
|
|
3039
3057
|
|
|
3040
3058
|
// Static-backdrop cache: once the static scene (bg + stage) has been stable for a
|
|
@@ -3063,6 +3081,9 @@ namespace gea::embedded::ui
|
|
|
3063
3081
|
staticBackdropEligible);
|
|
3064
3082
|
|
|
3065
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
|
|
3066
3087
|
if (!simpleUnifiedReplay && !interleavedUnifiedFlush)
|
|
3067
3088
|
{
|
|
3068
3089
|
for (int i = 0; i < flush_rect_count; i++)
|
|
@@ -3089,7 +3110,7 @@ namespace gea::embedded::ui
|
|
|
3089
3110
|
}
|
|
3090
3111
|
if (flushRectCount > 0)
|
|
3091
3112
|
gea::platform::display::Display::flushRects(flushRects, flushRectCount);
|
|
3092
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushRectsStartUs;
|
|
3113
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushRectsStartUs);
|
|
3093
3114
|
}
|
|
3094
3115
|
const std::int64_t snapshotStartUs = refreshPerfNowUs();
|
|
3095
3116
|
LayoutSnapshot::capture();
|
|
@@ -3104,7 +3125,17 @@ namespace gea::embedded::ui
|
|
|
3104
3125
|
if (displayCanvas)
|
|
3105
3126
|
displayCanvas->resetDirty();
|
|
3106
3127
|
#endif
|
|
3107
|
-
perf.treeSnapshotUs += refreshPerfNowUs() - snapshotStartUs;
|
|
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
|
|
3108
3139
|
}
|
|
3109
3140
|
|
|
3110
3141
|
void Tree::frame(int timestamp_ms)
|
|
@@ -3130,11 +3161,11 @@ namespace gea::embedded::ui
|
|
|
3130
3161
|
for (int i = 0; i < state.nodeCount; i++)
|
|
3131
3162
|
{
|
|
3132
3163
|
Node *n = &state.nodes[i];
|
|
3133
|
-
if (n->
|
|
3164
|
+
if (n->computedStyle().blink_interval_ms <= 0)
|
|
3134
3165
|
{
|
|
3135
|
-
if (!n->
|
|
3166
|
+
if (!n->computedStyle().blink_visible)
|
|
3136
3167
|
{
|
|
3137
|
-
n->
|
|
3168
|
+
n->mutableStyle().blink_visible = 1;
|
|
3138
3169
|
n->render.dirty = 1;
|
|
3139
3170
|
n->render.layout_dirty = 1;
|
|
3140
3171
|
#if GEA_CSS_SCROLLING
|
|
@@ -3145,13 +3176,13 @@ namespace gea::embedded::ui
|
|
|
3145
3176
|
continue;
|
|
3146
3177
|
}
|
|
3147
3178
|
|
|
3148
|
-
int elapsed = timestamp_ms - n->
|
|
3179
|
+
int elapsed = timestamp_ms - n->computedStyle().blink_started_ms;
|
|
3149
3180
|
if (elapsed < 0)
|
|
3150
3181
|
elapsed = 0;
|
|
3151
|
-
int visible = ((elapsed / n->
|
|
3152
|
-
if (n->
|
|
3182
|
+
int visible = ((elapsed / n->computedStyle().blink_interval_ms) % 2) == 0;
|
|
3183
|
+
if (n->computedStyle().blink_visible == visible)
|
|
3153
3184
|
continue;
|
|
3154
|
-
n->
|
|
3185
|
+
n->mutableStyle().blink_visible = visible;
|
|
3155
3186
|
n->render.dirty = 1;
|
|
3156
3187
|
n->render.layout_dirty = 1;
|
|
3157
3188
|
#if GEA_CSS_SCROLLING
|
|
@@ -3178,7 +3209,7 @@ namespace gea::embedded::ui
|
|
|
3178
3209
|
Node *n = &state.nodes[i];
|
|
3179
3210
|
if (n->type != NodeType::Camera)
|
|
3180
3211
|
continue;
|
|
3181
|
-
if (n->
|
|
3212
|
+
if (n->computedStyle().display == kDisplayNone)
|
|
3182
3213
|
continue;
|
|
3183
3214
|
hasVisibleCamera = true;
|
|
3184
3215
|
if (nativeOverlay)
|