@geastack/engine 0.1.14 → 0.1.15

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.
@@ -2014,6 +2014,24 @@ namespace gea::embedded::ui
2014
2014
  }
2015
2015
  return -1;
2016
2016
  }
2017
+ // A transformed parent re-records its whole subtree (its descendants'
2018
+ // corners all move). When no descendant paints anything -- the empty slot
2019
+ // of `{done ? <img/> : null}` inside a pulsing dot -- there is nothing to
2020
+ // move, and the node's own commands re-record in place like a leaf's. A
2021
+ // descendant that starts painting cannot splice into its empty range, so
2022
+ // rerecordNodeCommands refuses and the frame still falls back to a full
2023
+ // record. Ember's flow dot otherwise rebuilt the whole list every frame.
2024
+ bool descendantsPaintNothing(TreeState &state, int node)
2025
+ {
2026
+ for (int child = state.nodes[node].first_child; child >= 0; child = state.nodes[child].next_sibling)
2027
+ {
2028
+ if (DisplayList::instance().nodeCommandCount(child) != 0)
2029
+ return false;
2030
+ if (!descendantsPaintNothing(state, child))
2031
+ return false;
2032
+ }
2033
+ return true;
2034
+ }
2017
2035
  } // namespace
2018
2036
 
2019
2037
  void Tree::refresh(int root, int width, int height)
@@ -2411,7 +2429,8 @@ namespace gea::embedded::ui
2411
2429
  continue;
2412
2430
  if (layoutSizeChangeNeedsCommandRerecord(*n))
2413
2431
  state.nodeCommandDirty[i] = 1;
2414
- if (state.nodeCommandDirty[i] && n->render.transform_dirty && n->first_child >= 0)
2432
+ if (state.nodeCommandDirty[i] && n->render.transform_dirty && n->first_child >= 0 &&
2433
+ !descendantsPaintNothing(state, i))
2415
2434
  {
2416
2435
  rebuild_for_transform = 1;
2417
2436
  continue;
package/ui/view.cpp CHANGED
@@ -1299,6 +1299,20 @@ public:
1299
1299
  long s = std::lroundf(v * 8.0f);
1300
1300
  return (int16_t)(s < -32768 ? -32768 : (s > 32767 ? 32767 : s));
1301
1301
  };
1302
+ // No transform or perspective anywhere up the chain: every ancestor's
1303
+ // coefficients are the identity about its origin, which returns integer
1304
+ // corners exactly. Skip gathering them -- a cache probe and coefficient
1305
+ // fill per ancestor, ~80 us for a 6-deep chain on the ESP32-S31, paid by
1306
+ // every untransformed image and text box re-recorded while anything else
1307
+ // on screen animates a transform.
1308
+ if (!hasTransformChain(node, usePrevious)) {
1309
+ for (int i = 0; i < 4; i++) {
1310
+ xs[i] = (int16_t)std::lroundf(points[i].x);
1311
+ ys[i] = (int16_t)std::lroundf(points[i].y);
1312
+ if (xs8) { xs8[i] = fx8(points[i].x); ys8[i] = fx8(points[i].y); }
1313
+ }
1314
+ return;
1315
+ }
1302
1316
  auto &state = treeState();
1303
1317
  const int perspectiveNode = nearestPerspectiveNode(node, usePrevious);
1304
1318
  const NodeTransformCache *chain[kMaxChainDepth];