mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-27 20:57:01 +08:00
fix(drm/egl): red and blue channel swap with RGB565 (#9461)
This commit is contained in:
@@ -248,7 +248,12 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_m
|
||||
#error("Unsupported color format")
|
||||
#endif
|
||||
|
||||
lv_opengles_render_display_texture(disp, false, false);
|
||||
lv_opengles_render_params_t params = {
|
||||
.h_flip = false,
|
||||
.v_flip = false,
|
||||
.rb_swap = LV_COLOR_DEPTH == 32,
|
||||
};
|
||||
lv_opengles_render_display(disp, ¶ms);
|
||||
lv_opengles_egl_update(ctx->egl_ctx);
|
||||
}
|
||||
lv_display_flush_ready(disp);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "lv_opengles_debug.h"
|
||||
#include "lv_opengles_private.h"
|
||||
|
||||
#include "../../display/lv_display.h"
|
||||
#include "../../display/lv_display_private.h"
|
||||
#include "../../misc/lv_area_private.h"
|
||||
#include "opengl_shader/lv_opengl_shader_internal.h"
|
||||
#include "assets/lv_opengles_shader.h"
|
||||
@@ -166,7 +166,8 @@ void lv_opengles_render_fill(lv_color_t color, const lv_area_t * area, lv_opa_t
|
||||
lv_opengles_render(0, area, opa, disp_w, disp_h, area, false, false, color, false, true);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
void lv_opengles_render_display_texture(lv_display_t * display, bool h_flip, bool v_flip)
|
||||
|
||||
void lv_opengles_render_display(lv_display_t * display, const lv_opengles_render_params_t * params)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
unsigned int texture = *(unsigned int *)lv_display_get_driver_data(display);
|
||||
@@ -174,6 +175,8 @@ void lv_opengles_render_display_texture(lv_display_t * display, bool h_flip, boo
|
||||
GL_CALL(glBindTexture(GL_TEXTURE_2D, texture));
|
||||
|
||||
lv_display_rotation_t rotation = lv_display_get_rotation(display);
|
||||
bool h_flip = params->h_flip;
|
||||
bool v_flip = params->v_flip;
|
||||
|
||||
float vert_buffer[LV_OPENGLES_VERTEX_BUFFER_LEN];
|
||||
populate_vertex_buffer(vert_buffer, rotation, &h_flip, &v_flip, 0.f, 0.f, 1.f, 1.f);
|
||||
@@ -199,12 +202,24 @@ void lv_opengles_render_display_texture(lv_display_t * display, bool h_flip, boo
|
||||
lv_opengles_shader_set_uniform1f("u_Opa", 1);
|
||||
lv_opengles_shader_set_uniform1i("u_IsFill", 0);
|
||||
lv_opengles_shader_set_uniform3f("u_FillColor", 1.0f, 1.0f, 1.0f);
|
||||
lv_opengles_shader_set_uniform1i("u_SwapRB", 1);
|
||||
lv_opengles_shader_set_uniform1i("u_SwapRB", params->rb_swap);
|
||||
|
||||
lv_opengles_render_draw();
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_opengles_render_display_texture(lv_display_t * display, bool h_flip, bool v_flip)
|
||||
{
|
||||
/*TODO: Deprecate this function and make lv_opengles_render_display public instead*/
|
||||
|
||||
lv_opengles_render_params_t params = {
|
||||
.v_flip = v_flip,
|
||||
.h_flip = h_flip,
|
||||
.rb_swap = true
|
||||
};
|
||||
lv_opengles_render_display(display, ¶ms);
|
||||
}
|
||||
|
||||
void lv_opengles_render_clear(void)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
@@ -105,6 +105,12 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
bool h_flip;
|
||||
bool v_flip;
|
||||
bool rb_swap;
|
||||
} lv_opengles_render_params_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -137,6 +143,7 @@ void lv_opengles_render_texture_rbswap(unsigned int texture, const lv_area_t * t
|
||||
*/
|
||||
void lv_opengles_regular_viewport(int32_t x, int32_t y, int32_t w, int32_t h);
|
||||
|
||||
void lv_opengles_render_display(lv_display_t * display, const lv_opengles_render_params_t * params);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
Reference in New Issue
Block a user