tuupola / hagl

Hardware Agnostic Graphics Library for embedded
https://www.appelsiini.net/tags/hagl/
MIT License
302 stars 49 forks source link

improve draw_circle and fix fill_circle #108

Closed smarq8 closed 1 year ago

smarq8 commented 1 year ago

I improved draw ricle, now it use hline and vline when possible insted of put_pixel. It seems more complex but it reduce wasting time for display communication to minimum. As shown in benchmark below its 2x faster. I also fix fill circle so they both should produce exactly same circles. I didnt test this library because I use higly modimied fork of this library, and also I do not know much abot PR yet. If something is wrotn then sorry.

my benchmark code for draw circle:

    uint32_t t1,t2;
    t1 = millis();
    for(uint8_t c=0;c<255;c+=5){
        for(int i=0;i<120;i+=2){
            hagl_draw_circle(320/2,120,i,hagl_color_fromRGB(c,c,c));
        }
    }
    t2 = millis();
    printf("%u\n",t2-t1);
    // platform - ESP32 320Mhz
    // display - 320x240 40MHz SPI
    // driver - TFT_eSPI
    // 18932[ms] - standard pixel only
    // 8522[ms] - boosted with hline and vline
tuupola commented 1 year ago

These should be two different PRs. Only one feature or fix per PR.

tuupola commented 1 year ago

I didnt test this library because I use higly modimied fork of this library, and also I do not know much abot PR yet.

Best way to do a PR is to make a new branch from master of your own fork. Edit the files and commit them. When ready open a PR against my repository

$ git clone https://github.com/smarq8/hagl.git smarq8_hagl
$ cd smarq8_hagl
$ git checkout -b fix-filled-circle
<edit files>
$ git commit .
$ git push
<create a PR in github>

Do you have the modified version available somewhere? It would be interesting to see.