Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92
解决方法:
device/rockchip/common/BoardConfig.mk:
#rotate screen to 0, 90, 180, 270
#0: rotate_0
#90: rotate_90
#180: rotate_180
#270: rotate_270
ROTATE_SCREEN := rotate_180
调用过程:
bootable/recovery/minui/Android.mk:
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
bootable/recovery/minui/graphics_fbdev.cpp
static GRSurface* fbdev_flip(minui_backend* backend __unused) {
......
#ifdef RotateScreen_90
rk_rotate_surface_90(&gr_framebuffer[1-displayed_buffer], gr_framebuffer[1-displayed_buffer].height, gr_framebuffer[1-displayed_buffer].width);
#elif defined RotateScreen_180
rk_rotate_surface_180(&gr_framebuffer[1-displayed_buffer]);
#elif defined RotateScreen_270
rk_rotate_surface_270(&gr_framebuffer[1-displayed_buffer], gr_framebuffer[1-displayed_buffer].height, gr_framebuffer[1-displayed_buffer].width);
#endif
......
}
void rk_rotate_surface_180(GRSurface* surface)
{
GGLuint width = surface->width;
GGLuint height = surface->height;
int byt = 4; // 4 byte for ARGB_8888 (2 byte for RGB_565)
int length = width * height;
GGLubyte* des_data = (GGLubyte *)malloc(sizeof(GGLubyte)*length*byt);
memcpy(des_data,surface->data,sizeof(GGLubyte)*length*byt);
memset(surface->data, 0, sizeof(GGLubyte)*length*byt);
int i = 0;
for (i=0; i
{
surface->data[i*byt] = des_data[(length-i-1)*byt];
surface->data[i*byt+1] = des_data[(length-i-1)*byt+1];
surface->data[i*byt+2] = des_data[(length-i-1)*byt+2];
surface->data[i*byt+3] = des_data[(length-i-1)*byt+3];
}
free(des_data);
}
Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92
解决方法:
device/rockchip/common/BoardConfig.mk:
#rotate screen to 0, 90, 180, 270
#0: rotate_0
#90: rotate_90
#180: rotate_180
#270: rotate_270
ROTATE_SCREEN := rotate_180
调用过程:
bootable/recovery/minui/Android.mk:
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
bootable/recovery/minui/graphics_fbdev.cpp
static GRSurface* fbdev_flip(minui_backend* backend __unused) {
......
#ifdef RotateScreen_90
rk_rotate_surface_90(&gr_framebuffer[1-displayed_buffer], gr_framebuffer[1-displayed_buffer].height, gr_framebuffer[1-displayed_buffer].width);
#elif defined RotateScreen_180
rk_rotate_surface_180(&gr_framebuffer[1-displayed_buffer]);
#elif defined RotateScreen_270
rk_rotate_surface_270(&gr_framebuffer[1-displayed_buffer], gr_framebuffer[1-displayed_buffer].height, gr_framebuffer[1-displayed_buffer].width);
#endif
......
}
void rk_rotate_surface_180(GRSurface* surface)
{
GGLuint width = surface->width;
GGLuint height = surface->height;
int byt = 4; // 4 byte for ARGB_8888 (2 byte for RGB_565)
int length = width * height;
GGLubyte* des_data = (GGLubyte *)malloc(sizeof(GGLubyte)*length*byt);
memcpy(des_data,surface->data,sizeof(GGLubyte)*length*byt);
memset(surface->data, 0, sizeof(GGLubyte)*length*byt);
int i = 0;
for (i=0; i
{
surface->data[i*byt] = des_data[(length-i-1)*byt];
surface->data[i*byt+1] = des_data[(length-i-1)*byt+1];
surface->data[i*byt+2] = des_data[(length-i-1)*byt+2];
surface->data[i*byt+3] = des_data[(length-i-1)*byt+3];
}
free(des_data);
}
举报