juanjqh / lvgl_eve_gpu_test-main

MIT License
1 stars 2 forks source link

Large bitmap drawing #3

Open capricorn-one opened 6 months ago

capricorn-one commented 6 months ago

Hey, tried to make a proper pull request for your lvgl fork but have to be a collaborator to do that. Add me if you like, but otherwise, here's the missing code

After BITMAP_SIZE command add:

    EVE_cmd_dl_burst(BITMAP_SIZE(EVE_NEAREST, EVE_BORDER, EVE_BORDER, clip_w,
                                 clip_h)); /*real height and wide is mandatory for rotation a scale (Clip Area)*/

    if((clip_w > 0x1FF) || (clip_h > 0x1FF)) {
        EVE_cmd_dl_burst(BITMAP_SIZE_H(clip_w, clip_h));
    }

And, after BITMAP_LAYOUT command add:

    EVE_cmd_dl_burst(BITMAP_LAYOUT(eve_format, img_stride, img_h));

    if((img_stride > 0x3FFUL) || (img_h > 0x1FFUL)) {
        EVE_cmd_dl_burst(BITMAP_LAYOUT_H(img_stride, img_h));
    }

I've tested this and working so far, very cool!

capricorn-one commented 6 months ago

well.. realizing pretty quickly why you didn't add this... and also realizing the IF statements are not the right approach.

For reference... this works to get the images drawn correctly, but then for some reason all my label text gets screwed up... will dig into it to find a solution.

capricorn-one commented 6 months ago

Got it!

So I removed the IF statements from above, of course that's necessary if the next image is smaller... but it's also necessary for the label case as you're using a bitmap there as well... I'm guessing I'm going to run into this somewhere else, but the fix for now is to add this code to the lv_draw_eve_label function just after the eve_primitive(BITMAPS) line:

    uint16_t width = draw_unit->base_unit.clip_area->x2 - draw_unit->base_unit.clip_area->x1;
    uint16_t height = draw_unit->base_unit.clip_area->y2 - draw_unit->base_unit.clip_area->y1;

    EVE_cmd_dl_burst(BITMAP_SIZE_H(width, height));
    EVE_cmd_dl_burst(BITMAP_LAYOUT_H(width, height));

Now I've got label text and large bitmaps going. Thanks again for this work, super impressive and obviously must have taken a lot of time. Much appreciated.

juanjqh commented 6 months ago

Hello, yes! I forgot to add SIZE_H and LAYOUT_H. I have corrected this by implementing the gradient functions that will be available in the next release.