KurtE
Senior Member+
@mjs513 Oops I meant the don't have a writeRect...
And I did figure out that their drawPixels does not work in rotation mode (1 or 3...)
So I put the display back into rotation(0); And then had the display code detect that the image would not fit and then rotated the image while displaying...
I then had the main loop, code use an elapsedMillis object and printed out how long each display took:
So on RA8875:
Note: If I time the ILI9341_t3 version displaying the three same images:
So almost 4 times faster. Yes lots more screen space, but the differences are I do 4 fill rects for the differences...
And I did figure out that their drawPixels does not work in rotation mode (1 or 3...)
So I put the display back into rotation(0); And then had the display code detect that the image would not fit and then rotated the image while displaying...
Code:
void drawImage(uint16_t image_width, uint16_t image_height, uint16_t *image, uint16_t bgColor) {
// first lets fill in part of screen that our image does not cover
if ((tft.width() >= image_width) && (tft.height() >= image_height)) {
uint16_t start_x = (tft.width() - image_width) / 2;
uint16_t start_y = (tft.height() - image_height) / 2;
tft.fillRect(0, 0, tft.width(), start_y, bgColor); // top;
tft.fillRect(0, start_y, start_x, image_height, bgColor); // left
tft.fillRect(start_x + image_width, start_y, tft.width() - (start_x + image_width), image_height, bgColor); // right
tft.fillRect(0, start_y + image_height, tft.width(), tft.height() - (start_y + image_height), bgColor); // top;
// now lets draw out each of the lines of the image...
for (uint16_t y = start_y; y < (start_y + image_height); y++) {
tft.setY(y);
tft.drawPixels(image, image_width, start_x, y);
image += image_width;
}
} else {
// We need to rotate the image...
uint16_t start_y = (tft.height() - image_width) / 2;
uint16_t start_x = (tft.width() - image_height) / 2;
//Serial.printf("Rotated: start(%d, %d)\n", start_x, start_y);
tft.fillRect(0, 0, tft.width(), start_y, bgColor); // top;
tft.fillRect(0, start_y, start_x, image_width, bgColor); // left
tft.fillRect(start_x + image_height, start_y, tft.width() - (start_x + image_height), image_width, bgColor); // right
tft.fillRect(0, start_y + image_width, tft.width(), tft.height() - (start_y + image_width), bgColor); // top;
// now lets draw out each of the lines of the image...
static uint16_t rotated_row[800]; // max size.
// BUGBUG: need to start at end of row and work back or image inverted
image += (image_width - 1);
for (uint16_t y = start_y; y < (start_y + image_width); y++) {
uint16_t *pimage = image;
for (uint16_t i = 0; i < image_height; i++) {
rotated_row[i] = *pimage;
pimage += image_width;
}
//Serial.printf("DP %x, %d, %d %d\n", rotated_row, image_height, start_x, y);
tft.drawPixels(rotated_row, image_height, start_x, y);
image--;
}
}
}
So on RA8875:
Code:
Display Front of card 176
Display Back of card 175
Display front of chip (DMAMEM?) 176
Display Front of card 176
Note: If I time the ILI9341_t3 version displaying the three same images:
Code:
Display Front of card 49
Display Back of card 49
Display front of chip (DMAMEM?) 49
Display Front of card 49