Skip to content

Commit

Permalink
etc
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 27, 2023
1 parent 2b5eb99 commit ee39883
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Marlin/src/lcd/tft/canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,23 @@ void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors)
dsty = y, dstx = x; // Destination line / column index

uint16_t color = 0; // Persist the last fetched color value
if (rle_state.has_rle_state) { // do we have rle position data
if (rle_state.has_rle_state) { // do we have RLE position data?
rle_state.has_rle_state = false; // invalidate stored RLE state
dstx = rle_state.dstx; // restore required states
dsty = rle_state.dsty;
srcx = rle_state.srcx;
srcy = rle_state.srcy;
bytedata = (uint8_t *)images[image].data + rle_state.rle_offset; // restart decode from here instead of the start of data
rle_state.has_rle_state = false; // invalidate stored rle state
}

bool done = false;
while (!done) {
if (dsty >= endLine -1 || srcy >= image_height -1) { // Store state?
rle_state.dstx = dstx; // save required states
if (dsty >= endLine - 1 || srcy >= image_height - 1) { // Store state?
rle_state.dstx = dstx; // Save required states
rle_state.dsty = dsty;
rle_state.srcx = srcx;
rle_state.srcy = srcy;
rle_state.rle_offset = bytedata - (uint8_t *)images[image].data;; // Keep these for skipping full rle decode on future iteratons
rle_state.rle_offset = bytedata - (uint8_t *)images[image].data;; // Keep these for skipping full RLE decode on future iteratons
}

uint8_t count = *bytedata++; // Get the count byte
Expand Down Expand Up @@ -193,7 +193,7 @@ void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors)
srcx = 0; dstx = x; // May be shifted within the canvas, but usually not
if (dsty >= endLine || srcy >= image_height) { // Done with the segment or the image?
done = true; // Set a flag to end the loop...
rle_state.has_rle_state = true; // rle state is stored
rle_state.has_rle_state = true; // RLE state is stored
break; // ...and break out of while(count--)
}
}
Expand Down

0 comments on commit ee39883

Please sign in to comment.