Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering tweaks #39

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libs/nxdk
Submodule nxdk updated 1 files
+6 −6 lib/pbkit/pbkit.c
2 changes: 1 addition & 1 deletion src/lvgl_drivers/video/xgu/lv_xgu_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ uint32_t *p;

static void end_frame()
{
pb_end(p);
while (pb_finished());
}

Expand All @@ -28,6 +27,7 @@ static void begin_frame()
p = pb_begin();
p = xgu_set_color_clear_value(p, 0xff000000);
p = xgu_clear_surface(p, XGU_CLEAR_Z | XGU_CLEAR_STENCIL | XGU_CLEAR_COLOR);
pb_end(p);
}

void lvgl_getlock(void);
Expand Down
4 changes: 4 additions & 0 deletions src/lvgl_drivers/video/xgu/lv_xgu_rect.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ void xgu_draw_rect(lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *dsc, const
return;
}

p = pb_begin();

if (xgu_ctx->xgu_data->combiner_mode != 0)
{
#include "lvgl_drivers/video/xgu/notexture.inl"
Expand Down Expand Up @@ -174,6 +176,8 @@ void xgu_draw_rect(lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *dsc, const

rect_draw_image(&draw_area, dsc);
rect_draw_border(&draw_area, dsc);

pb_end(p);
}

void xgu_draw_bg(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *draw_dsc, const lv_area_t *src_area)
Expand Down
18 changes: 12 additions & 6 deletions src/lvgl_drivers/video/xgu/lv_xgu_texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,6 @@ void xgu_draw_letter(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_label_dsc_t
return;
}

if (xgu_ctx->xgu_data->combiner_mode != 1)
{
#include "lvgl_drivers/video/xgu/texture.inl"
xgu_ctx->xgu_data->combiner_mode = 1;
}

lv_lru_get(xgu_ctx->xgu_data->texture_cache, &bmp, sizeof(bmp), (void **)&texture);
if (texture == NULL)
{
Expand All @@ -229,12 +223,21 @@ void xgu_draw_letter(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_label_dsc_t
}
}

p = pb_begin();

if (xgu_ctx->xgu_data->combiner_mode != 1)
{
#include "lvgl_drivers/video/xgu/texture.inl"
xgu_ctx->xgu_data->combiner_mode = 1;
}

p = xgux_set_color4ub(p, dsc->color.ch.red, dsc->color.ch.green,
dsc->color.ch.blue, dsc->opa);

bind_texture(xgu_ctx, texture, (uint32_t)bmp, XGU_TEXTURE_FILTER_LINEAR);

map_textured_rect(texture, &letter_area, &draw_area, 256.0f);
pb_end(p);
}

lv_res_t xgu_draw_img(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc_t *dsc,
Expand Down Expand Up @@ -297,6 +300,7 @@ void xgu_draw_img_decoded(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc

lv_color_t recolor = lv_color_make(255, 255, 255);

p = pb_begin();
// If we are about the draw 1 bit indexed image. Setup draw color froms src_buf;
if (cf == LV_IMG_CF_INDEXED_1BIT)
{
Expand Down Expand Up @@ -381,6 +385,7 @@ void xgu_draw_img_decoded(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc
}
if (texture == NULL)
{
pb_end(p);
return;
}
}
Expand All @@ -399,4 +404,5 @@ void xgu_draw_img_decoded(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc
(dsc->antialias) ? XGU_TEXTURE_FILTER_LINEAR : XGU_TEXTURE_FILTER_NEAREST);

map_textured_rect(texture, &src_area_transformed, &draw_area, (float)dsc->zoom);
pb_end(p);
}
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,16 @@ int main(int argc, char* argv[]) {
lvgl_getlock();
lv_task_handler();
lvgl_removelock();
#ifdef NXDK
pb_wait_for_vbl();
#else
e = SDL_GetTicks();
t = e - s;
if (t < LV_DISP_DEF_REFR_PERIOD)
{
SDL_Delay(LV_DISP_DEF_REFR_PERIOD - t);
}
#endif
}
dash_printf(LEVEL_TRACE, "Quitting dash with quit event %d\n", lv_get_quit());
lv_port_disp_deinit();
Expand Down