@geastack/engine 0.1.6 → 0.1.7

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/ui/image_node.cpp CHANGED
@@ -73,18 +73,18 @@ private:
73
73
 
74
74
  bool hasImageRadius(const Node &node)
75
75
  {
76
- return node.style.border_radius[0] > 0 ||
77
- node.style.border_radius[1] > 0 ||
78
- node.style.border_radius[2] > 0 ||
79
- node.style.border_radius[3] > 0;
76
+ return node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)] > 0 ||
77
+ node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)] > 0 ||
78
+ node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)] > 0 ||
79
+ node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)] > 0;
80
80
  }
81
81
 
82
82
  void setScaledBlitRadius(DisplayCommand *cmd, const Node &node)
83
83
  {
84
- cmd->scaledBlit.tl = node.style.border_radius[0];
85
- cmd->scaledBlit.tr = node.style.border_radius[1];
86
- cmd->scaledBlit.br = node.style.border_radius[2];
87
- cmd->scaledBlit.bl = node.style.border_radius[3];
84
+ cmd->scaledBlit.tl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)];
85
+ cmd->scaledBlit.tr = node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)];
86
+ cmd->scaledBlit.br = node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)];
87
+ cmd->scaledBlit.bl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)];
88
88
  }
89
89
 
90
90
  bool applyAxisAlignedTransform(const Node &node, ImageFitRect &rect)
@@ -106,6 +106,7 @@ bool applyAxisAlignedTransform(const Node &node, ImageFitRect &rect)
106
106
 
107
107
  void ImageRenderer::layout(int id)
108
108
  {
109
+ if (!GEA_UI_IMAGE_NODES) return;
109
110
  Node *n = &Tree::instance().nodes()[id];
110
111
  auto &images = gea::framework::graphics::ImageStore::instance();
111
112
  int iw = images.width(n->image_id);
package/ui/input.cpp CHANGED
@@ -135,7 +135,9 @@ public:
135
135
  activeBackgroundColor_ = node.style.bg_color;
136
136
  activeHasBackground_ = node.style.has_bg;
137
137
  node.render.dirty = 1; // paint-only: press highlight recolors in place
138
+ #if GEA_CSS_SCROLLING
138
139
  node.render.non_scroll_dirty = 1;
140
+ #endif
139
141
  // We mutated bg_color directly (bypassing setStyleValue), so the
140
142
  // direct-replay refresh path would otherwise keep the cached
141
143
  // pre-press color in the display list. Mark commands dirty so the
@@ -559,6 +561,7 @@ private:
559
561
 
560
562
  static void setScrollLeft(int nodeId, int next)
561
563
  {
564
+ #if GEA_CSS_SCROLLING
562
565
  Tree &tree = Tree::instance();
563
566
  if (nodeId < 0 || nodeId >= tree.nodeCount()) return;
564
567
  Node &node = tree.node(nodeId);
@@ -571,10 +574,14 @@ private:
571
574
  // handles either axis), so it no longer forces the full clipped-replay
572
575
  // path via non_scroll_dirty — mirror the vertical setScrollTop path.
573
576
  tree.markScrollDirty(nodeId);
574
- }
577
+ #else
578
+ (void)nodeId; (void)next;
579
+ #endif
580
+ }
575
581
 
576
582
  static void setScrollTop(int nodeId, int next)
577
583
  {
584
+ #if GEA_CSS_SCROLLING
578
585
  Tree &tree = Tree::instance();
579
586
  if (nodeId < 0 || nodeId >= tree.nodeCount()) return;
580
587
  if (tree.node(nodeId).type == NodeType::VirtualList) {
@@ -587,7 +594,10 @@ private:
587
594
  node.render.dirty = 1;
588
595
  node.render.layout_dirty = 1;
589
596
  tree.markScrollDirty(nodeId);
590
- }
597
+ #else
598
+ (void)nodeId; (void)next;
599
+ #endif
600
+ }
591
601
 
592
602
  static std::uint16_t lightenRgb565(std::uint16_t color)
