acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_draw_sw.c (2692B)

      1 /**
      2  * @file lv_draw_sw.c
      3  *
      4  */
      5 
      6 /*********************
      7  *      INCLUDES
      8  *********************/
      9 #include "../lv_draw.h"
     10 #include "lv_draw_sw.h"
     11 
     12 /*********************
     13  *      DEFINES
     14  *********************/
     15 
     16 /**********************
     17  *      TYPEDEFS
     18  **********************/
     19 
     20 /**********************
     21  *  STATIC PROTOTYPES
     22  **********************/
     23 
     24 /**********************
     25  *  GLOBAL PROTOTYPES
     26  **********************/
     27 
     28 /**********************
     29  *  STATIC VARIABLES
     30  **********************/
     31 
     32 /**********************
     33  *      MACROS
     34  **********************/
     35 
     36 /**********************
     37  *   GLOBAL FUNCTIONS
     38  **********************/
     39 
     40 void lv_draw_sw_init_ctx(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
     41 {
     42     LV_UNUSED(drv);
     43 
     44     lv_draw_sw_ctx_t * draw_sw_ctx = (lv_draw_sw_ctx_t *) draw_ctx;
     45     lv_memset_00(draw_sw_ctx, sizeof(lv_draw_sw_ctx_t));
     46 
     47     draw_sw_ctx->base_draw.draw_arc = lv_draw_sw_arc;
     48     draw_sw_ctx->base_draw.draw_rect = lv_draw_sw_rect;
     49     draw_sw_ctx->base_draw.draw_bg = lv_draw_sw_bg;
     50     draw_sw_ctx->base_draw.draw_letter = lv_draw_sw_letter;
     51     draw_sw_ctx->base_draw.draw_img_decoded = lv_draw_sw_img_decoded;
     52     draw_sw_ctx->base_draw.draw_line = lv_draw_sw_line;
     53     draw_sw_ctx->base_draw.draw_polygon = lv_draw_sw_polygon;
     54     draw_sw_ctx->base_draw.wait_for_finish = lv_draw_sw_wait_for_finish;
     55     draw_sw_ctx->base_draw.buffer_copy = lv_draw_sw_buffer_copy;
     56     draw_sw_ctx->blend = lv_draw_sw_blend_basic;
     57 }
     58 
     59 void lv_draw_sw_deinit_ctx(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
     60 {
     61     LV_UNUSED(drv);
     62 
     63     lv_draw_sw_ctx_t * draw_sw_ctx = (lv_draw_sw_ctx_t *) draw_ctx;
     64     lv_memset_00(draw_sw_ctx, sizeof(lv_draw_sw_ctx_t));
     65 }
     66 
     67 void lv_draw_sw_wait_for_finish(lv_draw_ctx_t * draw_ctx)
     68 {
     69     LV_UNUSED(draw_ctx);
     70     /*Nothing to wait for*/
     71 }
     72 
     73 void lv_draw_sw_buffer_copy(lv_draw_ctx_t * draw_ctx,
     74                             void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
     75                             void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area)
     76 {
     77     LV_UNUSED(draw_ctx);
     78 
     79     lv_color_t * dest_bufc =  dest_buf;
     80     lv_color_t * src_bufc =  src_buf;
     81 
     82     /*Got the first pixel of each buffer*/
     83     dest_bufc += dest_stride * dest_area->y1;
     84     dest_bufc += dest_area->x1;
     85 
     86     src_bufc += src_stride * src_area->y1;
     87     src_bufc += src_area->x1;
     88 
     89     uint32_t line_length = lv_area_get_width(dest_area) * sizeof(lv_color_t);
     90     lv_coord_t y;
     91     for(y = dest_area->y1; y <= dest_area->y2; y++) {
     92         lv_memcpy(dest_bufc, src_bufc, line_length);
     93         dest_bufc += dest_stride;
     94         src_bufc += src_stride;
     95     }
     96 
     97 }
     98 
     99 /**********************
    100  *   STATIC FUNCTIONS
    101  **********************/