GUI_DrawPixel() very slow

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • GUI_DrawPixel() very slow

      Hello.
      I wanted to use the GUI_DrawPixel () function to implement some algorithms. But I noticed that it works very slowly.To show this, I created a small test. I changed the example "STemWin_HelloWorld" from the library "STM32Cube_FW_F4_V1.21.0" for STM32F429Dscowery.
      Here is the source code:

      C Source Code: BASIC_HelloWorld.c

      1. /*********************************************************************
      2. * SEGGER MICROCONTROLLER SYSTEME GmbH *
      3. * Solutions for real time microcontroller applications *
      4. **********************************************************************
      5. * *
      6. * (c) 1996 - 2015 SEGGER Microcontroller Systeme GmbH *
      7. * *
      8. * Internet: www.segger.com Support: support@segger.com *
      9. * *
      10. **********************************************************************
      11. ***** emWin - Graphical user interface for embedded applications *****
      12. emWin is protected by international copyright laws. Knowledge of the
      13. source code may not be used to write a similar product. This file may
      14. only be used in accordance with a license and should not be re-
      15. distributed in any way. We appreciate your understanding and fairness.
      16. ----------------------------------------------------------------------
      17. File : BASIC_HelloWorld.c
      18. Purpose : Simple demo drawing "Hello world"
      19. ----------------------------------------------------------------------
      20. */
      21. #include "GUI.h"
      22. #include "stdlib.h"
      23. #include "stdint.h"
      24. /*********************************************************************
      25. *
      26. * Public code
      27. *
      28. **********************************************************************
      29. */
      30. /*********************************************************************
      31. *
      32. * MainTask
      33. */
      34. #define XSIZE 240
      35. #define YSIZE 320
      36. void MainTask(void) {
      37. // GUI_Clear();
      38. // GUI_SetFont(&GUI_Font20_1);
      39. // GUI_DispStringAt("Hello world!", (LCD_GetXSize()-100)/2, (LCD_GetYSize()-20)/2);
      40. GUI_Clear();
      41. int X,Y;
      42. GUI_SetColor(GUI_RED);
      43. for (Y=1; Y<YSIZE; Y++)
      44. {
      45. for (X=1; X<XSIZE; X++)
      46. {
      47. GUI_DrawPixel(X,Y);
      48. }
      49. }
      50. uint32_t *disp;
      51. disp=(uint32_t)0xD0200000;
      52. for (int i=0; i<YSIZE*XSIZE; i++)
      53. {
      54. disp[i]=0xff0000FF;
      55. }
      56. // GUI_Delay(100);
      57. // GUI_DrawGradientH(0, 0, XSIZE, YSIZE, 0x0000FF, 0x00FFFF);
      58. //GUI_MEMDEV_CopyToLCD(hMem);
      59. while(1);
      60. }
      61. /*************************** End of file ****************************/
      Display All




      The result of the test is on this video:
      Result of the test

      Is it possible to speed up the GUI_DrawPixel, for example using a display driver?

      Thanks, and Sorry for my English.
    • Hi,

      If you are using GUI_DrawPixel() to fill the a large area (in your case I guess the complete LCD) it will take long because of the overhead of GUI_DrawPixel(). To fill a larger area you should use GUI_FillRect().
      If you want to fill the complete screen (or to be more specific a complete device) you can call GUI_Clear().

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      If those flames are just static you could use a bitmap. This will be much faster than drawing pixel by pixel.

      Or you draw the flames into a memory device once (the device has to be static to make sure it will remain in memory) and than only display this device.

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.