@@ -40,16 +40,16 @@ int32_t sorting2DCount{0};
4040
4141CC_FORCE_INLINE void fillIndexBuffers (RenderDrawInfo* drawInfo) { // NOLINT(readability-convert-member-functions-to-static)
4242 uint16_t * ib = drawInfo->getIDataBuffer ();
43-
43+
4444 UIMeshBuffer* buffer = drawInfo->getMeshBuffer ();
4545 uint32_t indexOffset = buffer->getIndexOffset ();
46-
46+
4747 uint16_t * indexb = drawInfo->getIbBuffer ();
4848 uint32_t indexCount = drawInfo->getIbCount ();
49-
49+
5050 memcpy (&ib[indexOffset], indexb, indexCount * sizeof (uint16_t ));
5151 indexOffset += indexCount;
52-
52+
5353 buffer->setIndexOffset (indexOffset);
5454}
5555
@@ -83,17 +83,17 @@ CC_FORCE_INLINE void fillColor(RenderEntity* entity, RenderDrawInfo* drawInfo) {
8383 uint32_t size = drawInfo->getVbCount () * stride;
8484 float * vbBuffer = drawInfo->getVbBuffer ();
8585 Color temp = entity->getColor ();
86-
86+
8787 uint32_t offset = 0 ;
8888 for (int i = 0 ; i < size; i += stride) {
8989 offset = i + 5 ;
9090 // NOTE: Only support RGBA32F (4 floats) color fomat now.
9191 // Spine set 'UIRenderer._useVertexOpacity = true', it uses RGBA32 (4 bytes) color and fills color in Skeleton._updateColor and spine/simple.ts assembler.
9292 // So for Spine rendering, it will never go here to fill color.
9393 vbBuffer[offset] = static_cast <float >(temp.r ) / 255 .0F ;
94- vbBuffer[offset+ 1 ] = static_cast <float >(temp.g ) / 255 .0F ;
95- vbBuffer[offset+ 2 ] = static_cast <float >(temp.b ) / 255 .0F ;
96- vbBuffer[offset+ 3 ] = entity->getOpacity ();
94+ vbBuffer[offset + 1 ] = static_cast <float >(temp.g ) / 255 .0F ;
95+ vbBuffer[offset + 2 ] = static_cast <float >(temp.b ) / 255 .0F ;
96+ vbBuffer[offset + 3 ] = entity->getOpacity ();
9797 }
9898}
9999
@@ -110,7 +110,7 @@ Batcher2d::Batcher2d(Root* root)
110110 _root = root;
111111 _device = _root->getDevice ();
112112 _stencilManager = StencilManager::getInstance ();
113-
113+
114114 _recordedRendererInfoQueue.reserve (100 );
115115}
116116
@@ -138,7 +138,7 @@ Batcher2d::~Batcher2d() { // NOLINT
138138 _maskAttributes.clear ();
139139}
140140
141- ccstd::vector<RecordedRendererInfo> & Batcher2d::getRecordedRendererInfoQueue () {
141+ ccstd::vector<RecordedRendererInfo>& Batcher2d::getRecordedRendererInfoQueue () {
142142 return _recordedRendererInfoQueue;
143143}
144144
@@ -170,11 +170,11 @@ void Batcher2d::fillBuffersAndMergeBatches() {
170170 for (auto * rootNode : _rootNodeArr) {
171171 // _batches will add by generateBatch
172172 walk (rootNode, 1 , false );
173-
173+
174174 if (ENABLE_SORTING_2D && sorting2DCount > 0 ) {
175175 flushRecordedUIRenderers ();
176176 }
177-
177+
178178 generateBatch (_currEntity, _currDrawInfo);
179179
180180 auto * scene = rootNode->getScene ()->getRenderScene ();
@@ -186,7 +186,7 @@ void Batcher2d::fillBuffersAndMergeBatches() {
186186 }
187187}
188188
189- void Batcher2d::handleUIRenderer (RenderEntity * entity) { // NOLINT(misc-no-recursion)
189+ void Batcher2d::handleUIRenderer (RenderEntity* entity) { // NOLINT(misc-no-recursion)
190190 uint32_t size = entity->getRenderDrawInfosSize ();
191191 for (uint32_t i = 0 ; i < size; i++) {
192192 auto * drawInfo = entity->getRenderDrawInfoAt (i);
@@ -195,25 +195,25 @@ void Batcher2d::handleUIRenderer(RenderEntity *entity) { // NOLINT(misc-no-recur
195195 entity->setVBColorDirty (false );
196196}
197197
198- int32_t Batcher2d::recordUIRenderer (RenderEntity * entity) {
198+ int32_t Batcher2d::recordUIRenderer (RenderEntity* entity) {
199199 if (!ENABLE_SORTING_2D ) return -1 ;
200- auto & queue = getRecordedRendererInfoQueue ();
201- auto & info = queue.emplace_back ();
200+ auto & queue = getRecordedRendererInfoQueue ();
201+ auto & info = queue.emplace_back ();
202202 info.renderEntity = entity;
203203 return static_cast <int32_t >(queue.size () - 1 );
204204}
205205
206206void Batcher2d::flushRecordedUIRenderers () { // NOLINT(misc-no-recursion)
207207 if (!ENABLE_SORTING_2D ) return ;
208- auto & queue = getRecordedRendererInfoQueue ();
208+ auto & queue = getRecordedRendererInfoQueue ();
209209 if (queue.empty ()) return ;
210210
211- std::stable_sort (queue.begin (), queue.end (), [](const auto & a, const auto &b) {
211+ std::stable_sort (queue.begin (), queue.end (), [](const auto & a, const auto & b) {
212212 return a.renderEntity ->getPriority () < b.renderEntity ->getPriority ();
213213 });
214214
215- for (const auto & info : queue) {
216- auto * entity = info.renderEntity ;
215+ for (const auto & info : queue) {
216+ auto * entity = info.renderEntity ;
217217 if (entity) {
218218 handleUIRenderer (entity);
219219 }
@@ -227,13 +227,13 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
227227 }
228228 bool breakWalk = false ;
229229 auto * entity = static_cast <RenderEntity*>(node->getUserData ());
230-
230+
231231 const bool isCurrentColorDirty = node->_isColorDirty () || parentColorDirty;
232232 const float localOpacity = node->_getLocalOpacity ();
233233 // Keep the same logic as which in batcher-2d.ts
234234 const float finalOpacity = parentOpacity * localOpacity * (entity ? entity->getColorAlpha () : 1 .F );
235235 node->_setFinalOpacity (finalOpacity);
236-
236+
237237 const bool visible = math::isNotEqualF (finalOpacity, 0 );
238238
239239 if (entity) {
@@ -244,7 +244,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
244244 entity->setOpacity (finalOpacity);
245245 entity->setVBColorDirty (true );
246246 }
247-
247+
248248 if (ENABLE_SORTING_2D && sorting2DCount > 0 ) {
249249 if (entity->getIsMask ()) {
250250 flushRecordedUIRenderers ();
@@ -257,7 +257,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
257257 handleUIRenderer (entity);
258258 }
259259 }
260-
260+
261261 if (entity->getRenderEntityType () == RenderEntityType::CROSSED ) {
262262 breakWalk = true ;
263263 }
@@ -271,7 +271,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
271271 walk (child, thisOpacity, isCurrentColorDirty);
272272 }
273273 }
274-
274+
275275 if (isCurrentColorDirty) {
276276 node->_setColorDirty (false );
277277 }
@@ -283,7 +283,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
283283 flushRecordedUIRenderers ();
284284 }
285285 }
286-
286+
287287 if (visible && _stencilManager->getMaskStackSize () > 0 ) {
288288 handlePostRender (entity);
289289 }
@@ -521,7 +521,7 @@ void Batcher2d::generateBatch(RenderEntity* entity, RenderDrawInfo* drawInfo) {
521521 curdrawBatch->setFirstIndex (indexOffset);
522522 curdrawBatch->setIndexCount (indexCount);
523523 curdrawBatch->fillPass (_currMaterial, depthStencil, dssHash);
524- const auto & passes = curdrawBatch->getPasses ();
524+ const auto & passes = curdrawBatch->getPasses ();
525525 if (!passes.empty ()) {
526526 const auto & pass = passes.at (0 );
527527 if (entity->getUseLocal ()) {
0 commit comments