593
603
  {
@@ -650,7 +660,9 @@ private:
650
660
  node.style.bg_color = savedBackgroundColor_;
651
661
  node.style.has_bg = savedHasBackground_;
652
662
  node.render.dirty = 1; // paint-only: press highlight restore
663
+ #if GEA_CSS_SCROLLING
653
664
  node.render.non_scroll_dirty = 1;
665
+ #endif
654
666
  Tree::instance().markNodeDisplayCommandsDirty(activeTouchNode_);
655
667
  }
656
668
  activeTouchNode_ = -1;
@@ -893,6 +905,7 @@ int Tree::activeInputId() const
893
905
 
894
906
  void Tree::setActiveInput(int nodeId)
895
907
  {
908
+ #if GEA_UI_INPUT_NODES
896
909
  auto &state = treeState();
897
910
  if (nodeId < -1 || nodeId >= state.nodeCount) nodeId = -1;
898
911
  if (state.activeInputId == nodeId) return;
@@ -910,7 +923,9 @@ void Tree::setActiveInput(int nodeId)
910
923
  Node &n = state.nodes[id];
911
924
  n.render.dirty = 1;
912
925
  n.render.layout_dirty = 1;
926
+ #if GEA_CSS_SCROLLING
913
927
  n.render.non_scroll_dirty = 1;
928
+ #endif
914
929
  state.nodeCommandDirty[id] = 1;
915
930
  };
916
931
  markInputDirty(previousId);
@@ -923,6 +938,7 @@ void Tree::setActiveInput(int nodeId)
923
938
  // `displayListDirty`; the keyboard subsystem decides activity in
924
939
  // notifyActiveInputChanged.
925
940
  state.displayListDirty = true;
941
+ #endif
926
942
  }
927
943
 
928
944
  bool Tree::activeInputCaretVisible() const
@@ -932,6 +948,7 @@ bool Tree::activeInputCaretVisible() const
932
948
 
933
949
  void Tree::tickInputCaret(int timestampMs)
934
950
  {
951
+ #if GEA_UI_INPUT_NODES
935
952
  auto &state = treeState();
936
953
  if (state.activeInputId < 0) {
937
954
  state.caretVisible = false;
@@ -959,8 +976,11 @@ void Tree::tickInputCaret(int timestampMs)
959
976
  Node &n = state.nodes[state.activeInputId];
960
977
  n.render.dirty = 1;
961
978
  n.render.layout_dirty = 1;
979
+ #if GEA_CSS_SCROLLING
962
980
  n.render.non_scroll_dirty = 1;
981
+ #endif
963
982
  }
983
+ #endif
964
984
  }
965
985
 
966
986
  } // namespace gea::embedded::ui
@@ -78,6 +78,7 @@ const char *inputMeasureText(int id)
78
78
 
79
79
  void InputRenderer::layout(int id, int)
80
80
  {
81
+ if (!GEA_UI_INPUT_NODES) return;
81
82
  auto &tree = Tree::instance();
82
83
  if (id < 0 || id >= tree.nodeCount()) return;
83
84
  Node &n = tree.node(id);
@@ -95,12 +96,15 @@ void InputRenderer::layout(int id, int)
95
96
  else if ((n.style.height_percent != kUnset || n.style.height_expression >= 0) && n.layout.height > 0) height = n.layout.height;
96
97
  n.layout.width = clampBorderBoxSize(n.style, width, true);
97
98
  n.layout.height = clampBorderBoxSize(n.style, height, false);
99
+ #if GEA_CSS_SCROLLING
98
100
  n.layout.scroll_content_height = n.layout.height;
99
101
  n.layout.scroll_y = 0;
102
+ #endif
100
103
  }
101
104
 
102
105
  void InputRenderer::record(int id)
103
106
  {
107
+ if (!GEA_UI_INPUT_NODES) return;
104
108
  auto &tree = Tree::instance();
105
109
  if (id < 0 || id >= tree.nodeCount()) return;
106
110
  const Node &n = tree.node(id);