完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
RK3288-5.1 recovery界面可旋转:
//device/rockchip/common diff --git a/BoardConfig.mk b/BoardConfig.mk index ee03d11..7862661 100644 --- a/BoardConfig.mk +++ b /BoardConfig.mk @@ -156,6 +156,18 @@ TARGET_ROCHCHIP_RECOVERY ?= true # 在恢复中翻转屏幕 BOARD_HAS_FLIPPED_SCREEN ?= false +#rotate screen to 0, 90, 180, 270 +#0: rotate_0 +#90 : rotate_90 +#180: rotate_180 +#270: rotate_270 +ROTATE_SCREEN := rotate_180 + +#Screen to Double, Single +YES: Screen to Double +#NO: Screen to single +DOUBLE_SCREEN := NO + # 从USB自动更新包 RECOVERY_AUTO_USB_UPDATE ?= false //bootable/recovery diff --git a/minui/Android.mk b/minui/Android.mk index 3d27f38..b34ee80 100755 --- a/minui/Android.mk +++ b/minui/ Android.mk @@ -12,6 +12,27 @@ LOCAL_WHOLE_STATIC_LIBRARIES += libadf LOCAL_MODULE := libminui +#rotate screen to 0, 90, 180, 270 +#0: rotate_0 +#90: rotate_90 +#180: rotate_180 +#270: rotate_270 +ifeq ($(strip $(ROTATE_SCREEN)), rotate_0) + LOCAL_CFLAGS += -DRotateScreen_0 +endif +ifeq ($(strip $(ROTATE_SCREEN)), rotate_90) + LOCAL_CFLAGS += -DRotateScreen_90 +endif + ifeq ($(strip $(ROTATE_SCREEN)), rotate_180) + LOCAL_CFLAGS += -DRotateScreen_180 +endif +ifeq ($(strip $(ROTATE_SCREEN)), rotate_270) + LOCAL_CFLAGS += -DRotateScreen_270 +endif + +ifeq ($(strip $(DOUBLE_SCREEN)),YES) + LOCAL_CFLAGS += - DScreenToDouble +endif # 这用于与双引号中的值进行比较( 在此上下文中只是 # 普通字符)。从 # 值中去掉双引号, 这样任何一个都可以工作。 diff --git a/minui/graphics.cb/minui/graphics.c 索引 34fb518..ab888d4 100644 --- a/minui/graphics.c +++ b/minui/graphics.c @@ -53,12 + 53,15 @@ 静态无符号字符 gr_current_r = 255; 静态无符号字符 gr_current_g = 255; 静态无符号字符 gr_current_b = 255; 静态无符号字符 gr_current_a = 255; +unsigned int gr_get_row_bytes(GRSurface* 表面); +unsigned int gr_get_draw_width(GRSurface* 表面); +unsigned int gr_get_draw_height(GRSurface* 表面); 静态 GRSurface* gr_draw = NULL; 静态布尔外部(int x,int y) { - 返回 x 《 0 || x 》= gr_draw-》宽度 || y 《 0 || y 》= gr_draw-》 高度; + 返回 x 《 0 || x 》= gr_get_draw_width(gr_draw) || y 《 0 || y 》= gr_get_draw_height(gr_draw); } int gr_measure(const char *s) @@ -122,17 +125,21 @@ void gr_text(int x, int y, const char *s, int bold) while((off = *s++)) { off - = 32; if (outside(x, y) || outside(x+font-》cwidth-1, y+font-》cheight-1)) 中断; - if (off 《 96) { +#ifdef ScreenToDouble + if((x+16) 》 gr_fb_width()/2 || outside(x+gr_fb_width()/2, y)){ + break; + } +#endif unsigned char* src_p = font-》texture-》data + (off * font-》cwidth) + (bold ? font-》cheight * font-》texture-》row_bytes : 0); - 无符号字符* dst_p = gr_draw-》data + y*gr_draw-》row_bytes + x*gr_draw-》pixel_bytes; - - text_blend(src_p, font-》texture-》row_bytes, - dst_p, gr_draw-》row_bytes, - font-》cwidth, font-》cheight); + 无符号字符* dst_p = gr_draw-》data + y*gr_get_row_bytes(gr_draw) + x*gr_draw-》pixel_bytes; - } + text_blend(src_p, font-》texture-》row_bytes,dst_p, gr_get_row_bytes(gr_draw),font-》cwidth, font-》cheight); + #ifdef ScreenToDouble + dst_p = gr_draw-》data + y*gr_get_row_bytes(gr_draw) + (x+gr_fb_width()/2)*gr_draw-》pixel_bytes; + text_blend(src_p, font-》texture-》row_bytes,dst_p, gr_get_row_bytes(gr_draw),font-》cwidth, font-》cheight); + #endif x += 字体-》cwidth; } } @@ -144,18 +151,33 @@ void gr_texticon(int x, int y, GRSurface* icon) { printf(“gr_texticon: source has wrong formatn”); 返回; - +#ifdef ScreenToDouble + int textWidth = gr_get_width(icon); + int textHeight = gr_get_height(icon); + x = (gr_fb_width()/2-textWidth)/2; +#endif x += overscan_offset_x; y += overscan_offset_y; if (outside(x, y) || outside(x+icon-》width-1, y+icon-》height-1)) 返回; +#ifdef ScreenToDouble + if(x 》 gr_fb_width()/2){ + return; + } +#endif unsigned char* src_p = icon-》data; - 无符号字符* dst_p = gr_draw-》data + y*gr_draw-》row_bytes + x*gr_draw-》pixel_bytes; + 无符号字符* dst_p = gr_draw-》data + y*gr_get_row_bytes(gr_draw) + x*gr_draw-》pixel_bytes; text_blend(src_p, icon-》row_bytes, - dst_p, gr_draw-》row_bytes, + dst_p, gr_get_row_bytes(gr_draw), + icon-》width, icon-》height); +#ifdef ScreenToDouble + dst_p = gr_draw-》data + y*gr_get_row_bytes(gr_draw) + (x+gr_fb_width()/2)*gr_draw-》pixel_bytes; + text_blend(src_p, icon-》row_bytes, + dst_p, gr_get_row_bytes(gr_draw), icon- 》width, icon-》height); +#endif } void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) @@ -196,7 +218,7 @@ void gr_fill(int x1, int y1, int x2, int y2) 如果(外部(x1,y1)|| 外部(x2-1,y2-1))返回; - 无符号字符* p = gr_draw-》data + y1 * gr_draw-》row_bytes + x1 * gr_draw-》pixel_bytes; + 无符号字符* p = gr_draw-》data + y1 * gr_get_row_bytes(gr_draw) + x1 * gr_draw-》pixel_bytes; if (gr_current_a == 255) { int x, y; for (y = y1; y 《 y2; ++y) { @@ -207,7 +229,7 @@ void gr_fill(int x1, int y1, int x2, int y2) *px++ = gr_current_b; 像素++; } - p += gr_draw-》row_bytes; + p += gr_get_row_bytes(gr_draw); } } else if (gr_current_a 》 0) { int x, y; @@ -222,7 +244,7 @@ void gr_fill(int x1, int y1, int x2, int y2) ++px; ++像素; } - p += gr_draw-》row_bytes; + p += gr_get_row_bytes(gr_draw); } } } @@ -234,23 +256,66 @@ void gr_blit(GRSurface* source, int sx, int sy, int w, int h, int dx, int dy) { printf(“gr_blit: 源格式错误n”); 返回; } - +#ifdef ScreenToDouble + //重新定义x + int pos = dx-(gr_fb_width()-w)/2; + dx = (gr_fb_width()/2 - w) / 2 + 位置; +#endif dx += overscan_offset_x; dy += overscan_offset_y; - if (outside(dx, dy) || outside(dx+w-1, dy+h-1)) 返回; + while (outside(dx, dy) || outside(dx+w-1, dy+h-1)){ + return ; + w = w - 4; + if(outside(dx, dy)){ + return ; + } + } unsigned char* src_p = source-》data + sy*source-》row_bytes + sx*source-》pixel_bytes; - 无符号字符* dst_p = gr_draw-》data + dy*gr_draw-》row_bytes + dx*gr_draw-》pixel_bytes; + 无符号字符* dst_p = gr_draw-》data + dy*gr_get_row_bytes(gr_draw) + dx*gr_draw-》pixel_bytes; 诠释我; for (i = 0; i 《 h; ++i) { memcpy(dst_p, src_p, w * source-》pixel_bytes); src_p += source-》row_bytes; -dst_p += gr_draw-》row_bytes; + } +#ifdef ScreenToDouble + src_p = source-》data + sy*source-》row_bytes + sx*source-》pixel_bytes; + dst_p = gr_draw-》data + dy*gr_get_row_bytes(gr_draw) + (dx+gr_fb_width()/2)*gr_draw-》pixel_bytes; + for (i = 0; i 《 h; ++i) { + memcpy(dst_p, src_p, w * source-》pixel_bytes); + src_p += 源-》row_bytes; + dst_p += gr_get_row_bytes(gr_draw); } +#endif +} +unsigned int gr_get_row_bytes(GRSurface*surface){ + if(surface == NULL){ + return 0; + } + 返回 gr_get_draw_width(surface) * 4; +} +unsigned int gr_get_draw_width(GRSurface*surface) { + if (surface == NULL) { + 返回 0; + } +#if (定义 RotateScreen_90) || (定义RotateScreen_270) +返回表面-》高度; +#endif + 返回表面-》宽度; } +unsigned int gr_get_draw_height(GRSurface*surface) { + if (surface == NULL) { + return 0; + } +#if (定义 RotateScreen_90) || (定义RotateScreen_270) +返回表面-》宽度; +#endif + 返回表面-》高度; +} unsigned int gr_get_width(GRSurface* surface) { if (surface == NULL) { return 0; @@ -357,7 +422,17 @@ static void gr_test() { } } #endif +/撤销旋转 +void back_no_rotate(){ +#ifdef RotateScreen_90 + rk_rotate_surface_270_same(gr_draw); +#elif 定义 RotateScreen_180 + rk_rotate_surface_180(gr_draw); +#elif 定义 RotateScreen_270 + rk_rotate_surface_90_same(gr_draw); +#endif +} void gr_flip() { gr_draw = gr_backend-》flip(gr_backend); } @@ -393,8 +468,8 @@ int gr_init(void) } } - overscan_offset_x = gr_draw-》width * overscan_percent / 100; - overscan_offset_y = gr_draw-》height * overscan_percent / 100; + overscan_offset_x = gr_get_draw_width(gr_draw) * overscan_percent / 100; + overscan_offset_y = gr_get_draw_height(gr_draw) * overscan_percent / 100; gr_flip(); gr_flip(); @@ -413,12 +488,12 @@ void gr_exit(void) int gr_fb_width(void) { - return gr_draw-》width - 2*overscan_offset_x; + 返回 (gr_get_draw_width(gr_draw) - 2*overscan_offset_x); } int gr_fb_height(void) { - 返回 gr_draw-》height - 2*overscan_offset_y; + 返回 (gr_get_draw_height(gr_draw) - 2*overscan_offset_y); } void gr_fb_blank(bool blank) diff --git a/minui/graphics.hb/minui/graphics.h index 993e986..97ee9c1 100644 --- a/minui/graphics.h +++ b/minui/graphics.h @@ -39,10 +39,14 @@ typedef struct minui_backend { // 绘制完成时设备清理。 void (*exit)(struct minui_backend*); } minui_backend; - +void rk_rotate_surface_180(GRSurface* 表面); +void rk_rotate_surface_90_same(GRSurface* 表面); +void rk_rotate_surface_90_diff(GRSurface* 表面); +void rk_rotate_surface_270_same(GRSurface* 表面); +void rk_rotate_surface_270_diff(GRSurface* 表面); minui_backend* open_fbdev(); minui_backend* open_adf(); - +minui_backend* open_drm(); #ifdef __cplusplus } #endif diff --git a/minui/graphics_fbdev.cb/minui/graphics_fbdev.c index cfd4330..c698691 100755 --- a/minui/graphics_fbdev.c +++ b/minui/graphics_fbdev.c @@ -78,7 +78,65 @@ void rk_rotate_surface_180(GRSurface* 表面) } |
|
|
|
+void rk_rotate_surface_90(GRSurface* 表面, GGLuint 宽度, GGLuint height){
+ //GGLuint width = surface-》height; + //GGLuint 高度 = 表面-》宽度; + 整数字节 = 4;// ARGB_8888 为 4 字节(RGB_565 为 2 字节) + int 长度 = 宽度 * 高度; + GGLubyte* des_data = (GGLubyte *)malloc(sizeof(GGLubyte)*length*byte); + memset(des_data, 0, sizeof(GGLubyte)*length*byte); + memcpy(des_data,表面-》数据,sizeof(GGLubyte)*长度字节); + + int i, j; + 整数 n1, n2; + for(i = 0; i 《 高度; i++){ + for(j = 0; j 《 宽度; j++){ + n1 = j*height+height-i-1; + n2 = i*宽度+j; +表面-》数据[n1*字节] = des_data[n2*字节]; +表面-》数据[n1*字节+1] = des_data[n2*字节+1]; + 表面-》数据[n1*字节+2] = des_data[n2*字节+2]; +表面-》数据[n1*字节+3] = des_data[n2*字节+3]; + } + } + 免费(des_data); +} + +void rk_rotate_surface_270(GRSurface* surface, GGLuint width, GGLuint height){ + //GGLuint width = surface-》width; + //GGLuint 高度 = 表面-》高度; + 整数字节 = 4;// ARGB_8888 为 4 字节(RGB_565 为 2 字节) + int 长度 = 宽度 * 高度; + GGLubyte* des_data = (GGLubyte *)malloc(sizeof(GGLubyte)*length*byte); + memcpy(des_data,表面-》数据,sizeof(GGLubyte)*长度字节); + memset(surface-》data, 0, sizeof(GGLubyte)*length*byte); + 整数 i, j; + 整数 n1, n2; + for(i = 0; i 《 height; i++){ + for(j = 0; j 《 width; j++){ + n1 = (width-j-1)*height+i; + n2 = i*宽度+j; +表面-》数据[n1*字节] = des_data[n2*字节]; +表面-》数据[n1*字节+1] = des_data[n2*字节+1]; + 表面-》数据[n1*字节+2] = des_data[n2*字节+2]; +表面-》数据[n1*字节+3] = des_data[n2*字节+3]; + } + } + 免费(des_data); +} +void rk_rotate_surface_270_same(GRSurface*surface){ + rk_rotate_surface_270(surface, surface-》width,surface-》height); +} +void rk_rotate_surface_270_diff(GRSurface*surface){ + rk_rotate_surface_270(surface, surface-》height,surface-》width); +} +void rk_rotate_surface_90_same(GRSurface*surface){ + rk_rotate_surface_90(surface, surface-》width,surface-》height); +} +void rk_rotate_surface_90_diff(GRSurface*surface){ + rk_rotate_surface_90(surface, surface-》height,surface-》width); +} minui_backend* open_fbdev() { return &my_backend; } @@ -244,6 +302,15 @@ static gr_surface fbdev_flip(minui_backend* backend __unused) { #ifdef BOARD_HAS_FLIPPED_SCREEN rk_rotate_surface_180( &gr_framebuffer[1-displayed_buffer]); #endif + #ifdef RotateScreen_90 + rk_rotate_surface_90_diff(&gr_framebuffer[1-displayed_buffer]); + #endif + #ifdef RotateScreen_180 + rk_rotate_surface_180(&gr_framebuffer[1-displayed_buffer]); + #endif + #ifdef RotateScreen_270 + rk_rotate_surface_270_diff(&gr_framebuffer[1-displayed_buffer]); + #endif set_displayed_framebuffer(1-displayed_buffer); } else { // 从内存中的表面复制到帧缓冲区。 差异 --git a/minui/minui.hb/minui/minui.h 索引 08fba7f..1e1a7c8 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -59,8 +59,11 @@ void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy); 无符号整数 gr_get_width(gr_surface 表面); 无符号整数 gr_get_height(gr_surface 表面); -// 输入事件结构,包括 《linux/input.h》 用于定义。 -// +void back_no_rotate(); +// +// 输入事件。 +// + 结构输入事件; typedef int (*ev_callback)(int fd, uint32_t epevents, void *data); 差异 --git a/screen_ui.cpp b/screen_ui.cpp 索引 03ef049..f6845eb 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -260,16 +260,16 @@ void ScreenRecoveryUI::draw_screen_locked() // 重绘屏幕上的所有内容并翻转屏幕(使其可见)。 // 只能在 updateMutex 锁定的情况下调用。 -void ScreenRecoveryUI::update_screen_locked() -{ +void ScreenRecoveryUI::update_screen_locked() { + back_no_rotate(); draw_screen_locked(); gr_flip(); } // 如果可能,只更新进度条,否则重绘屏幕。 // 只能在 updateMutex 锁定的情况下调用。 -void ScreenRecoveryUI::update_progress_locked() -{ +void ScreenRecoveryUI::update_progress_locked() { + back_no_rotate(); if (show_text || !pagesIdentical) { draw_screen_locked(); // 必须重绘整个屏幕 pagesIdentical = true; |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1924 浏览 1 评论
synopsys 的design ware:DW_fpv_div,浮点数除法器,默认32位下,想提升覆盖率(TMAX),如果用功能case去提升覆盖率呢?
2406 浏览 1 评论
RK3588 GStreamer调试四路鱼眼摄像头四宫格显示报错
5193 浏览 1 评论
【飞凌嵌入式OK3576-C开发板体验】RKNN神经网络-YOLO图像识别
254 浏览 0 评论
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
1336 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 23:08 , Processed in 0.576691 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号