@@ -10,7 +10,8 @@ inline int
1010myCeil (int val, int div) {
1111 if (div == 0 ) {
1212 return 0 ;
13- } return (val + div - 1 ) / div;
13+ }
14+ return (val + div - 1 ) / div;
1415}
1516
1617inline uint16_t
@@ -132,7 +133,7 @@ ScreenRenderObject::doDraw(rmlib::Rect rect, rmlib::Canvas& canvas) {
132133 if (shouldRefresh ()) {
133134 term.shouldClear = false ;
134135 numUpdates = 0 ;
135- return {rect, fb::Waveform::GC16, fb::UpdateFlags::FullRefresh};
136+ return { rect, fb::Waveform::GC16, fb::UpdateFlags::FullRefresh };
136137 }
137138
138139 return {};
@@ -154,7 +155,7 @@ ScreenRenderObject::drawLine(rmlib::Canvas& canvas,
154155
155156 for (int col = 0 ; col < term.cols ; col++) {
156157 int marginLeft = term.marginLeft + col * CELL_WIDTH +
157- (isLandscape ? rect.topLeft .y : rect.topLeft .x );
158+ (isLandscape ? rect.topLeft .y : rect.topLeft .x );
158159
159160 auto & cell = term.cells [line][col];
160161
@@ -171,16 +172,17 @@ ScreenRenderObject::drawLine(rmlib::Canvas& canvas,
171172 myCeil (glyphWidth, BITS_PER_BYTE) * BITS_PER_BYTE - glyphWidth;
172173 if (cell.width == WIDE) {
173174 bdfPadding += CELL_WIDTH;
174- }
175+ }
175176
176177 /* check cursor position */
177178 if ((((term.mode & MODE_CURSOR) != 0U ) && line == term.cursor .y ) &&
178179 (col == term.cursor .x ||
179180 (cell.width == WIDE && (col + 1 ) == term.cursor .x ) ||
180181 (cell.width == NEXT_TO_WIDE && (col - 1 ) == term.cursor .x ))) {
181182 colorPair.fg = DEFAULT_BG;
182- colorPair.bg = (/* !vt_active &&*/ BACKGROUND_DRAW) != 0U ? PASSIVE_CURSOR_COLOR
183- : ACTIVE_CURSOR_COLOR;
183+ colorPair.bg = (/* !vt_active &&*/ BACKGROUND_DRAW) != 0U
184+ ? PASSIVE_CURSOR_COLOR
185+ : ACTIVE_CURSOR_COLOR;
184186 }
185187
186188 // lookup pixels
@@ -244,18 +246,20 @@ ScreenRenderObject::drawLine(rmlib::Canvas& canvas,
244246 }
245247
246248 /* update copy buffer only */
247- memcpy (canvas.getMemory () + pos, &pixel, canvas.components ());
249+ assert (canvas.components () == 2 );
250+ *(uint16_t *)(canvas.getMemory () + pos) = (uint16_t )pixel;
251+ // memcpy(canvas.getMemory() + pos, &pixel, canvas.components());
248252 }
249253 }
250254 }
251255
252256 term.line_dirty [line] =
253257 ((term.mode & MODE_CURSOR) != 0u ) && term.cursor .y == line;
254258
255- return isLandscape ? Rect{ { zStart - CELL_HEIGHT, 0 },
256- { zStart, rect.height () - 1 } }
257- : Rect{ { 0 , zStart },
258- { rect.width () - 1 , zStart + CELL_HEIGHT - 1 } };
259+ return isLandscape
260+ ? Rect{ { zStart - CELL_HEIGHT, 0 }, { zStart, rect.height () - 1 } }
261+ : Rect{ { 0 , zStart },
262+ { rect.width () - 1 , zStart + CELL_HEIGHT - 1 } };
259263}
260264
261265template <typename Ev>
@@ -287,9 +291,8 @@ ScreenRenderObject::handleTouchEvent(const Ev& ev) {
287291
288292 const auto scaledLoc = ev.location - getRect ().topLeft ;
289293 const auto rotatedLoc =
290- widget->isLandscape
291- ? Point{ scaledLoc.y , getRect ().width () - scaledLoc.x }
292- : scaledLoc;
294+ widget->isLandscape ? Point{ scaledLoc.y , getRect ().width () - scaledLoc.x }
295+ : scaledLoc;
293296
294297 std::array<char , 6 > buf{};
295298 initMouseBuf (buf, rotatedLoc);
@@ -335,6 +338,7 @@ ScreenRenderObject::handleInput(const rmlib::input::Event& ev) {
335338}
336339
337340void
338- ScreenRenderObject::doRebuild (AppContext& ctx, const BuildContext& /* buildContext*/ ) {
341+ ScreenRenderObject::doRebuild (AppContext& ctx,
342+ const BuildContext& /* buildContext*/ ) {
339343 this ->fb = &ctx.getFramebuffer ();
340344}
0 commit comments