mirror of
https://github.com/azure-rtos/guix.git
synced 2025-01-14 06:43:20 +08:00
update to v6.1.3
This commit is contained in:
parent
0fff730b8a
commit
4dfb8c3da4
@ -126,6 +126,17 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_simple_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_vertical_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_vertical_pattern_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_block_move.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_canvas_copy.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_horizontal_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_horizontal_pattern_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_pixel_write.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_pixelmap_blend.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_pixelmap_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_pixelmap_rotate.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_simple_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_vertical_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_16bpp_rotated_vertical_pattern_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_1bpp_block_move.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_1bpp_canvas_copy.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_1bpp_glyph_1bpp_draw.c
|
||||
@ -207,6 +218,13 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_pixel_blend.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_png_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_setup.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_canvas_blend.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_glyph_1bit_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_horizontal_pixelmap_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_pixel_blend.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_jpeg_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_png_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_setup.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bit_palette_native_color_get.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bit_palette_setup.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_block_move.c
|
||||
@ -239,6 +257,8 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_aliased_wide_ellipse_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_aliased_wide_line_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_alphamap_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_glyph_4bit_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_glyph_8bit_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_arc_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_arc_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_circle_draw.c
|
||||
@ -264,6 +284,13 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_wide_ellipse_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_wide_line_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_wide_line_points_calculate.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_alphamap_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_arc_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_circle_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_ellipse_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_pie_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_polygon_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_rotated_wide_line_fill.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_horizontal_line_alpha_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_monochrome_setup.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_simple_line_alpha_draw.c
|
||||
@ -326,6 +353,7 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_line_chart_y_scale_calculate.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_menu_create.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_menu_draw.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_menu_event_process.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_menu_insert.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_menu_position.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_menu_remove.c
|
||||
@ -685,6 +713,7 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_bidi_character_type_get.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_bidi_mirroring_get.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_bidi_paragraph_reorder.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_bidi_resolved_text_info_delete.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_canvas_to_bmp.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_circle_point_get.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_utility_easing_function_calculate.c
|
||||
@ -939,6 +968,7 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_line_chart_update.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_line_chart_y_scale_calculate.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_menu_create.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_menu_event_process.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_menu_insert.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_menu_remove.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_menu_text_offset_set.c
|
||||
@ -1134,6 +1164,8 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_tree_view_root_pixelmap_set.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_tree_view_selected_get.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_tree_view_selected_set.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_utility_bidi_paragraph_reorder.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_utility_bidi_resolved_text_info_delete.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_utility_canvas_to_bmp.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_utility_circle_point_get.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/gxe_utility_gradient_create.c
|
||||
|
@ -24,7 +24,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_api.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -48,6 +48,11 @@
|
||||
/* modified controls blocks, */
|
||||
/* added new APIs, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* declare new APIs, */
|
||||
/* defined new status, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -71,7 +76,7 @@ extern "C" {
|
||||
#define AZURE_RTOS_GUIX
|
||||
#define GUIX_MAJOR_VERSION 6
|
||||
#define GUIX_MINOR_VERSION 1
|
||||
#define GUIX_PATCH_VERSION 0
|
||||
#define GUIX_PATCH_VERSION 3
|
||||
|
||||
/* The following symbols are defined for backward compatibility reasons.*/
|
||||
#define __PRODUCT_GUIX__
|
||||
@ -278,6 +283,10 @@ typedef struct GX_STRING_STRUCT
|
||||
|
||||
#define GX_MAX_PIXELMAP_RESOLUTION 0x3FFF
|
||||
|
||||
/* Define screen rotation types. */
|
||||
#define GX_SCREEN_ROTATION_CW 90
|
||||
#define GX_SCREEN_ROTATION_CCW 270
|
||||
|
||||
/* API input parameters and general constants. */
|
||||
|
||||
#define GX_TRUE 1
|
||||
@ -685,6 +694,7 @@ typedef struct GX_STRING_STRUCT
|
||||
|
||||
#define GX_STATUS_MODAL 0x00100000UL
|
||||
|
||||
#define GX_STATUS_DYNAMIC_BUFFER 0x01000000UL
|
||||
#define GX_STATUS_LINE_BREAK_PROCESSED 0x02000000UL
|
||||
#define GX_STATUS_RESIZE_NOTIFY 0x04000000UL
|
||||
#define GX_STATUS_STUDIO_CREATED 0x08000000UL
|
||||
@ -1008,13 +1018,6 @@ typedef GX_UBYTE GX_CHAR_CODE;
|
||||
#endif
|
||||
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
typedef struct GX_BIDI_RESOLVED_TEXT_INFO_STRUCT
|
||||
{
|
||||
GX_STRING *gx_bidi_resolved_text_info_text;
|
||||
UINT gx_bidi_resolved_text_info_total_lines;
|
||||
struct GX_BIDI_RESOLVED_TEXT_INFO_STRUCT *gx_bidi_resolved_text_info_next;
|
||||
} GX_BIDI_RESOLVED_TEXT_INFO;
|
||||
|
||||
#define GX_PROMPT_BIDI_RESOLVED_TEXT_INFO GX_BIDI_RESOLVED_TEXT_INFO *gx_prompt_bidi_resolved_text_info;
|
||||
#define GX_TEXT_BUTTON_BIDI_RESOLVED_TEXT_INFO GX_BIDI_RESOLVED_TEXT_INFO *gx_text_button_bidi_resolved_text_info;
|
||||
#define GX_MULTI_LINE_TEXT_VIEW_BIDI_RESOLVED_TEXT_INFO GX_BIDI_RESOLVED_TEXT_INFO *gx_multi_line_text_view_bidi_resolved_text_info;
|
||||
@ -1128,16 +1131,18 @@ typedef struct GX_FONT_STRUCT
|
||||
GX_CONST struct GX_FONT_STRUCT *gx_font_next_page; /* For multiple page fonts (Unicode) */
|
||||
} GX_FONT;
|
||||
|
||||
#define GX_FONT_FORMAT_BPP_MASK 0x0F
|
||||
#define GX_FONT_FORMAT_1BPP 0x01
|
||||
#define GX_FONT_FORMAT_2BPP 0x02
|
||||
#define GX_FONT_FORMAT_4BPP 0x04
|
||||
#define GX_FONT_FORMAT_8BPP 0x08
|
||||
#define GX_FONT_FORMAT_BPP_MASK 0x03
|
||||
#define GX_FONT_FORMAT_1BPP 0x00
|
||||
#define GX_FONT_FORMAT_2BPP 0x01
|
||||
#define GX_FONT_FORMAT_4BPP 0x02
|
||||
#define GX_FONT_FORMAT_8BPP 0x03
|
||||
|
||||
#define GX_FONT_FORMAT_COMPRESSED 0x10
|
||||
#define GX_FONT_FORMAT_FREETYPE 0x20
|
||||
#define GX_FONT_FORMAT_KERNING 0x40
|
||||
#define GX_FONT_FORMAT_REVERSED_ORDER 0x80 /* For 4bpp font, half bytes order reversed. For 1bpp font, bits order reversed with least signigicant bit in left. */
|
||||
#define GX_FONT_FORMAT_ROTATED_90 0x04
|
||||
#define GX_FONT_FORMAT_ROTATED_270 0x08
|
||||
|
||||
/* Define Pixelmap type. */
|
||||
|
||||
@ -1167,10 +1172,28 @@ typedef struct GX_PIXELMAP_STRUCT
|
||||
#if defined(GX_USE_SYNERGY_DRW)
|
||||
#define GX_PIXELMAP_DYNAMICALLY_ALLOCATED 0x20 /* Pixelmap is dynamically allocated */
|
||||
#endif
|
||||
#define GX_PIXELMAP_ROTATED_90 0x40
|
||||
#define GX_PIXELMAP_ROTATED_270 0x80
|
||||
|
||||
#define PIXELMAP_IS_TRANSPARENT(a) (a -> gx_pixelmap_flags & (GX_PIXELMAP_TRANSPARENT | GX_PIXELMAP_ALPHA))
|
||||
|
||||
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
typedef struct GX_BIDI_TEXT_INFO_STRUCT
|
||||
{
|
||||
GX_STRING gx_bidi_text_info_text;
|
||||
GX_FONT *gx_bidi_text_info_font;
|
||||
GX_VALUE gx_bidi_text_info_display_width;
|
||||
} GX_BIDI_TEXT_INFO;
|
||||
|
||||
typedef struct GX_BIDI_RESOLVED_TEXT_INFO_STRUCT
|
||||
{
|
||||
GX_STRING *gx_bidi_resolved_text_info_text;
|
||||
UINT gx_bidi_resolved_text_info_total_lines;
|
||||
struct GX_BIDI_RESOLVED_TEXT_INFO_STRUCT *gx_bidi_resolved_text_info_next;
|
||||
} GX_BIDI_RESOLVED_TEXT_INFO;
|
||||
#endif
|
||||
|
||||
/* Define Brush type. */
|
||||
|
||||
typedef struct GX_BRUSH_STRUCT
|
||||
@ -1498,6 +1521,7 @@ typedef struct GX_DISPLAY_STRUCT
|
||||
GX_UBYTE gx_display_active_language; /* Define the active language. */
|
||||
GX_UBYTE gx_display_language_table_size;
|
||||
GX_UBYTE gx_display_driver_ready;
|
||||
USHORT gx_display_rotation_angle;
|
||||
|
||||
GX_VALUE gx_display_width;
|
||||
GX_VALUE gx_display_height;
|
||||
@ -2734,6 +2758,8 @@ typedef struct GX_IMAGE_READER_STRUCT
|
||||
GX_UBYTE *gx_image_reader_getauxdata;
|
||||
GX_UBYTE *gx_image_reader_putdata;
|
||||
GX_UBYTE *gx_image_reader_putauxdata;
|
||||
GX_UBYTE *gx_image_reader_putdatarow;
|
||||
GX_UBYTE *gx_image_reader_putauxdatarow;
|
||||
GX_UBYTE gx_image_reader_color_format;
|
||||
GX_UBYTE gx_image_reader_mode;
|
||||
GX_UBYTE gx_image_reader_image_type;
|
||||
@ -2743,6 +2769,8 @@ typedef struct GX_IMAGE_READER_STRUCT
|
||||
GX_COLOR *gx_image_reader_palette;
|
||||
UINT gx_image_reader_palette_size;
|
||||
UINT gx_image_reader_input_stride;
|
||||
GX_BYTE gx_image_reader_putdatarow_stride;
|
||||
GX_BYTE gx_image_reader_putauxdatarow_stride;
|
||||
GX_BOOL gx_image_reader_size_testing;
|
||||
GX_COLOR *gx_image_reader_png_trans;
|
||||
GX_COLOR *gx_image_reader_png_palette;
|
||||
@ -2755,6 +2783,8 @@ typedef struct GX_IMAGE_READER_STRUCT
|
||||
#define GX_IMAGE_READER_MODE_COMPRESS 0x01
|
||||
#define GX_IMAGE_READER_MODE_ALPHA 0x02
|
||||
#define GX_IMAGE_READER_MODE_DITHER 0x04
|
||||
#define GX_IMAGE_READER_MODE_ROTATE_CW 0x10
|
||||
#define GX_IMAGE_READER_MODE_ROTATE_CCW 0x20
|
||||
|
||||
/* Define Screen stack control block */
|
||||
typedef struct GX_SCREEN_STACK_CONTROL_STRUCT
|
||||
@ -3020,6 +3050,7 @@ typedef struct GX_FIXED_POINT_STRUCT
|
||||
|
||||
#define gx_menu_create(a, b, c, d, e, f, g, h) _gx_menu_create((GX_MENU *)a, b, (GX_WIDGET *)c, d, e, f, g, h)
|
||||
#define gx_menu_draw _gx_menu_draw
|
||||
#define gx_menu_event_process _gx_menu_event_process
|
||||
#define gx_menu_insert _gx_menu_insert
|
||||
#define gx_menu_remove _gx_menu_remove
|
||||
#define gx_menu_remove _gx_menu_remove
|
||||
@ -3358,6 +3389,10 @@ typedef struct GX_FIXED_POINT_STRUCT
|
||||
#define gx_tree_view_selected_get _gx_tree_view_selected_get
|
||||
#define gx_tree_view_selected_set _gx_tree_view_selected_set
|
||||
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
#define gx_utility_bidi_paragraph_reorder _gx_utility_bidi_paragraph_reorder
|
||||
#define gx_utility_bidi_resolved_text_info_delete _gx_utility_bidi_resolved_text_info_delete
|
||||
#endif
|
||||
#define gx_utility_canvas_to_bmp _gx_utility_canvas_to_bmp
|
||||
#define gx_utility_gradient_create _gx_utility_gradient_create
|
||||
#define gx_utility_gradient_delete _gx_utility_gradient_delete
|
||||
@ -3719,6 +3754,7 @@ UINT _gx_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
|
||||
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
|
||||
ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size);
|
||||
VOID _gx_menu_draw(GX_MENU *menu);
|
||||
UINT _gx_menu_event_process(GX_MENU* menu, GX_EVENT* event_ptr);
|
||||
UINT _gx_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
|
||||
UINT _gx_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
|
||||
UINT _gx_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
|
||||
@ -4137,6 +4173,10 @@ UINT _gx_tree_view_root_pixelmap_set(GX_TREE_VIEW *tree, GX_RESOURCE_ID expand_m
|
||||
UINT _gx_tree_view_selected_get(GX_TREE_VIEW *tree, GX_WIDGET **selected);
|
||||
UINT _gx_tree_view_selected_set(GX_TREE_VIEW *tree, GX_WIDGET *selected);
|
||||
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
UINT _gx_utility_bidi_paragraph_reorder(GX_BIDI_TEXT_INFO *input_info, GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head);
|
||||
UINT _gx_utility_bidi_resolved_text_info_delete(GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head);
|
||||
#endif
|
||||
UINT _gx_utility_canvas_to_bmp(GX_CANVAS *canvas, GX_RECTANGLE *rect, UINT(*write_data)(GX_UBYTE *byte_data, UINT data_count));
|
||||
UINT _gx_utility_gradient_create(GX_GRADIENT *gradient, GX_VALUE width, GX_VALUE height, UCHAR type, GX_UBYTE start_alpha, GX_UBYTE end_alpha);
|
||||
UINT _gx_utility_gradient_delete(GX_GRADIENT *gradient);
|
||||
@ -4462,6 +4502,7 @@ UINT _gx_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX
|
||||
|
||||
#define gx_menu_create(a, b, c, d, e, f, g, h) _gxe_menu_create((GX_MENU *)a, b, (GX_WIDGET *)c, d, e, f, g, h, sizeof(GX_MENU))
|
||||
#define gx_menu_draw _gx_menu_draw
|
||||
#define gx_menu_event_process _gxe_menu_event_process
|
||||
#define gx_menu_insert _gxe_menu_insert
|
||||
#define gx_menu_remove _gxe_menu_remove
|
||||
#define gx_menu_text_draw _gx_menu_text_draw
|
||||
@ -4797,6 +4838,10 @@ UINT _gx_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX
|
||||
#define gx_tree_view_selected_get _gxe_tree_view_selected_get
|
||||
#define gx_tree_view_selected_set _gxe_tree_view_selected_set
|
||||
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
#define gx_utility_bidi_paragraph_reorder _gxe_utility_bidi_paragraph_reorder
|
||||
#define gx_utility_bidi_resolved_text_info_delete _gxe_utility_bidi_resolved_text_info_delete
|
||||
#endif
|
||||
#define gx_utility_canvas_to_bmp _gxe_utility_canvas_to_bmp
|
||||
#define gx_utility_circle_point_get _gxe_utility_circle_point_get
|
||||
#define gx_utility_ltoa _gxe_utility_ltoa
|
||||
@ -5143,6 +5188,7 @@ UINT _gxe_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
|
||||
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
|
||||
ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
|
||||
VOID _gx_menu_draw(GX_MENU *menu);
|
||||
UINT _gxe_menu_event_process(GX_MENU* menu, GX_EVENT* event_ptr);
|
||||
UINT _gxe_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
|
||||
UINT _gxe_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
|
||||
VOID _gx_menu_text_draw(GX_MENU *menu);
|
||||
@ -5569,6 +5615,10 @@ UINT _gxe_tree_view_selected_set(GX_TREE_VIEW *tree, GX_WIDGET *selected);
|
||||
|
||||
UINT _gxe_utility_gradient_create(GX_GRADIENT *gradient, GX_VALUE width, GX_VALUE height, UCHAR type, UCHAR alpha_start, UCHAR alpha_end);
|
||||
UINT _gxe_utility_gradient_delete(GX_GRADIENT *gradient);
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
UINT _gxe_utility_bidi_paragraph_reorder(GX_BIDI_TEXT_INFO *input_info, GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head);
|
||||
UINT _gxe_utility_bidi_resolved_text_info_delete(GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head);
|
||||
#endif
|
||||
UINT _gxe_utility_canvas_to_bmp(GX_CANVAS *canvas, GX_RECTANGLE *rect, UINT(*write_data)(GX_UBYTE *byte_data, UINT data_count));
|
||||
UINT _gxe_utility_circle_point_get(INT xcenter, INT ycenter, UINT r, INT angle, GX_POINT *point);
|
||||
UINT _gxe_utility_ltoa(LONG value, GX_CHAR *return_buffer, UINT return_buffer_size);
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_display.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -44,6 +44,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added rotated display */
|
||||
/* driver declarations, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -228,6 +232,32 @@ VOID _gx_display_driver_16bpp_pixelmap_simple_rotate(GX_DRAW_CONTEXT *contex
|
||||
VOID _gx_display_driver_16bpp_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||
INT angle, INT rot_cx, INT rot_cy);
|
||||
|
||||
VOID _gx_display_driver_16bpp_rotated_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *block, INT xshift, INT yshift);
|
||||
VOID _gx_display_driver_16bpp_rotated_canvas_copy(GX_CANVAS *canvas, GX_CANVAS *composite);
|
||||
VOID _gx_display_driver_16bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
|
||||
VOID _gx_display_driver_16bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
|
||||
VOID _gx_display_driver_16bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
|
||||
VOID _gx_display_driver_16bpp_rotated_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
|
||||
VOID _gx_display_driver_16bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
|
||||
VOID _gx_display_driver_16bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
|
||||
VOID _gx_display_driver_565rgb_rotated_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite);
|
||||
VOID _gx_display_driver_565rgb_rotated_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
||||
VOID _gx_display_driver_565rgb_rotated_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
|
||||
INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info);
|
||||
VOID _gx_display_driver_565rgb_rotated_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
VOID _gx_display_driver_565rgb_rotated_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
||||
VOID _gx_display_driver_565rgb_rotated_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
||||
VOID _gx_display_driver_565rgb_rotated_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||
INT angle, INT rot_cx, INT rot_cy);
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
USHORT _gx_display_driver_565rgb_YCbCr2RGB(INT y, INT cb, INT cr);
|
||||
VOID _gx_display_driver_565rgb_rotated_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
||||
VOID _gx_display_driver_565rgb_rotated_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
||||
#endif
|
||||
VOID _gx_display_driver_565rgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||
GX_RECTANGLE *dirty_area));
|
||||
|
||||
VOID _gx_display_driver_24xrgb_canvas_blend(GX_CANVAS *source, GX_CANVAS *dest);
|
||||
VOID _gx_display_driver_24xrgb_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
VOID _gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
||||
@ -293,6 +323,8 @@ VOID _gx_display_driver_generic_wide_line_fill(GX_DRAW_CONTEXT *context, GX
|
||||
|
||||
VOID _gx_display_driver_generic_polygon_draw(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num);
|
||||
VOID _gx_display_driver_generic_polygon_fill(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num);
|
||||
VOID _gx_display_driver_generic_rotated_wide_line_fill(GX_DRAW_CONTEXT *context, GX_FIXED_POINT *pPoints);
|
||||
VOID _gx_display_driver_generic_rotated_polygon_fill(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num);
|
||||
#if defined(GX_ARC_DRAWING_SUPPORT)
|
||||
VOID _gx_display_driver_generic_circle_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
|
||||
VOID _gx_display_driver_generic_wide_circle_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
|
||||
@ -309,13 +341,21 @@ VOID _gx_display_driver_generic_aliased_wide_arc_draw(GX_DRAW_CONTEXT *cont
|
||||
VOID _gx_display_driver_generic_arc_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
|
||||
VOID _gx_display_driver_arc_clipping_get(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle,
|
||||
GX_RECTANGLE *clip_1, GX_RECTANGLE *clip_2, GX_RECTANGLE *clip_3, GX_RECTANGLE *clip_4);
|
||||
|
||||
VOID _gx_display_driver_generic_rotated_arc_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
|
||||
VOID _gx_display_driver_generic_rotated_circle_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r);
|
||||
VOID _gx_display_driver_generic_rotated_ellipse_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
VOID _gx_display_driver_generic_rotated_pie_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle);
|
||||
#endif
|
||||
|
||||
VOID _gx_display_driver_generic_aliased_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
VOID _gx_display_driver_generic_aliased_wide_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
VOID _gx_display_driver_generic_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
VOID _gx_display_driver_generic_wide_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
VOID _gx_display_driver_generic_ellipse_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
VOID _gx_display_driver_generic_rotated_alphamap_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp);
|
||||
VOID _gx_display_driver_generic_rotated_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
||||
VOID _gx_display_driver_generic_rotated_glyph_8bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
||||
VOID _gx_display_driver_generic_wide_ellipse_draw(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b);
|
||||
|
||||
VOID _gx_display_driver_32argb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||
@ -395,3 +435,14 @@ VOID *_win32_canvas_memory_prepare(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
|
||||
(_b))
|
||||
#endif
|
||||
|
||||
#define GX_SET_BLEND_FUNCTION(blend_func, color_format) \
|
||||
switch (color_format) \
|
||||
{ \
|
||||
case GX_COLOR_FORMAT_565RGB: \
|
||||
blend_func = _gx_display_driver_565rgb_pixel_blend; \
|
||||
break; \
|
||||
default: \
|
||||
/* Not supported. */ \
|
||||
return; \
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_menu.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -44,6 +44,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* declare menu event process, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -68,6 +71,7 @@ UINT _gx_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
|
||||
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
|
||||
ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size);
|
||||
VOID _gx_menu_draw(GX_MENU *menu);
|
||||
UINT _gx_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr);
|
||||
UINT _gx_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
|
||||
UINT _gx_menu_one_level_position(GX_MENU *menu, GX_VALUE indentation);
|
||||
UINT _gx_menu_position(GX_MENU *menu, GX_VALUE indentation);
|
||||
@ -84,6 +88,7 @@ UINT _gxe_accordion_menu_position(GX_ACCORDION_MENU *accordion);
|
||||
UINT _gxe_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
|
||||
GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
|
||||
ULONG style, USHORT menu_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size);
|
||||
UINT _gxe_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr);
|
||||
UINT _gxe_menu_insert(GX_MENU *menu, GX_WIDGET *widget);
|
||||
UINT _gxe_menu_remove(GX_MENU *menu, GX_WIDGET *widget);
|
||||
UINT _gxe_menu_text_offset_set(GX_MENU *menu, GX_VALUE x_offset, GX_VALUE y_offset);
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_system.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -46,6 +46,10 @@
|
||||
/* removed private string */
|
||||
/* delete declaration, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -360,7 +364,9 @@ SYSTEM_DECLARE TX_MUTEX _gx_system_protect;
|
||||
SYSTEM_DECLARE TX_MUTEX _gx_system_input_protect;
|
||||
/* Define the system timer. */
|
||||
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
SYSTEM_DECLARE TX_TIMER _gx_system_timer;
|
||||
#endif
|
||||
|
||||
/* Define the memory area for the system event queue. */
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_utility.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -45,6 +45,9 @@
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added new prototype, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* bidi test reordering APIs, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -135,13 +138,6 @@ typedef struct GX_BIDI_UNIT_STRUCT
|
||||
GX_UBYTE gx_bidi_unit_org_type;
|
||||
} GX_BIDI_UNIT;
|
||||
|
||||
typedef struct GX_BIDI_TEXT_INFO_STRUCT
|
||||
{
|
||||
GX_STRING gx_bidi_text_info_text;
|
||||
GX_FONT *gx_bidi_text_info_font;
|
||||
GX_VALUE gx_bidi_text_info_display_width;
|
||||
} GX_BIDI_TEXT_INFO;
|
||||
|
||||
/* Define a truture to keep parameters for a bunch of functions. */
|
||||
typedef struct GX_BIDI_CONTEXT_STRUCT
|
||||
{
|
||||
@ -345,6 +341,9 @@ UINT _gxe_utility_rectangle_shift(GX_RECTANGLE *rectangle, GX_VALUE x_shift,
|
||||
UINT _gxe_utility_string_to_alphamap(GX_CONST GX_CHAR *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap);
|
||||
#endif
|
||||
UINT _gxe_utility_string_to_alphamap_ext(GX_CONST GX_STRING *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap);
|
||||
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
UINT _gxe_utility_bidi_paragraph_reorder(GX_BIDI_TEXT_INFO *input_info, GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head);
|
||||
UINT _gxe_utility_bidi_resolved_text_info_delete(GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -102,7 +102,7 @@ GX_EVENT complete_event;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_animation_complete PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -142,6 +142,9 @@ GX_EVENT complete_event;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* improved logic, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -191,8 +194,8 @@ GX_VALUE yshift;
|
||||
/* attach the widget to it's parent */
|
||||
_gx_widget_attach(animation -> gx_animation_info.gx_animation_parent, target);
|
||||
}
|
||||
_gx_system_canvas_refresh();
|
||||
_gx_canvas_hide(animation -> gx_animation_canvas);
|
||||
_gx_system_canvas_refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -202,6 +205,7 @@ GX_VALUE yshift;
|
||||
animation -> gx_animation_info.gx_animation_end_alpha)
|
||||
{
|
||||
animation -> gx_animation_info.gx_animation_target -> gx_widget_style &= ~GX_STYLE_USE_LOCAL_ALPHA;
|
||||
_gx_system_dirty_mark(animation -> gx_animation_info.gx_animation_target);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_animation_start PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -80,6 +80,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_animation_start(GX_ANIMATION *animation, GX_ANIMATION_INFO *info)
|
||||
@ -88,8 +92,10 @@ UINT status = GX_SUCCESS;
|
||||
GX_WINDOW_ROOT *root;
|
||||
|
||||
#ifdef GX_THREADX_BINDING
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
UINT tx_timer_active;
|
||||
#endif
|
||||
#endif
|
||||
GX_VALUE left;
|
||||
GX_VALUE top;
|
||||
|
||||
@ -185,7 +191,7 @@ GX_VALUE top;
|
||||
_gx_system_animation_list = animation;
|
||||
|
||||
#ifdef GX_THREADX_BINDING
|
||||
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
/* if the low-level timer is not active, start it */
|
||||
tx_timer_info_get(&_gx_system_timer, (CHAR **)TX_NULL, &tx_timer_active,
|
||||
(ULONG *)TX_NULL, (ULONG *)TX_NULL, (TX_TIMER **)TX_NULL);
|
||||
@ -194,6 +200,7 @@ GX_VALUE top;
|
||||
{
|
||||
tx_timer_activate(&_gx_system_timer);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
GX_TIMER_START;
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_animation_stop PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -71,6 +71,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_animation_stop(GX_ANIMATION *animation)
|
||||
@ -93,7 +97,9 @@ GX_ANIMATION *previous;
|
||||
if ((_gx_system_active_timer_list == NULL) && (_gx_system_animation_list == NULL))
|
||||
{
|
||||
#ifdef GX_THREADX_BINDING
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
tx_timer_deactivate(&_gx_system_timer);
|
||||
#endif
|
||||
#else
|
||||
GX_TIMER_STOP;
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_animation_update PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -74,6 +74,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), improve */
|
||||
/* linear animation accuracy, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_animation_update(VOID)
|
||||
@ -81,7 +84,6 @@ VOID _gx_animation_update(VOID)
|
||||
GX_ANIMATION *animation;
|
||||
GX_ANIMATION *next;
|
||||
GX_WIDGET *target;
|
||||
INT test_step;
|
||||
INT test_alpha;
|
||||
INT x_current;
|
||||
INT y_current;
|
||||
@ -134,21 +136,19 @@ GX_ANIMATION_INFO *info;
|
||||
if (info -> gx_animation_end_alpha !=
|
||||
info -> gx_animation_start_alpha)
|
||||
{
|
||||
_gx_utility_easing_function_calculate(info -> gx_animation_style,
|
||||
info -> gx_animation_start_alpha,
|
||||
info -> gx_animation_end_alpha,
|
||||
animation -> gx_animation_total_steps - info -> gx_animation_steps,
|
||||
animation -> gx_animation_total_steps, &test_alpha);
|
||||
|
||||
if (animation -> gx_animation_canvas)
|
||||
{
|
||||
test_alpha = animation -> gx_animation_canvas -> gx_canvas_alpha;
|
||||
test_step = info -> gx_animation_end_alpha - test_alpha;
|
||||
test_step /= info -> gx_animation_steps;
|
||||
test_alpha += test_step;
|
||||
_gx_canvas_alpha_set(animation -> gx_animation_canvas, (GX_UBYTE)test_alpha);
|
||||
}
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
else
|
||||
{
|
||||
test_alpha = target -> gx_widget_alpha;
|
||||
test_step = info -> gx_animation_end_alpha - test_alpha;
|
||||
test_step /= info -> gx_animation_steps;
|
||||
test_alpha += test_step;
|
||||
target -> gx_widget_alpha = (GX_UBYTE)test_alpha;
|
||||
if (test_alpha == 0xff)
|
||||
{
|
||||
@ -179,8 +179,6 @@ GX_ANIMATION_INFO *info;
|
||||
y_current = target -> gx_widget_size.gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (info -> gx_animation_style & GX_ANIMATION_EASING_FUNC_MASK)
|
||||
{
|
||||
if (info -> gx_animation_start_position.gx_point_x != info -> gx_animation_end_position.gx_point_x)
|
||||
{
|
||||
_gx_utility_easing_function_calculate(info -> gx_animation_style,
|
||||
@ -210,15 +208,6 @@ GX_ANIMATION_INFO *info;
|
||||
{
|
||||
y_trans = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x_trans = info -> gx_animation_end_position.gx_point_x - x_current;
|
||||
x_trans /= info -> gx_animation_steps;
|
||||
|
||||
y_trans = info -> gx_animation_end_position.gx_point_y - y_current;
|
||||
y_trans /= info -> gx_animation_steps;
|
||||
}
|
||||
|
||||
/* still moving */
|
||||
if (animation -> gx_animation_canvas)
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_canvas_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -79,6 +79,8 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_canvas_create(GX_CANVAS *canvas, GX_CONST GX_CHAR *name, GX_DISPLAY *display,
|
||||
@ -121,9 +123,9 @@ UINT _gx_canvas_create(GX_CANVAS *canvas, GX_CONST GX_CHAR *name, GX_DISPLAY *d
|
||||
canvas -> gx_canvas_name = name;
|
||||
|
||||
/* If running on Win32, create padded memory, only if needed */
|
||||
#ifdef GX_TARGET_WIN32
|
||||
#ifdef GX_TARGET_WIN32
|
||||
_win32_compatible_canvas_memory_allocate(canvas);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* initialize previous and next pointers */
|
||||
canvas -> gx_canvas_created_previous = GX_NULL;
|
||||
@ -157,31 +159,43 @@ UINT _gx_canvas_create(GX_CANVAS *canvas, GX_CONST GX_CHAR *name, GX_DISPLAY *d
|
||||
#ifdef GX_TARGET_WIN32
|
||||
VOID _win32_compatible_canvas_memory_allocate(GX_CANVAS *canvas)
|
||||
{
|
||||
INT padded_width;
|
||||
USHORT row_byte_width;
|
||||
INT color_format = GX_COLOR_FORMAT_565RGB;
|
||||
GX_DISPLAY *display = canvas -> gx_canvas_display;
|
||||
USHORT rotation;
|
||||
INT padded_width;
|
||||
USHORT row_byte_width;
|
||||
INT color_format = GX_COLOR_FORMAT_565RGB;
|
||||
GX_DISPLAY *display = canvas -> gx_canvas_display;
|
||||
|
||||
padded_width = canvas->gx_canvas_x_resolution;
|
||||
/* Windows bitmaps must be padded to an even multiple of 4 bytes in width.
|
||||
When the GUIX canvas does not meet this requirement, we create a padded canvas memory
|
||||
so that we can pass the padded canvas memory off to Windows for display as a bitmap.
|
||||
This happens often when running at sub-byte color depth, but can occur at any color depth
|
||||
if the display resolution is very odd. */
|
||||
|
||||
padded_width = canvas -> gx_canvas_x_resolution;
|
||||
|
||||
if (display == GX_NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
row_byte_width = display ->gx_display_driver_row_pitch_get(padded_width);
|
||||
rotation = display -> gx_display_rotation_angle;
|
||||
|
||||
while(row_byte_width % 4)
|
||||
padded_width = canvas -> gx_canvas_x_resolution;
|
||||
|
||||
row_byte_width = display -> gx_display_driver_row_pitch_get(padded_width);
|
||||
|
||||
while (row_byte_width % 4)
|
||||
{
|
||||
padded_width++;
|
||||
row_byte_width = display ->gx_display_driver_row_pitch_get(padded_width);
|
||||
row_byte_width = display -> gx_display_driver_row_pitch_get(padded_width);
|
||||
}
|
||||
|
||||
if (padded_width != canvas -> gx_canvas_x_resolution)
|
||||
if ((padded_width != canvas -> gx_canvas_x_resolution) || rotation)
|
||||
{
|
||||
/* We are forced to create a padded buffer to hold Win32 compatible canvas memory */
|
||||
canvas -> gx_canvas_padded_memory = (GX_COLOR *) malloc(row_byte_width * canvas ->gx_canvas_y_resolution);
|
||||
/* We are forced to create a padded buffer to hold Win32 compatible canvas memory. */
|
||||
canvas -> gx_canvas_padded_memory = (GX_COLOR *)malloc(row_byte_width * canvas -> gx_canvas_y_resolution);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_canvas_drawing_initiate PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -80,6 +80,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_canvas_drawing_initiate(GX_CANVAS *canvas, GX_WIDGET *who, GX_RECTANGLE *dirty_area)
|
||||
@ -136,8 +139,16 @@ GX_DISPLAY *display = canvas -> gx_canvas_display;
|
||||
|
||||
new_context -> gx_draw_context_display = canvas -> gx_canvas_display;
|
||||
new_context -> gx_draw_context_memory = canvas -> gx_canvas_memory;
|
||||
|
||||
if (new_context -> gx_draw_context_display -> gx_display_rotation_angle == 0)
|
||||
{
|
||||
new_context -> gx_draw_context_pitch = canvas -> gx_canvas_x_resolution;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_context -> gx_draw_context_pitch = canvas -> gx_canvas_y_resolution;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update canvas draw count and draw nesting. */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_canvas_hide PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -67,11 +67,17 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* modified canvas dirty logic,*/
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_canvas_hide(GX_CANVAS *canvas)
|
||||
{
|
||||
VOID (*hide_function)(INT layer);
|
||||
GX_CANVAS *head = _gx_system_canvas_created_list;
|
||||
GX_RECTANGLE dirty;
|
||||
GX_RECTANGLE combine;
|
||||
|
||||
/* change canvas status flag. */
|
||||
canvas -> gx_canvas_status &= ~(UINT)(GX_CANVAS_VISIBLE);
|
||||
@ -88,7 +94,29 @@ VOID (*hide_function)(INT layer);
|
||||
}
|
||||
|
||||
/* mark the canvas dirty so that it get refreshed */
|
||||
_gx_canvas_dirty_mark(canvas, GX_NULL);
|
||||
_gx_utility_rectangle_define(&dirty, 0, 0, (GX_VALUE)(canvas -> gx_canvas_x_resolution - 1), (GX_VALUE)(canvas -> gx_canvas_y_resolution - 1));
|
||||
if (canvas -> gx_canvas_display_offset_x || canvas -> gx_canvas_display_offset_y)
|
||||
{
|
||||
_gx_utility_rectangle_shift(&dirty, canvas -> gx_canvas_display_offset_x, canvas -> gx_canvas_display_offset_y);
|
||||
}
|
||||
|
||||
while (head)
|
||||
{
|
||||
if (head -> gx_canvas_status & GX_CANVAS_VISIBLE)
|
||||
{
|
||||
_gx_utility_rectangle_define(&combine, 0, 0, (GX_VALUE)(head -> gx_canvas_x_resolution - 1), (GX_VALUE)(head -> gx_canvas_y_resolution - 1));
|
||||
|
||||
if (head -> gx_canvas_display_offset_x || head -> gx_canvas_display_offset_y)
|
||||
{
|
||||
_gx_utility_rectangle_shift(&combine, head -> gx_canvas_display_offset_x, head -> gx_canvas_display_offset_y);
|
||||
}
|
||||
|
||||
_gx_utility_rectangle_combine(&combine, &dirty);
|
||||
_gx_canvas_dirty_mark(head, &combine);
|
||||
}
|
||||
|
||||
head = head -> gx_canvas_created_next;
|
||||
}
|
||||
|
||||
/* Return successful status. */
|
||||
return(GX_SUCCESS);
|
||||
|
@ -107,7 +107,7 @@ UINT status;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_canvas_text_draw_ext PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -151,6 +151,10 @@ UINT status;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* replaced font format value */
|
||||
/* with macro defines, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_canvas_text_draw_ext(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_STRING *string)
|
||||
@ -206,7 +210,7 @@ GX_FONT *font = context -> gx_draw_context_brush.gx_brush_font;
|
||||
|
||||
switch (font -> gx_font_format & GX_FONT_FORMAT_BPP_MASK)
|
||||
{
|
||||
case 1:
|
||||
case GX_FONT_FORMAT_1BPP:
|
||||
if (font -> gx_font_format & GX_FONT_FORMAT_COMPRESSED)
|
||||
{
|
||||
glyph_draw = display -> gx_display_driver_1bit_compressed_glyph_draw;
|
||||
@ -217,7 +221,7 @@ GX_FONT *font = context -> gx_draw_context_brush.gx_brush_font;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case GX_FONT_FORMAT_4BPP:
|
||||
if (font -> gx_font_format & GX_FONT_FORMAT_COMPRESSED)
|
||||
{
|
||||
glyph_draw = display -> gx_display_driver_4bit_compressed_glyph_draw;
|
||||
@ -228,7 +232,7 @@ GX_FONT *font = context -> gx_draw_context_brush.gx_brush_font;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case GX_FONT_FORMAT_8BPP:
|
||||
if (font -> gx_font_format & GX_FONT_FORMAT_COMPRESSED)
|
||||
{
|
||||
glyph_draw = display -> gx_display_driver_8bit_compressed_glyph_draw;
|
||||
|
215
common/src/gx_display_driver_16bpp_rotated_block_move.c
Normal file
215
common/src/gx_display_driver_16bpp_rotated_block_move.c
Normal file
@ -0,0 +1,215 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_block_move PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp color format display driver rotated block moving */
|
||||
/* function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Draw context */
|
||||
/* block The rectangle to be moved */
|
||||
/* xshift Amount to move on X-axis */
|
||||
/* yshift Amount to move on Y-axis */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* memmove Move a block of data */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_block_move(GX_DRAW_CONTEXT *context,
|
||||
GX_RECTANGLE *block, INT xshift, INT yshift)
|
||||
{
|
||||
USHORT *pGet;
|
||||
USHORT *pPut;
|
||||
INT width;
|
||||
INT width_in_bytes;
|
||||
INT y;
|
||||
INT height;
|
||||
GX_RECTANGLE rotated_block;
|
||||
|
||||
GX_SWAP_VALS(xshift, yshift);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_block.gx_rectangle_left = block -> gx_rectangle_top;
|
||||
rotated_block.gx_rectangle_right = block -> gx_rectangle_bottom;
|
||||
rotated_block.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - block -> gx_rectangle_right - 1);
|
||||
rotated_block.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - block -> gx_rectangle_left - 1);
|
||||
|
||||
yshift = -yshift;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_block.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - block -> gx_rectangle_bottom - 1);
|
||||
rotated_block.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - block -> gx_rectangle_top - 1);
|
||||
rotated_block.gx_rectangle_top = block -> gx_rectangle_left;
|
||||
rotated_block.gx_rectangle_bottom = block -> gx_rectangle_right;
|
||||
|
||||
xshift = -xshift;
|
||||
}
|
||||
|
||||
if (xshift)
|
||||
{
|
||||
if (xshift > 0)
|
||||
{
|
||||
|
||||
/* Have to copy from left to right. */
|
||||
pPut = (USHORT *)context -> gx_draw_context_memory;
|
||||
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||
pPut += rotated_block.gx_rectangle_left + xshift;
|
||||
|
||||
pGet = (USHORT *)context -> gx_draw_context_memory;
|
||||
pGet += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||
pGet += rotated_block.gx_rectangle_left;
|
||||
|
||||
width = rotated_block.gx_rectangle_right - rotated_block.gx_rectangle_left + 1 - xshift;
|
||||
width_in_bytes = width * (int)sizeof(USHORT);
|
||||
|
||||
if (width_in_bytes <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (y = rotated_block.gx_rectangle_top; y <= rotated_block.gx_rectangle_bottom; y++)
|
||||
{
|
||||
memmove(pPut, pGet, (size_t)width_in_bytes);
|
||||
|
||||
pPut += context -> gx_draw_context_pitch;
|
||||
pGet += context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Have to copy from right to left. */
|
||||
pPut = (USHORT *)context -> gx_draw_context_memory;
|
||||
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||
pPut += rotated_block.gx_rectangle_left;
|
||||
|
||||
pGet = (USHORT *)context -> gx_draw_context_memory;
|
||||
pGet += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||
pGet += rotated_block.gx_rectangle_left - xshift;
|
||||
|
||||
width = rotated_block.gx_rectangle_right - rotated_block.gx_rectangle_left + 1 + xshift;
|
||||
width_in_bytes = width * (int)sizeof(USHORT);
|
||||
|
||||
if (width_in_bytes <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (y = rotated_block.gx_rectangle_top; y <= rotated_block.gx_rectangle_bottom; y++)
|
||||
{
|
||||
memmove(pPut, pGet, (size_t)width_in_bytes);
|
||||
|
||||
pPut += context -> gx_draw_context_pitch;
|
||||
pGet += context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
width = rotated_block.gx_rectangle_right - rotated_block.gx_rectangle_left + 1;
|
||||
width_in_bytes = width * (int)sizeof(USHORT);
|
||||
|
||||
if (yshift > 0)
|
||||
{
|
||||
|
||||
/* Have to copy from top to bottom. */
|
||||
pPut = (USHORT *)context -> gx_draw_context_memory;
|
||||
pPut += rotated_block.gx_rectangle_bottom * context -> gx_draw_context_pitch;
|
||||
pPut += rotated_block.gx_rectangle_left;
|
||||
|
||||
pGet = (USHORT *)context -> gx_draw_context_memory;
|
||||
pGet += (rotated_block.gx_rectangle_bottom - yshift) * context -> gx_draw_context_pitch;
|
||||
pGet += rotated_block.gx_rectangle_left;
|
||||
|
||||
height = rotated_block.gx_rectangle_bottom - rotated_block.gx_rectangle_top + 1 - yshift;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
memmove(pPut, pGet, (size_t)width_in_bytes);
|
||||
|
||||
pPut -= context -> gx_draw_context_pitch;
|
||||
pGet -= context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Have to copy from bottom to top. */
|
||||
pPut = (USHORT *)context -> gx_draw_context_memory;
|
||||
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||
pPut += rotated_block.gx_rectangle_left;
|
||||
|
||||
pGet = (USHORT *)context -> gx_draw_context_memory;
|
||||
pGet += (rotated_block.gx_rectangle_top - yshift) * context -> gx_draw_context_pitch;
|
||||
pGet += rotated_block.gx_rectangle_left;
|
||||
|
||||
height = rotated_block.gx_rectangle_bottom - rotated_block.gx_rectangle_top + 1 + yshift;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
memmove(pPut, pGet, (size_t)width_in_bytes);
|
||||
|
||||
pPut += context -> gx_draw_context_pitch;
|
||||
pGet += context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
130
common/src/gx_display_driver_16bpp_rotated_canvas_copy.c
Normal file
130
common/src/gx_display_driver_16bpp_rotated_canvas_copy.c
Normal file
@ -0,0 +1,130 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_utility.h"
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_canvas_copy PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp rotated canvas copy function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* canvas The canvas to copy from */
|
||||
/* composite The canvas to copy to */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_utility_rectangle_shift Move the rectangle */
|
||||
/* _gx_utility_rectangle_overlap_detect Detect two rectangles being */
|
||||
/* overlap to each other */
|
||||
/* memcpy Move canvas data */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_canvas_copy(GX_CANVAS *canvas, GX_CANVAS *composite)
|
||||
{
|
||||
GX_RECTANGLE dirty;
|
||||
GX_RECTANGLE overlap;
|
||||
USHORT *read;
|
||||
USHORT *write;
|
||||
INT width;
|
||||
INT row;
|
||||
|
||||
dirty.gx_rectangle_left = dirty.gx_rectangle_top = 0;
|
||||
dirty.gx_rectangle_right = (GX_VALUE)(canvas -> gx_canvas_x_resolution - (GX_VALUE)1);
|
||||
dirty.gx_rectangle_bottom = (GX_VALUE)(canvas -> gx_canvas_y_resolution - (GX_VALUE)1);
|
||||
|
||||
_gx_utility_rectangle_shift(&dirty, canvas -> gx_canvas_display_offset_x, canvas -> gx_canvas_display_offset_y);
|
||||
|
||||
if (_gx_utility_rectangle_overlap_detect(&dirty, &composite -> gx_canvas_dirty_area, &overlap))
|
||||
{
|
||||
width = overlap.gx_rectangle_bottom - overlap.gx_rectangle_top + 1;
|
||||
|
||||
read = (USHORT *)canvas -> gx_canvas_memory;
|
||||
write = (USHORT *)composite -> gx_canvas_memory;
|
||||
|
||||
if (canvas -> gx_canvas_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
/* index into starting row */
|
||||
read += (dirty.gx_rectangle_right - overlap.gx_rectangle_right) * canvas -> gx_canvas_y_resolution;
|
||||
|
||||
/* index into pixel */
|
||||
read += overlap.gx_rectangle_top - dirty.gx_rectangle_top;
|
||||
|
||||
/* calculate the write pointer */
|
||||
write += (composite -> gx_canvas_x_resolution - overlap.gx_rectangle_right - 1) * composite -> gx_canvas_y_resolution;
|
||||
write += overlap.gx_rectangle_top;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* index into starting row */
|
||||
read += (overlap.gx_rectangle_left - dirty.gx_rectangle_left) * canvas -> gx_canvas_y_resolution;
|
||||
|
||||
/* index into pixel */
|
||||
read += dirty.gx_rectangle_bottom - overlap.gx_rectangle_bottom;
|
||||
|
||||
/* calculate the write pointer */
|
||||
write += overlap.gx_rectangle_left * composite -> gx_canvas_y_resolution;
|
||||
write += (composite -> gx_canvas_y_resolution - overlap.gx_rectangle_bottom - 1);
|
||||
}
|
||||
|
||||
for (row = overlap.gx_rectangle_left; row <= overlap.gx_rectangle_right; row++)
|
||||
{
|
||||
memcpy(write, read, (size_t)(width * 2)); /* Use case of memcpy is verified. */
|
||||
|
||||
write += composite -> gx_canvas_y_resolution;
|
||||
read += canvas -> gx_canvas_y_resolution;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,133 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_horizontal_line_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp horizontal line draw function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xstart x-coord of left endpoint */
|
||||
/* xend x-coord of right endpoint */
|
||||
/* ypos y-coord of line top */
|
||||
/* width Width (height) of the line */
|
||||
/* color Color of line to write */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* NOne */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_horizontal_line_alpha_draw */
|
||||
/* Display driver basic */
|
||||
/* horiztonal alpha line draw */
|
||||
/* route */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
|
||||
{
|
||||
#if 1
|
||||
INT row;
|
||||
INT column;
|
||||
USHORT *put;
|
||||
USHORT *rowstart;
|
||||
INT len = xend - xstart + 1;
|
||||
|
||||
#if defined GX_BRUSH_ALPHA_SUPPORT
|
||||
GX_UBYTE alpha;
|
||||
|
||||
alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
if (alpha == 0)
|
||||
{
|
||||
/* Nothing to drawn. Just return. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (alpha != 0xff)
|
||||
{
|
||||
_gx_display_driver_horizontal_line_alpha_draw(context, xstart, xend, ypos, width, color, alpha);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* pick up start address of canvas memory */
|
||||
rowstart = (USHORT *)context -> gx_draw_context_memory;
|
||||
|
||||
/* calculate start of row address */
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xstart - 1) * context -> gx_draw_context_pitch;
|
||||
rowstart += ypos;
|
||||
}
|
||||
else
|
||||
{
|
||||
rowstart += xend * context -> gx_draw_context_pitch;
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ypos - width);
|
||||
}
|
||||
|
||||
|
||||
/* draw one line, left to right */
|
||||
for (column = 0; column < len; column++)
|
||||
{
|
||||
put = rowstart;
|
||||
|
||||
/* draw lines to fill width */
|
||||
for (row = 0; row < width; row++)
|
||||
{
|
||||
*put++ = (USHORT)color;
|
||||
}
|
||||
|
||||
rowstart -= context->gx_draw_context_pitch;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -0,0 +1,139 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_horizontal_pattern_line_draw */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp color format rotated horizontal pattern line draw */
|
||||
/* function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xstart x-coord of left endpoint */
|
||||
/* xend x-coord of right endpoint */
|
||||
/* ypos y-coord of line top */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos)
|
||||
{
|
||||
INT column;
|
||||
USHORT *put;
|
||||
USHORT *rowstart;
|
||||
ULONG pattern;
|
||||
ULONG mask;
|
||||
USHORT on_color;
|
||||
USHORT off_color;
|
||||
INT len = xend - xstart + 1;
|
||||
|
||||
/* Pick up start address of canvas memory. */
|
||||
rowstart = (USHORT *)context -> gx_draw_context_memory;
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
/* Calculate start of row address. */
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xstart - 1) * context -> gx_draw_context_pitch;
|
||||
|
||||
/* Calculate pixel address. */
|
||||
rowstart += ypos;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Calculate start of row address. */
|
||||
rowstart += xend * context -> gx_draw_context_pitch;
|
||||
|
||||
/* Calculate pixel address. */
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ypos - 1);
|
||||
}
|
||||
|
||||
/* Draw 1-pixel hi lines to fill width. */
|
||||
|
||||
/* Pick up the requested pattern and mask. */
|
||||
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
|
||||
mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
|
||||
on_color = (USHORT)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
off_color = (USHORT)context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
put = rowstart;
|
||||
|
||||
/* Draw line from bottom to top. */
|
||||
for (column = 0; column < len; column++)
|
||||
{
|
||||
if (pattern & mask)
|
||||
{
|
||||
*put = on_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
*put = off_color;
|
||||
}
|
||||
|
||||
put -= context -> gx_draw_context_pitch;
|
||||
mask >>= 1;
|
||||
if (!mask)
|
||||
{
|
||||
|
||||
/* Set most significant bit to repeat the pattern draw. */
|
||||
mask = 0x80000000;
|
||||
}
|
||||
}
|
||||
|
||||
/* Save current masks value back to brush. */
|
||||
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
|
||||
}
|
||||
|
93
common/src/gx_display_driver_16bpp_rotated_pixel_write.c
Normal file
93
common/src/gx_display_driver_16bpp_rotated_pixel_write.c
Normal file
@ -0,0 +1,93 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_pixel_write PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp color format pixel write function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* x X coordinate */
|
||||
/* y Y coordinate */
|
||||
/* color Color of pixel to write */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color)
|
||||
{
|
||||
USHORT *put = (USHORT *)context -> gx_draw_context_memory;
|
||||
|
||||
/* Calculate address of scan line. */
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
put += context -> gx_draw_context_pitch * (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - x - 1);
|
||||
|
||||
/* Step in by y coordinate. */
|
||||
put += y;
|
||||
}
|
||||
else
|
||||
{
|
||||
put += context -> gx_draw_context_pitch * x;
|
||||
|
||||
/* Step in by y coordinate. */
|
||||
put += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - y - 1);
|
||||
}
|
||||
|
||||
/* Write the pixel value. */
|
||||
*put = (USHORT)color;
|
||||
}
|
||||
|
797
common/src/gx_display_driver_16bpp_rotated_pixelmap_blend.c
Normal file
797
common/src/gx_display_driver_16bpp_rotated_pixelmap_blend.c
Normal file
@ -0,0 +1,797 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_context.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_pixelmap_raw_blend PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles blending of uncompressed */
|
||||
/* pixlemap file */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Display driver basic pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_16bpp_rotated_pixelmap_raw_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
int xval;
|
||||
int yval;
|
||||
USHORT *get;
|
||||
USHORT *getrow;
|
||||
USHORT pixel;
|
||||
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data);
|
||||
getrow += pixelmap -> gx_pixelmap_height * (rotated_clip.gx_rectangle_top - ypos);
|
||||
getrow += (rotated_clip.gx_rectangle_left - xpos);
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
get = getrow;
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
pixel = *get++;
|
||||
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha);
|
||||
}
|
||||
getrow += pixelmap -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_pixelmap_alpha_blend */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles blending of uncompressed */
|
||||
/* pixelmap file with alpha channel. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */
|
||||
/* blend function */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_565rgb_rotated_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
INT skipcount;
|
||||
INT xval;
|
||||
INT yval;
|
||||
USHORT *getrow;
|
||||
GX_UBYTE *getrowalpha;
|
||||
USHORT *get;
|
||||
USHORT pixel;
|
||||
GX_UBYTE *getalpha;
|
||||
INT combined_alpha;
|
||||
GX_UBYTE internal_alpha;
|
||||
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
/* Calculate how many pixels to skip. */
|
||||
skipcount = (pixelmap -> gx_pixelmap_height) * (rotated_clip.gx_rectangle_top - ypos);
|
||||
skipcount += (rotated_clip.gx_rectangle_left - xpos);
|
||||
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data);
|
||||
getrow += skipcount;
|
||||
|
||||
getrowalpha = (GX_UBYTE *)(pixelmap -> gx_pixelmap_aux_data);
|
||||
getrowalpha += skipcount;
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
get = getrow;
|
||||
getalpha = getrowalpha;
|
||||
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
internal_alpha = *getalpha++;
|
||||
if (internal_alpha)
|
||||
{
|
||||
combined_alpha = internal_alpha * alpha;
|
||||
combined_alpha /= 255;
|
||||
pixel = *get;
|
||||
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, (GX_UBYTE)combined_alpha);
|
||||
}
|
||||
get++;
|
||||
}
|
||||
getrow += pixelmap -> gx_pixelmap_height;
|
||||
getrowalpha += pixelmap -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_pixelmap_compressed_blend */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles blending of compressed */
|
||||
/* pixlemap file . */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Display driver basic pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_16bpp_rotated_pixelmap_compressed_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
int yval;
|
||||
int xval;
|
||||
GX_CONST USHORT *get;
|
||||
USHORT count;
|
||||
USHORT pixel;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
|
||||
blend_func = _gx_display_driver_565rgb_pixel_blend;
|
||||
|
||||
get = (GX_CONST USHORT *)pixelmap -> gx_pixelmap_data;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
/* Compressed with no alpha is a two-byte count and two-byte pixel value. */
|
||||
|
||||
/* First, skip to the starting row. */
|
||||
for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++)
|
||||
{
|
||||
xval = 0;
|
||||
while (xval < pixelmap -> gx_pixelmap_height)
|
||||
{
|
||||
count = *get++;
|
||||
|
||||
if (count & 0x8000)
|
||||
{
|
||||
count = (USHORT)((count & 0x7fff) + 1);
|
||||
|
||||
/* Skip repeated pixel value. */
|
||||
get++;
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
|
||||
/* Skip raw pixel values. */
|
||||
get += count;
|
||||
}
|
||||
xval += count;
|
||||
}
|
||||
}
|
||||
|
||||
while (yval <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
xval = xpos;
|
||||
|
||||
while (xval < xpos + pixelmap -> gx_pixelmap_height)
|
||||
{
|
||||
count = *get++;
|
||||
|
||||
if (count & 0x8000)
|
||||
{
|
||||
/* Repeated value. */
|
||||
count = (USHORT)((count & 0x7fff) + 1);
|
||||
pixel = *get++;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||
xval <= rotated_clip.gx_rectangle_right)
|
||||
{
|
||||
blend_func(context, xval, yval, pixel, alpha);
|
||||
}
|
||||
xval++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* String of non-repeated values. */
|
||||
count++;
|
||||
while (count--)
|
||||
{
|
||||
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||
xval <= rotated_clip.gx_rectangle_right)
|
||||
{
|
||||
pixel = *get;
|
||||
blend_func(context, xval, yval, pixel, alpha);
|
||||
}
|
||||
get++;
|
||||
xval++;
|
||||
}
|
||||
}
|
||||
}
|
||||
yval++;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_palette_pixelmap_raw_blend */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles blending of raw pixlemap */
|
||||
/* file without transparent for palette pixelmap. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_565rgb_rotated_palette_pixelmap_raw_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
INT xval;
|
||||
INT yval;
|
||||
GX_UBYTE *getrow;
|
||||
GX_CONST GX_UBYTE *get;
|
||||
GX_COLOR *palette;
|
||||
USHORT pixel;
|
||||
GX_UBYTE r;
|
||||
GX_UBYTE g;
|
||||
GX_UBYTE b;
|
||||
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data);
|
||||
getrow += pixelmap -> gx_pixelmap_height * (rotated_clip.gx_rectangle_top - ypos);
|
||||
getrow += (rotated_clip.gx_rectangle_left - xpos);
|
||||
|
||||
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data;
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
get = getrow;
|
||||
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
r = (GX_UBYTE)(REDVAL_32BPP(palette[*get]) >> 3);
|
||||
g = (GX_UBYTE)(GREENVAL_32BPP(palette[*get]) >> 2);
|
||||
b = (GX_UBYTE)(BLUEVAL_32BPP(palette[*get++]) >> 3);
|
||||
pixel = (USHORT)ASSEMBLECOLOR_16BPP(r, g, b);
|
||||
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha);
|
||||
}
|
||||
getrow += pixelmap -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_palette_pixelmap_transparent_blend*/
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles blending of raw pixlemap */
|
||||
/* file with transparent for palette pixelmap. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_565rgb_rotated_palette_pixelmap_transparent_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
INT xval;
|
||||
INT yval;
|
||||
GX_UBYTE *getrow;
|
||||
GX_CONST GX_UBYTE *get;
|
||||
GX_COLOR *palette;
|
||||
USHORT pixel;
|
||||
GX_UBYTE r;
|
||||
GX_UBYTE g;
|
||||
GX_UBYTE b;
|
||||
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
getrow = (GX_UBYTE *)(pixelmap -> gx_pixelmap_data);
|
||||
getrow += pixelmap -> gx_pixelmap_height * (rotated_clip.gx_rectangle_top - ypos);
|
||||
getrow += (rotated_clip.gx_rectangle_left - xpos);
|
||||
|
||||
palette = (GX_COLOR *)pixelmap -> gx_pixelmap_aux_data;
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
get = getrow;
|
||||
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
|
||||
{
|
||||
r = (GX_UBYTE)(REDVAL_32BPP(palette[*get]) >> 3);
|
||||
g = (GX_UBYTE)(GREENVAL_32BPP(palette[*get]) >> 2);
|
||||
b = (GX_UBYTE)(BLUEVAL_32BPP(palette[*get]) >> 3);
|
||||
pixel = (USHORT)ASSEMBLECOLOR_16BPP(r, g, b);
|
||||
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, alpha);
|
||||
}
|
||||
get++;
|
||||
}
|
||||
getrow += pixelmap -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_4444argb_pixelmap_raw_blend */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles blending of uncompressed */
|
||||
/* pixlemap file with alpha channel of 4444argb format. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_pixel_blend Display driver basic pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_565rgb_rotated_4444argb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
INT skipcount;
|
||||
INT xval;
|
||||
INT yval;
|
||||
USHORT *getrow;
|
||||
GX_CONST USHORT *get;
|
||||
UCHAR alpha_value;
|
||||
GX_UBYTE combined_alpha;
|
||||
USHORT pixel;
|
||||
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
ypos = (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
xpos = (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
/* Calculate how many pixels to skip. */
|
||||
skipcount = (pixelmap -> gx_pixelmap_height) * (rotated_clip.gx_rectangle_top - ypos);
|
||||
skipcount += (rotated_clip.gx_rectangle_left - xpos);
|
||||
getrow = (USHORT *)(pixelmap -> gx_pixelmap_data);
|
||||
getrow += skipcount;
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
get = getrow;
|
||||
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
/* 0x000f- -> b , 0x00f0- -> g , 0x0f00- -> r , 0xf000- -> a */
|
||||
/* 4444bgra - -> 565rgb */
|
||||
alpha_value = (UCHAR)(((*get) & 0xf000) >> 8);
|
||||
if (alpha_value)
|
||||
{
|
||||
alpha_value = alpha_value | (alpha_value >> 4);
|
||||
pixel = (USHORT)((((*get) & 0x0f00) << 4) | (((*get) & 0x00f0) << 3) | (((*get) & 0x000f) << 1));
|
||||
combined_alpha = (GX_UBYTE)(alpha * alpha_value / 255);
|
||||
_gx_display_driver_565rgb_pixel_blend(context, xval, yval, pixel, combined_alpha);
|
||||
}
|
||||
get++;
|
||||
}
|
||||
getrow += pixelmap -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_pixelmap_blend PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Driver entry point for pixelmap blending function that handles */
|
||||
/* compressed or uncompress, with or without alpha channel. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha blending value 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_palette_pixelmap_transparent_blend*/
|
||||
/* _gx_display_driver_565rgb_rotated_palette_pixelmap_raw_blend */
|
||||
/* _gx_display_driver_565rgb_rotated_4444argb_pixelmap_raw_blend */
|
||||
/* _gx_display_driver_565rgb_rotated_pixelmap_alpha_blend */
|
||||
/* _gx_display_driver_16bpp_rotated_pixelmap_compressed_blend */
|
||||
/* _gx_display_driver_16bpp_rotated_pixelmap_raw_blend */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_565rgb_rotated_pixelmap_blend(GX_DRAW_CONTEXT *context,
|
||||
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||
{
|
||||
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||
{
|
||||
if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_565RGB)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (pixelmap -> gx_pixelmap_format)
|
||||
{
|
||||
case GX_COLOR_FORMAT_8BIT_PALETTE:
|
||||
if (pixelmap -> gx_pixelmap_aux_data == GX_NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
|
||||
{
|
||||
_gx_display_driver_565rgb_rotated_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_565rgb_rotated_palette_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_COLOR_FORMAT_4444ARGB:
|
||||
_gx_display_driver_565rgb_rotated_4444argb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
|
||||
break;
|
||||
|
||||
case GX_COLOR_FORMAT_565RGB:
|
||||
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||
{
|
||||
_gx_display_driver_565rgb_rotated_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||
{
|
||||
_gx_display_driver_16bpp_rotated_pixelmap_compressed_blend(context, xpos, ypos, pixelmap, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_16bpp_rotated_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
1754
common/src/gx_display_driver_16bpp_rotated_pixelmap_draw.c
Normal file
1754
common/src/gx_display_driver_16bpp_rotated_pixelmap_draw.c
Normal file
File diff suppressed because it is too large
Load Diff
1049
common/src/gx_display_driver_16bpp_rotated_pixelmap_rotate.c
Normal file
1049
common/src/gx_display_driver_16bpp_rotated_pixelmap_rotate.c
Normal file
File diff suppressed because it is too large
Load Diff
494
common/src/gx_display_driver_16bpp_rotated_simple_line_draw.c
Normal file
494
common/src/gx_display_driver_16bpp_rotated_simple_line_draw.c
Normal file
@ -0,0 +1,494 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
#define PIXEL_WRITE(loc, val) (*(loc) = ((USHORT)val))
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_simple_line_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp color format line draw function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xstart x-coord of endpoint */
|
||||
/* ystart y-coord of endpoint */
|
||||
/* xend x-coord of endpoint */
|
||||
/* yend y-coord of endpoint */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_simple_line_alpha_draw */
|
||||
/* Generic line draw with alpha */
|
||||
/* _gx_display_driver_16bpp_simple_line_draw */
|
||||
/* Generic 16bpp line draw */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend)
|
||||
{
|
||||
INT curx;
|
||||
INT cury;
|
||||
INT x_sign;
|
||||
INT y_sign;
|
||||
INT decision;
|
||||
INT nextx;
|
||||
INT nexty;
|
||||
INT y_increment;
|
||||
GX_POINT end_point;
|
||||
GX_POINT mid_point;
|
||||
GX_RECTANGLE half_rectangle;
|
||||
GX_RECTANGLE half_over;
|
||||
INT sign;
|
||||
INT steps;
|
||||
|
||||
USHORT *put;
|
||||
USHORT *next_put;
|
||||
|
||||
GX_BOOL clipped = GX_TRUE;
|
||||
INT dx;
|
||||
INT dy;
|
||||
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
GX_COLOR linecolor;
|
||||
|
||||
#if defined GX_BRUSH_ALPHA_SUPPORT
|
||||
GX_UBYTE alpha;
|
||||
|
||||
alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
if (alpha == 0)
|
||||
{
|
||||
/* Nothing to drawn. Just return. */
|
||||
return;
|
||||
}
|
||||
if (alpha != 0xff)
|
||||
{
|
||||
_gx_display_driver_simple_line_alpha_draw(context, xstart, ystart, xend, yend, alpha);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
GX_SWAP_VALS(xstart, ystart);
|
||||
GX_SWAP_VALS(xend, yend);
|
||||
clip = context -> gx_draw_context_clip;
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
ystart = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ystart - 1;
|
||||
yend = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - yend - 1;
|
||||
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xstart = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xstart - 1;
|
||||
xend = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xend - 1;
|
||||
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
dx = GX_ABS(xend - xstart);
|
||||
dy = GX_ABS(yend - ystart);
|
||||
|
||||
|
||||
linecolor = context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
|
||||
if (((dx >= dy && (xstart > xend)) || ((dy > dx) && ystart > yend)))
|
||||
{
|
||||
GX_SWAP_VALS(xend, xstart);
|
||||
GX_SWAP_VALS(yend, ystart);
|
||||
}
|
||||
x_sign = (xend - xstart) / dx;
|
||||
y_sign = (yend - ystart) / dy;
|
||||
|
||||
if (y_sign > 0)
|
||||
{
|
||||
y_increment = context -> gx_draw_context_pitch;
|
||||
}
|
||||
else
|
||||
{
|
||||
y_increment = 0 - context -> gx_draw_context_pitch;
|
||||
}
|
||||
|
||||
put = (USHORT *)(context -> gx_draw_context_memory) + ystart * context -> gx_draw_context_pitch + xstart;
|
||||
next_put = (USHORT *)(context -> gx_draw_context_memory) + yend * context -> gx_draw_context_pitch + xend;
|
||||
|
||||
|
||||
end_point.gx_point_x = (GX_VALUE)xstart;
|
||||
end_point.gx_point_y = (GX_VALUE)ystart;
|
||||
|
||||
if (_gx_utility_rectangle_point_detect(&rotated_clip, end_point))
|
||||
{
|
||||
end_point.gx_point_x = (GX_VALUE)xend;
|
||||
end_point.gx_point_y = (GX_VALUE)yend;
|
||||
|
||||
if (_gx_utility_rectangle_point_detect(&rotated_clip, end_point))
|
||||
{
|
||||
clipped = GX_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (clipped)
|
||||
{
|
||||
/* here if we must do clipping in the inner loop, because one
|
||||
or both of the end points are outside clipping rectangle */
|
||||
|
||||
/* Calculate the middle point of the line. */
|
||||
mid_point.gx_point_x = (GX_VALUE)((xend + xstart) >> 1);
|
||||
mid_point.gx_point_y = (GX_VALUE)((yend + ystart) >> 1);
|
||||
|
||||
/* Judge the clip in which side. */
|
||||
if (_gx_utility_rectangle_point_detect(&rotated_clip, mid_point))
|
||||
{
|
||||
|
||||
/* the clip in two sides. */
|
||||
if (dx >= dy)
|
||||
{
|
||||
/* walk out the clipping point. */
|
||||
for (curx = xstart, cury = ystart, decision = (dx >> 1); curx < mid_point.gx_point_x;
|
||||
curx++, decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += y_sign;
|
||||
put += y_increment;
|
||||
}
|
||||
|
||||
if (curx >= rotated_clip.gx_rectangle_left &&
|
||||
cury >= rotated_clip.gx_rectangle_top &&
|
||||
cury <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
break;
|
||||
}
|
||||
put++;
|
||||
}
|
||||
for (; curx <= mid_point.gx_point_x;
|
||||
curx++, decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += y_sign;
|
||||
put += y_increment;
|
||||
}
|
||||
PIXEL_WRITE(put, linecolor);
|
||||
put++;
|
||||
}
|
||||
for (nextx = xend, nexty = yend, decision = (dx >> 1); nextx > mid_point.gx_point_x;
|
||||
nextx--, decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
nexty -= y_sign;
|
||||
next_put -= y_increment;
|
||||
}
|
||||
if (nextx <= rotated_clip.gx_rectangle_right &&
|
||||
nexty >= rotated_clip.gx_rectangle_top &&
|
||||
nexty <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
break;
|
||||
}
|
||||
next_put--;
|
||||
}
|
||||
|
||||
for (; nextx > mid_point.gx_point_x;
|
||||
nextx--, decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
nexty -= y_sign;
|
||||
next_put -= y_increment;
|
||||
}
|
||||
PIXEL_WRITE(next_put, linecolor);
|
||||
next_put--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (nextx = xend, nexty = yend, decision = (dy >> 1); nexty > mid_point.gx_point_y;
|
||||
nexty--, decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
nextx -= x_sign;
|
||||
next_put -= x_sign;
|
||||
}
|
||||
if (nextx >= rotated_clip.gx_rectangle_left &&
|
||||
nextx <= rotated_clip.gx_rectangle_right &&
|
||||
nexty <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
break;
|
||||
}
|
||||
next_put -= context -> gx_draw_context_pitch;
|
||||
}
|
||||
|
||||
for (; nexty > mid_point.gx_point_y;
|
||||
nexty--, decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
nextx -= x_sign;
|
||||
next_put -= x_sign;
|
||||
}
|
||||
PIXEL_WRITE(next_put, linecolor);
|
||||
next_put -= context -> gx_draw_context_pitch;
|
||||
}
|
||||
|
||||
/* walk out the clipping point. */
|
||||
for (curx = xstart, cury = ystart, decision = (dy >> 1); cury < mid_point.gx_point_y;
|
||||
cury++, decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += x_sign;
|
||||
put += x_sign;
|
||||
}
|
||||
|
||||
if (curx >= rotated_clip.gx_rectangle_left &&
|
||||
curx <= rotated_clip.gx_rectangle_right &&
|
||||
cury >= rotated_clip.gx_rectangle_top)
|
||||
{
|
||||
break;
|
||||
}
|
||||
put += context -> gx_draw_context_pitch;
|
||||
}
|
||||
for (; cury <= mid_point.gx_point_y;
|
||||
cury++, decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += x_sign;
|
||||
put += x_sign;
|
||||
}
|
||||
PIXEL_WRITE(put, linecolor);
|
||||
put += context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The clip stay at one side. */
|
||||
if (dx >= dy)
|
||||
{
|
||||
half_rectangle.gx_rectangle_left = (GX_VALUE)xstart;
|
||||
half_rectangle.gx_rectangle_right = mid_point.gx_point_x;
|
||||
if (y_sign == 1)
|
||||
{
|
||||
half_rectangle.gx_rectangle_top = (GX_VALUE)ystart;
|
||||
half_rectangle.gx_rectangle_bottom = mid_point.gx_point_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
half_rectangle.gx_rectangle_top = mid_point.gx_point_y;
|
||||
half_rectangle.gx_rectangle_bottom = (GX_VALUE)ystart;
|
||||
}
|
||||
|
||||
if (_gx_utility_rectangle_overlap_detect(&rotated_clip, &half_rectangle, &half_over))
|
||||
{
|
||||
curx = xstart;
|
||||
cury = ystart;
|
||||
steps = mid_point.gx_point_x - curx + 1;
|
||||
sign = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
curx = xend;
|
||||
cury = yend;
|
||||
steps = xend - mid_point.gx_point_x;
|
||||
sign = -1;
|
||||
y_increment = 0 - y_increment;
|
||||
y_sign = 0 - y_sign;
|
||||
put = next_put;
|
||||
}
|
||||
for (decision = (dx >> 1); steps > 0; curx += sign, decision += dy, steps--)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += y_sign;
|
||||
put += y_increment;
|
||||
}
|
||||
|
||||
if (curx >= rotated_clip.gx_rectangle_left &&
|
||||
curx <= rotated_clip.gx_rectangle_right &&
|
||||
cury >= rotated_clip.gx_rectangle_top &&
|
||||
cury <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
PIXEL_WRITE(put, linecolor);
|
||||
}
|
||||
put += sign;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
half_rectangle.gx_rectangle_top = (GX_VALUE)ystart;
|
||||
half_rectangle.gx_rectangle_bottom = mid_point.gx_point_y;
|
||||
if (x_sign == 1)
|
||||
{
|
||||
half_rectangle.gx_rectangle_right = mid_point.gx_point_x;
|
||||
half_rectangle.gx_rectangle_left = (GX_VALUE)xstart;
|
||||
}
|
||||
else
|
||||
{
|
||||
half_rectangle.gx_rectangle_right = (GX_VALUE)xstart;
|
||||
half_rectangle.gx_rectangle_left = mid_point.gx_point_x;
|
||||
}
|
||||
|
||||
if (_gx_utility_rectangle_overlap_detect(&rotated_clip, &half_rectangle, &half_over))
|
||||
{
|
||||
curx = xstart;
|
||||
cury = ystart;
|
||||
steps = mid_point.gx_point_y - cury + 1;
|
||||
y_increment = context -> gx_draw_context_pitch;
|
||||
sign = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
curx = xend;
|
||||
cury = yend;
|
||||
steps = yend - mid_point.gx_point_y;
|
||||
sign = -1;
|
||||
y_increment = 0 - context -> gx_draw_context_pitch;
|
||||
x_sign = 0 - x_sign;
|
||||
put = next_put;
|
||||
}
|
||||
|
||||
for (decision = (dy >> 1); steps > 0; cury += sign, decision += dx, steps--)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += x_sign;
|
||||
put += x_sign;
|
||||
}
|
||||
if (curx >= rotated_clip.gx_rectangle_left &&
|
||||
curx <= rotated_clip.gx_rectangle_right &&
|
||||
cury >= rotated_clip.gx_rectangle_top &&
|
||||
cury <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
PIXEL_WRITE(put, linecolor);
|
||||
}
|
||||
put += y_increment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here if both line ends lie within clipping rectangle, we can
|
||||
run a faster inner loop */
|
||||
if (dx >= dy)
|
||||
{
|
||||
put = (USHORT *)(context -> gx_draw_context_memory) + ystart * context -> gx_draw_context_pitch + xstart;
|
||||
next_put = (USHORT *)(context -> gx_draw_context_memory) + yend * context -> gx_draw_context_pitch + xend;
|
||||
|
||||
for (curx = xstart, cury = ystart, nextx = xend, nexty = yend,
|
||||
decision = (dx >> 1); curx <= nextx; curx++, nextx--,
|
||||
decision += dy)
|
||||
{
|
||||
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += y_sign;
|
||||
nexty -= y_sign;
|
||||
|
||||
put += y_increment;
|
||||
next_put -= y_increment;
|
||||
}
|
||||
PIXEL_WRITE(put, linecolor);
|
||||
PIXEL_WRITE(next_put, linecolor);
|
||||
|
||||
put++;
|
||||
next_put--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (curx = xstart, cury = ystart, nextx = xend, nexty = yend,
|
||||
decision = (dy >> 1); cury <= nexty; cury++, nexty--,
|
||||
decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += x_sign;
|
||||
nextx -= x_sign;
|
||||
|
||||
put += x_sign;
|
||||
next_put -= x_sign;
|
||||
}
|
||||
PIXEL_WRITE(put, linecolor);
|
||||
PIXEL_WRITE(next_put, linecolor);
|
||||
|
||||
put += context -> gx_draw_context_pitch;
|
||||
next_put -= context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
128
common/src/gx_display_driver_16bpp_rotated_vertical_line_draw.c
Normal file
128
common/src/gx_display_driver_16bpp_rotated_vertical_line_draw.c
Normal file
@ -0,0 +1,128 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_vertical_line_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic vertical line draw function for 16bpp canvas. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* ystart y-coord of top endpoint */
|
||||
/* yend y-coord of bottom endpoint */
|
||||
/* xpos x-coord of left edge */
|
||||
/* width width of the line */
|
||||
/* color Color of line to write */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_vertical_line_alpha_draw */
|
||||
/* Display driver basic vertical */
|
||||
/* line alpha draw function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
|
||||
{
|
||||
INT row;
|
||||
INT column;
|
||||
USHORT *put;
|
||||
USHORT *rowstart;
|
||||
INT len = yend - ystart + 1;
|
||||
|
||||
#if defined GX_BRUSH_ALPHA_SUPPORT
|
||||
GX_UBYTE alpha;
|
||||
|
||||
alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
if (alpha == 0)
|
||||
{
|
||||
/* Nothing to drawn. Just return. */
|
||||
return;
|
||||
}
|
||||
if (alpha != 0xff)
|
||||
{
|
||||
_gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* pick up starting address of canvas memory */
|
||||
rowstart = (USHORT *)context -> gx_draw_context_memory;
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
/* calculate start of scanline */
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch;
|
||||
|
||||
/* offset into starting pixel */
|
||||
rowstart += ystart;
|
||||
}
|
||||
else
|
||||
{
|
||||
rowstart += (xpos + width - 1) * context -> gx_draw_context_pitch;
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1);
|
||||
}
|
||||
|
||||
/* draw line width from left to right */
|
||||
for (column = 0; column < width; column++)
|
||||
{
|
||||
put = rowstart;
|
||||
/* draw line from top to bottom */
|
||||
for (row = 0; row < len; row++)
|
||||
{
|
||||
*put++ = (USHORT)color;
|
||||
}
|
||||
|
||||
/* advance to the right */
|
||||
rowstart -= context -> gx_draw_context_pitch;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,136 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_16bpp_rotated_vertical_pattern_line_draw */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16bpp color format rotated vertical pattern line draw */
|
||||
/* function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* ystart y-coord of top endpoint */
|
||||
/* yend y-coord of bottom endpoint */
|
||||
/* xpos x-coord of left edge */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_16bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
|
||||
{
|
||||
INT row;
|
||||
USHORT *put;
|
||||
USHORT *rowstart;
|
||||
ULONG pattern;
|
||||
ULONG mask;
|
||||
USHORT on_color;
|
||||
USHORT off_color;
|
||||
|
||||
INT len = yend - ystart + 1;
|
||||
|
||||
/* pick up starting address of canvas memory */
|
||||
rowstart = (USHORT *)context -> gx_draw_context_memory;
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
/* calculate start of scanline */
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch;
|
||||
|
||||
/* offset into starting pixel */
|
||||
rowstart += ystart;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* calculate start of scanline */
|
||||
rowstart += xpos * context -> gx_draw_context_pitch;
|
||||
|
||||
/* offset into starting pixel */
|
||||
rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1);
|
||||
}
|
||||
|
||||
/* pick up the requested pattern and mask */
|
||||
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern;
|
||||
mask = context -> gx_draw_context_brush.gx_brush_pattern_mask;
|
||||
on_color = (USHORT)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
off_color = (USHORT)context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
put = rowstart;
|
||||
|
||||
/* draw line from left to right */
|
||||
for (row = 0; row < len; row++)
|
||||
{
|
||||
if (pattern & mask)
|
||||
{
|
||||
*put = on_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
*put = off_color;
|
||||
}
|
||||
|
||||
mask >>= 1;
|
||||
if (!mask)
|
||||
{
|
||||
mask = 0x80000000;
|
||||
}
|
||||
|
||||
/* advance to the right */
|
||||
put++;
|
||||
}
|
||||
|
||||
/* save current masks value back to brush */
|
||||
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
|
||||
}
|
||||
|
@ -25,7 +25,8 @@
|
||||
#define BLUEVAL(_c) (GX_UBYTE)(_c)
|
||||
|
||||
#define ASSEMBLECOLOR(_r, _g, _b) \
|
||||
(((_r) << 16) | \
|
||||
((0xff << 24) | \
|
||||
((_r) << 16) | \
|
||||
((_g) << 8) | \
|
||||
(_b))
|
||||
#define GX_SOURCE_CODE
|
||||
@ -41,7 +42,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_24xrgb_pixel_blend PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -80,6 +81,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* set alpha value as 0xff, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_24xrgb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha)
|
||||
@ -103,7 +107,7 @@ ULONG *put;
|
||||
/* No need to blend if alpha value is 255. */
|
||||
if (alpha == 255)
|
||||
{
|
||||
*put = (ULONG)fcolor;
|
||||
*put = (ULONG)(fcolor | 0xff000000);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -129,7 +133,7 @@ ULONG *put;
|
||||
fgreen = (GX_UBYTE)(((bgreen * balpha) + (fgreen * alpha)) >> 8);
|
||||
fblue = (GX_UBYTE)(((bblue * balpha) + (fblue * alpha)) >> 8);
|
||||
|
||||
/* re-assemble into 16-bit color and write it out */
|
||||
/* re-assemble into 32-bit color and write it out */
|
||||
*put = (ULONG)(ASSEMBLECOLOR(fred, fgreen, fblue));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ static GX_COLOR mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_24xrgb_setup PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -68,6 +68,10 @@ static GX_COLOR mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added rotation angle */
|
||||
/* initialization, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_24xrgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
@ -104,6 +108,7 @@ VOID _gx_display_driver_24xrgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
display -> gx_display_mouse_define = _gx_display_driver_generic_mouse_define;
|
||||
#endif
|
||||
|
||||
display -> gx_display_rotation_angle = 0;
|
||||
display -> gx_display_driver_data = (VOID *)aux_data;
|
||||
display -> gx_display_accelerator = GX_NULL;
|
||||
display -> gx_display_layer_services = GX_NULL;
|
||||
|
@ -41,7 +41,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_32argb_pixel_blend PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -77,6 +77,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* fix pixel blend logic, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_32argb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha)
|
||||
@ -84,18 +87,17 @@ VOID _gx_display_driver_32argb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT
|
||||
|
||||
GX_UBYTE falpha, fred, fgreen, fblue;
|
||||
GX_UBYTE balpha, bred, bgreen, bblue;
|
||||
GX_UBYTE inv_alpha;
|
||||
GX_UBYTE oalpha;
|
||||
ULONG bcolor;
|
||||
ULONG *put;
|
||||
INT combined_alpha;
|
||||
|
||||
|
||||
falpha = ALPHAVAL(fcolor);
|
||||
combined_alpha = falpha * alpha;
|
||||
combined_alpha /= 255;
|
||||
falpha = (GX_UBYTE)((falpha * alpha) / 255);
|
||||
|
||||
/* Is the pixel non-transparent? */
|
||||
if (combined_alpha > 0)
|
||||
if (falpha > 0)
|
||||
{
|
||||
/* calculate address of pixel */
|
||||
put = (ULONG *)context -> gx_draw_context_memory;
|
||||
@ -103,7 +105,7 @@ INT combined_alpha;
|
||||
put += x;
|
||||
|
||||
/* No need to blend if alpha value is 255. */
|
||||
if (combined_alpha == 255)
|
||||
if (falpha == 255)
|
||||
{
|
||||
*put = (ULONG)fcolor;
|
||||
return;
|
||||
@ -125,16 +127,16 @@ INT combined_alpha;
|
||||
bblue = BLUEVAL(bcolor);
|
||||
|
||||
/* background alpha is inverse of foreground alpha */
|
||||
inv_alpha = (GX_UBYTE)(256 - combined_alpha);
|
||||
combined_alpha = (falpha * balpha) / 0xff;
|
||||
|
||||
/* blend foreground and background, each color channel */
|
||||
falpha = (GX_UBYTE)(((balpha * inv_alpha) + (falpha * combined_alpha)) >> 8);
|
||||
fred = (GX_UBYTE)(((bred * inv_alpha) + (fred * combined_alpha)) >> 8);
|
||||
fgreen = (GX_UBYTE)(((bgreen * inv_alpha) + (fgreen * combined_alpha)) >> 8);
|
||||
fblue = (GX_UBYTE)(((bblue * inv_alpha) + (fblue * combined_alpha)) >> 8);
|
||||
oalpha = (GX_UBYTE)(falpha + balpha - combined_alpha);
|
||||
fred = (GX_UBYTE)((fred * falpha + bred * balpha - bred * combined_alpha) / oalpha);
|
||||
fgreen = (GX_UBYTE)((fgreen * falpha + bgreen * balpha - bgreen * combined_alpha) / oalpha);
|
||||
fblue = (GX_UBYTE)((fblue * falpha + bblue * balpha - bblue * combined_alpha) / oalpha);
|
||||
|
||||
/* re-assemble into 16-bit color and write it out */
|
||||
*put = (ULONG)ASSEMBLECOLOR(falpha, fred, fgreen, fblue);
|
||||
*put = (ULONG)ASSEMBLECOLOR(oalpha, fred, fgreen, fblue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ static GX_COLOR mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_32argb_setup PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -68,6 +68,9 @@ static GX_COLOR mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_32argb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
@ -104,6 +107,7 @@ VOID _gx_display_driver_32argb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
display -> gx_display_mouse_define = _gx_display_driver_generic_mouse_define;
|
||||
#endif
|
||||
|
||||
display -> gx_display_rotation_angle = 0;
|
||||
display -> gx_display_driver_data = (VOID *)aux_data;
|
||||
display -> gx_display_accelerator = GX_NULL;
|
||||
display -> gx_display_layer_services = GX_NULL;
|
||||
|
@ -35,7 +35,7 @@ static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_4bpp_grayscale_setup PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -70,6 +70,10 @@ static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added rotation angle */
|
||||
/* initialization, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_4bpp_grayscale_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
@ -106,6 +110,7 @@ VOID _gx_display_driver_4bpp_grayscale_setup(GX_DISPLAY *display, VOID *aux_data
|
||||
display -> gx_display_mouse_define = _gx_display_driver_generic_mouse_define;
|
||||
#endif
|
||||
|
||||
display -> gx_display_rotation_angle = 0;
|
||||
display -> gx_display_driver_data = (VOID *)aux_data;
|
||||
display -> gx_display_accelerator = GX_NULL;
|
||||
display -> gx_display_layer_services = GX_NULL;
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_YCbCr2RGB PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -69,10 +69,13 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* made function public, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
static USHORT _gx_display_driver_565rgb_YCbCr2RGB(INT y, INT cb, INT cr)
|
||||
USHORT _gx_display_driver_565rgb_YCbCr2RGB(INT y, INT cb, INT cr)
|
||||
{
|
||||
INT red;
|
||||
INT green;
|
||||
|
179
common/src/gx_display_driver_565rgb_rotated_canvas_blend.c
Normal file
179
common/src/gx_display_driver_565rgb_rotated_canvas_blend.c
Normal file
@ -0,0 +1,179 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_utility.h"
|
||||
|
||||
#define REDVAL(_c) (GX_UBYTE)(((_c) >> 11) & 0x1f)
|
||||
#define GREENVAL(_c) (GX_UBYTE)(((_c) >> 5) & 0x3f)
|
||||
#define BLUEVAL(_c) (GX_UBYTE)(((_c)) & 0x1f)
|
||||
|
||||
|
||||
/* Define macros for assembling a 16-bit r:g:b value from 3 components. */
|
||||
|
||||
#define ASSEMBLECOLOR(_r, _g, _b) \
|
||||
((((_r) & 0x1f) << 11) | \
|
||||
(((_g) & 0x3f) << 5) | \
|
||||
(((_b) & 0x1f)))
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_canvas_blend PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Rotated canvas blend function for 565rgb color format. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* canvas The canvas to blend to */
|
||||
/* composite The canvas to blend from */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_utility_rectangle_shift Adjust the rectangle */
|
||||
/* _gx_utility_recttangle_overlap_detect Detect whether two areas */
|
||||
/* overlap */
|
||||
/* REDVAL Extrace Red from canvas */
|
||||
/* GREENVAL Extrace Green from canvas */
|
||||
/* BLUEVAL Extrace Blue from canvas */
|
||||
/* ASSEMBLECOLOR Compose the RGB color */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_565rgb_rotated_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite)
|
||||
{
|
||||
GX_RECTANGLE dirty;
|
||||
GX_RECTANGLE overlap;
|
||||
USHORT *read;
|
||||
USHORT *read_start;
|
||||
USHORT *write;
|
||||
USHORT *write_start;
|
||||
USHORT fcolor;
|
||||
GX_UBYTE fred, fgreen, fblue;
|
||||
GX_UBYTE bred, bgreen, bblue;
|
||||
GX_UBYTE alpha, balpha;
|
||||
|
||||
USHORT bcolor;
|
||||
INT row;
|
||||
INT col;
|
||||
|
||||
dirty.gx_rectangle_left = dirty.gx_rectangle_top = 0;
|
||||
dirty.gx_rectangle_right = (GX_VALUE)(canvas -> gx_canvas_x_resolution - 1);
|
||||
dirty.gx_rectangle_bottom = (GX_VALUE)(canvas -> gx_canvas_y_resolution - 1);
|
||||
|
||||
_gx_utility_rectangle_shift(&dirty, canvas -> gx_canvas_display_offset_x, canvas -> gx_canvas_display_offset_y);
|
||||
|
||||
if (_gx_utility_rectangle_overlap_detect(&dirty, &composite -> gx_canvas_dirty_area, &overlap))
|
||||
{
|
||||
alpha = canvas -> gx_canvas_alpha;
|
||||
balpha = (GX_UBYTE)(256 - alpha);
|
||||
|
||||
read_start = (USHORT *)canvas -> gx_canvas_memory;
|
||||
write_start = (USHORT *)composite -> gx_canvas_memory;
|
||||
|
||||
if (canvas -> gx_canvas_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
/* index into starting row */
|
||||
read_start += (dirty.gx_rectangle_right - overlap.gx_rectangle_right) * canvas -> gx_canvas_y_resolution;
|
||||
|
||||
/* index into pixel */
|
||||
read_start += overlap.gx_rectangle_top - dirty.gx_rectangle_top;
|
||||
|
||||
/* calculate the write pointer */
|
||||
write_start += (composite -> gx_canvas_x_resolution - overlap.gx_rectangle_right - 1) * composite -> gx_canvas_y_resolution;
|
||||
write_start += overlap.gx_rectangle_top;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* index into starting row */
|
||||
read_start += (overlap.gx_rectangle_left - dirty.gx_rectangle_left) * canvas -> gx_canvas_y_resolution;
|
||||
|
||||
/* index into pixel */
|
||||
read_start += dirty.gx_rectangle_bottom - overlap.gx_rectangle_bottom;
|
||||
|
||||
/* calculate the write pointer */
|
||||
write_start += overlap.gx_rectangle_left * composite -> gx_canvas_y_resolution;
|
||||
write_start += (composite -> gx_canvas_y_resolution - overlap.gx_rectangle_bottom - 1);
|
||||
}
|
||||
|
||||
for (row = overlap.gx_rectangle_left; row <= overlap.gx_rectangle_right; row++)
|
||||
{
|
||||
read = read_start;
|
||||
write = write_start;
|
||||
|
||||
for (col = overlap.gx_rectangle_top; col <= overlap.gx_rectangle_bottom; col++)
|
||||
{
|
||||
/* read the foreground color */
|
||||
fcolor = *read++;
|
||||
|
||||
/* split foreground into red, green, and blue components */
|
||||
fred = REDVAL(fcolor);
|
||||
fgreen = GREENVAL(fcolor);
|
||||
fblue = BLUEVAL(fcolor);
|
||||
|
||||
/* read background color */
|
||||
bcolor = *write;
|
||||
|
||||
/* split background color into red, green, and blue components */
|
||||
bred = REDVAL(bcolor);
|
||||
bgreen = GREENVAL(bcolor);
|
||||
bblue = BLUEVAL(bcolor);
|
||||
|
||||
/* blend foreground and background, each color channel */
|
||||
fred = (GX_UBYTE)(((bred * balpha) + (fred * alpha)) >> 8);
|
||||
fgreen = (GX_UBYTE)(((bgreen * balpha) + (fgreen * alpha)) >> 8);
|
||||
fblue = (GX_UBYTE)(((bblue * balpha) + (fblue * alpha)) >> 8);
|
||||
|
||||
/* re-assemble into 16-bit color and write it out */
|
||||
*write++ = (USHORT)ASSEMBLECOLOR(fred, fgreen, fblue);
|
||||
}
|
||||
write_start += composite -> gx_canvas_y_resolution;
|
||||
read_start += canvas -> gx_canvas_y_resolution;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
316
common/src/gx_display_driver_565rgb_rotated_glyph_1bit_draw.c
Normal file
316
common/src/gx_display_driver_565rgb_rotated_glyph_1bit_draw.c
Normal file
@ -0,0 +1,316 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
#define DRAW_PIXEL if (alpha & mask) \
|
||||
{ \
|
||||
*put = text_color; \
|
||||
} \
|
||||
put++; \
|
||||
mask = mask >> 1;
|
||||
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
#define BLEND_PIXEL if (alpha & mask) \
|
||||
{ \
|
||||
blend_func(context, xval, yval, text_color, brush_alpha); \
|
||||
} \
|
||||
xval++; \
|
||||
mask = mask >> 1;
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_glyph_1bit_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This functions draw monochrome font on 16bpp canvas, clipped to */
|
||||
/* one viewport. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Draw context */
|
||||
/* draw_area The region bound by the */
|
||||
/* rectangle where the glyph */
|
||||
/* is drawn */
|
||||
/* map_offset X,Y offset into the glyph map */
|
||||
/* glyph Pointer to the glyph */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX internal code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_565rgb_rotated_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph)
|
||||
{
|
||||
/* GX_DISPLAY *display;*/
|
||||
GX_UBYTE *glyph_row;
|
||||
GX_UBYTE *glyph_data;
|
||||
UINT row;
|
||||
UINT pixel_per_row;
|
||||
UINT pixel_in_first_byte;
|
||||
UINT pixel_in_last_byte = 0;
|
||||
USHORT text_color;
|
||||
UINT y_height;
|
||||
GX_UBYTE alpha;
|
||||
UINT glyph_width;
|
||||
USHORT *put;
|
||||
UINT num_bytes;
|
||||
UINT num_bits;
|
||||
USHORT *line_start;
|
||||
GX_UBYTE mask, init_mask;
|
||||
UINT i;
|
||||
GX_VALUE rotated_map_offset_x;
|
||||
GX_VALUE rotated_map_offset_y;
|
||||
GX_VALUE rotated_draw_left;
|
||||
GX_VALUE rotated_draw_top;
|
||||
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
GX_UBYTE brush_alpha;
|
||||
INT xval, yval;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *, INT, INT, GX_COLOR, GX_UBYTE);
|
||||
|
||||
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
|
||||
if (brush_alpha == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
blend_func = _gx_display_driver_565rgb_pixel_blend;
|
||||
#endif
|
||||
text_color = (USHORT)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
pixel_per_row = (UINT)(draw_area -> gx_rectangle_bottom - draw_area -> gx_rectangle_top + 1);
|
||||
y_height = (UINT)(draw_area -> gx_rectangle_right - draw_area -> gx_rectangle_left + 1);
|
||||
|
||||
/* Find the width of the glyph, in terms of bytes */
|
||||
glyph_width = glyph -> gx_glyph_height;
|
||||
|
||||
/* Make it byte-aligned. */
|
||||
glyph_width = (glyph_width + 7) >> 3;
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_draw_left = draw_area -> gx_rectangle_top;
|
||||
rotated_draw_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - draw_area -> gx_rectangle_right - 1);
|
||||
|
||||
rotated_map_offset_x = map_offset -> gx_point_y;
|
||||
rotated_map_offset_y = (GX_VALUE)(glyph -> gx_glyph_width - map_offset -> gx_point_x - (GX_VALUE)y_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_draw_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_display_offset_y - draw_area -> gx_rectangle_bottom - 1);
|
||||
rotated_draw_top = draw_area -> gx_rectangle_left;
|
||||
|
||||
rotated_map_offset_x = (GX_VALUE)(glyph -> gx_glyph_height - map_offset -> gx_point_y - (GX_VALUE)pixel_per_row);
|
||||
rotated_map_offset_y = map_offset -> gx_point_x;
|
||||
}
|
||||
|
||||
/* Compute the number of useful bytes from the glyph this routine is going to use.
|
||||
Because of map_offset, the first byte may contain pixel bits we don't need to draw;
|
||||
And the width of the draw_area may produce part of the last byte in the row to be ignored. */
|
||||
num_bytes = (UINT)(((INT)rotated_map_offset_x + (INT)pixel_per_row + 7) >> 3);
|
||||
|
||||
/* Take into account if map_offset specifies the number of bytes to ignore from the beginning of the row. */
|
||||
num_bytes -= ((UINT)(rotated_map_offset_x)) >> 3;
|
||||
|
||||
/* Compute the number of pixels to draw from the first byte of the glyph data. */
|
||||
pixel_in_first_byte = (UINT)(8 - ((rotated_map_offset_x) & 0x7));
|
||||
init_mask = (GX_UBYTE)(1 << (pixel_in_first_byte - 1));
|
||||
|
||||
/* Compute the number of pixels to draw from the last byte, if there are more than one byte in a row. */
|
||||
if (num_bytes != 1)
|
||||
{
|
||||
pixel_in_last_byte = ((UINT)rotated_map_offset_x + pixel_per_row) & 0x7;
|
||||
if (pixel_in_last_byte == 0)
|
||||
{
|
||||
pixel_in_last_byte = 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_in_first_byte = pixel_per_row;
|
||||
}
|
||||
|
||||
|
||||
glyph_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
|
||||
if (rotated_map_offset_y)
|
||||
{
|
||||
glyph_row = (GX_UBYTE *)(glyph_row + ((INT)glyph_width * (INT)(rotated_map_offset_y)));
|
||||
}
|
||||
|
||||
glyph_row += (rotated_map_offset_x >> 3);
|
||||
|
||||
line_start = (USHORT *)context -> gx_draw_context_memory;
|
||||
line_start += context -> gx_draw_context_pitch * (rotated_draw_top);
|
||||
line_start += rotated_draw_left;
|
||||
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
if (brush_alpha != 0xff)
|
||||
{
|
||||
yval = rotated_draw_top;
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
xval = rotated_draw_left;
|
||||
glyph_data = glyph_row;
|
||||
alpha = *(glyph_data);
|
||||
mask = init_mask;
|
||||
num_bits = pixel_in_first_byte;
|
||||
for (i = 0; i < num_bytes; i++)
|
||||
{
|
||||
if ((i == (num_bytes - 1)) && (num_bytes > 1))
|
||||
{
|
||||
num_bits = pixel_in_last_byte;
|
||||
}
|
||||
switch (num_bits)
|
||||
{
|
||||
case 8:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
case 7:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
case 6:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
case 5:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
case 4:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
case 3:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
case 2:
|
||||
BLEND_PIXEL;
|
||||
/* fallthrough */
|
||||
default:
|
||||
if (alpha & mask)
|
||||
{
|
||||
blend_func(context, xval, yval, text_color, brush_alpha);
|
||||
}
|
||||
xval++;
|
||||
break;
|
||||
}
|
||||
glyph_data++;
|
||||
alpha = *(glyph_data);
|
||||
num_bits = 8;
|
||||
mask = 0x80;
|
||||
}
|
||||
|
||||
glyph_row += glyph_width;
|
||||
yval++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
glyph_data = glyph_row;
|
||||
alpha = *(glyph_data);
|
||||
mask = init_mask;
|
||||
num_bits = pixel_in_first_byte;
|
||||
put = line_start;
|
||||
for (i = 0; i < num_bytes; i++)
|
||||
{
|
||||
if ((i == (num_bytes - 1)) && (num_bytes > 1))
|
||||
{
|
||||
num_bits = pixel_in_last_byte;
|
||||
}
|
||||
switch (num_bits)
|
||||
{
|
||||
case 8:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
case 7:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
case 6:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
case 5:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
case 4:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
case 3:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
case 2:
|
||||
DRAW_PIXEL;
|
||||
/* fallthrough */
|
||||
default:
|
||||
if (alpha & mask)
|
||||
{
|
||||
*put = text_color;
|
||||
}
|
||||
put++;
|
||||
break;
|
||||
}
|
||||
glyph_data++;
|
||||
alpha = *(glyph_data);
|
||||
num_bits = 8;
|
||||
mask = 0x80;
|
||||
}
|
||||
|
||||
glyph_row += glyph_width;
|
||||
line_start += context -> gx_draw_context_pitch;
|
||||
}
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
189
common/src/gx_display_driver_565rgb_rotated_jpeg_draw.c
Normal file
189
common/src/gx_display_driver_565rgb_rotated_jpeg_draw.c
Normal file
@ -0,0 +1,189 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_context.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_image_reader.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_jpeg_16bpp_rotated_mcu_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function to draw one MCU of decoded JPEG data. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context GUIX draw context */
|
||||
/* xpos X position to draw */
|
||||
/* ypos y position to draw */
|
||||
/* jpeg_info JPEG control block */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Status Code */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_YCbCr2RGB */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_jpeg_decode */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
static UINT _gx_display_driver_565rgb_rotated_mcu_draw(GX_JPEG_INFO *jpeg_info, INT xpos, INT ypos)
|
||||
{
|
||||
USHORT *put;
|
||||
INT x;
|
||||
INT y;
|
||||
INT w;
|
||||
INT h;
|
||||
INT coff;
|
||||
INT Y;
|
||||
INT Cb;
|
||||
INT Cr;
|
||||
|
||||
GX_DRAW_CONTEXT *context = jpeg_info -> gx_jpeg_draw_context;
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
INT rotated_xpos;
|
||||
INT rotated_ypos;
|
||||
INT sign;
|
||||
|
||||
h = (jpeg_info -> gx_jpeg_sample_factor[0] >> 4);
|
||||
w = (jpeg_info -> gx_jpeg_sample_factor[0] & 0x0f);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_xpos = ypos;
|
||||
rotated_ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1;
|
||||
sign = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ypos - 1;
|
||||
rotated_ypos = xpos;
|
||||
sign = -1;
|
||||
}
|
||||
|
||||
put = (USHORT *)context -> gx_draw_context_memory;
|
||||
put += rotated_ypos * context -> gx_draw_context_pitch;
|
||||
put += rotated_xpos;
|
||||
|
||||
for (x = 0; x < 8 * h; x++)
|
||||
{
|
||||
for (y = 0; y < 8 * w; y++)
|
||||
{
|
||||
|
||||
if ((xpos + x >= clip -> gx_rectangle_left) && (xpos + x <= clip -> gx_rectangle_right) &&
|
||||
(ypos + y >= clip -> gx_rectangle_top) && (ypos + y <= clip -> gx_rectangle_bottom))
|
||||
{
|
||||
coff = x / w + ((y / h) << 3);
|
||||
|
||||
Y = jpeg_info -> gx_jpeg_Y_block[x + y * w * 8];
|
||||
Cb = jpeg_info -> gx_jpeg_Cb_block[coff];
|
||||
Cr = jpeg_info -> gx_jpeg_Cr_block[coff];
|
||||
|
||||
*(put + y * sign) = _gx_display_driver_565rgb_YCbCr2RGB(Y, Cb, Cr);
|
||||
}
|
||||
}
|
||||
|
||||
put -= (context -> gx_draw_context_pitch) * sign;
|
||||
}
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_dislay_driver_565rgb_jpeg_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* 565rgb screen driver JPEG image draw routine. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_image_reader_jpeg_mcu_decode */
|
||||
/* [_gx_display_driver_565rgb_mcu_draw] */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
VOID _gx_display_driver_565rgb_rotated_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||
{
|
||||
|
||||
_gx_image_reader_jpeg_mcu_decode(pixelmap -> gx_pixelmap_data,
|
||||
pixelmap -> gx_pixelmap_data_size,
|
||||
context, xpos, ypos,
|
||||
_gx_display_driver_565rgb_rotated_mcu_draw);
|
||||
}
|
||||
#endif
|
||||
|
145
common/src/gx_display_driver_565rgb_rotated_pixel_blend.c
Normal file
145
common/src/gx_display_driver_565rgb_rotated_pixel_blend.c
Normal file
@ -0,0 +1,145 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define _COLOR_FORMAT_ 565rgb
|
||||
#define PIXEL_LOC USHORT
|
||||
|
||||
#define REDVAL(_c) (GX_UBYTE)(((_c) >> 11) & 0x1f)
|
||||
#define GREENVAL(_c) (GX_UBYTE)(((_c) >> 5) & 0x3f)
|
||||
#define BLUEVAL(_c) (GX_UBYTE)(((_c)) & 0x1f)
|
||||
|
||||
#define ASSEMBLECOLOR(_r, _g, _b) \
|
||||
((((_r) & 0x1f) << 11) | \
|
||||
(((_g) & 0x3f) << 5) | \
|
||||
(((_b) & 0x1f)))
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_pixel_blend PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Rotated pixel blend function for 565rgb color format. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* x X coordinate */
|
||||
/* y Y coordinate */
|
||||
/* color Color of line to write */
|
||||
/* alpha Alpha value */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* REDVAL Extract the red component */
|
||||
/* GREENVAL Extract the green component */
|
||||
/* BLUEVAL Extract the blue component */
|
||||
/* ASSEMBLECOLOR Assemble color components */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_565rgb_rotated_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha)
|
||||
{
|
||||
GX_UBYTE fred, fgreen, fblue;
|
||||
GX_UBYTE bred, bgreen, bblue;
|
||||
GX_UBYTE balpha;
|
||||
|
||||
USHORT bcolor;
|
||||
USHORT *put;
|
||||
|
||||
|
||||
/* Is the pixel non-transparent? */
|
||||
if (alpha > 0)
|
||||
{
|
||||
put = (USHORT *)context -> gx_draw_context_memory;
|
||||
|
||||
/* calculate address of pixel */
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
put += context -> gx_draw_context_pitch * (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - x - 1);
|
||||
put += y;
|
||||
}
|
||||
else
|
||||
{
|
||||
put += context -> gx_draw_context_pitch * x;
|
||||
put += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - y - 1);
|
||||
}
|
||||
|
||||
/* No need to blend if alpha value is 255. */
|
||||
if (alpha == 255)
|
||||
{
|
||||
*put = (USHORT)fcolor;
|
||||
return;
|
||||
}
|
||||
|
||||
/* split foreground into red, green, and blue components */
|
||||
fred = REDVAL(fcolor);
|
||||
fgreen = GREENVAL(fcolor);
|
||||
fblue = BLUEVAL(fcolor);
|
||||
|
||||
/* read background color */
|
||||
bcolor = *put;
|
||||
|
||||
/* split background color into red, green, and blue components */
|
||||
bred = REDVAL(bcolor);
|
||||
bgreen = GREENVAL(bcolor);
|
||||
bblue = BLUEVAL(bcolor);
|
||||
|
||||
/* background alpha is inverse of foreground alpha */
|
||||
balpha = (GX_UBYTE)(256 - alpha);
|
||||
|
||||
/* blend foreground and background, each color channel */
|
||||
fred = (GX_UBYTE)(((bred * balpha) + (fred * alpha)) >> 8);
|
||||
fgreen = (GX_UBYTE)(((bgreen * balpha) + (fgreen * alpha)) >> 8);
|
||||
fblue = (GX_UBYTE)(((bblue * balpha) + (fblue * alpha)) >> 8);
|
||||
|
||||
/* re-assemble into 16-bit color and write it out */
|
||||
*put = (USHORT)ASSEMBLECOLOR(fred, fgreen, fblue);
|
||||
}
|
||||
}
|
||||
|
111
common/src/gx_display_driver_565rgb_rotated_png_draw.c
Normal file
111
common/src/gx_display_driver_565rgb_rotated_png_draw.c
Normal file
@ -0,0 +1,111 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_context.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_image_reader.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_png_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* 565rgb format display driver PNG drawing function. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_image_reader_create */
|
||||
/* _gx_image_reader_start */
|
||||
/* _gx_display_driver_565rgb_rotated_pixelmap_draw */
|
||||
/* _gx_system_memory_free */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
VOID _gx_display_driver_565rgb_rotated_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||
{
|
||||
GX_IMAGE_READER image_reader;
|
||||
GX_PIXELMAP pic_outmap;
|
||||
GX_UBYTE mode = GX_IMAGE_READER_MODE_ALPHA;
|
||||
|
||||
if (context->gx_draw_context_display->gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
mode |= GX_IMAGE_READER_MODE_ROTATE_CW;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode |= GX_IMAGE_READER_MODE_ROTATE_CCW;
|
||||
}
|
||||
|
||||
_gx_image_reader_create(&image_reader,
|
||||
pixelmap -> gx_pixelmap_data,
|
||||
(INT)(pixelmap -> gx_pixelmap_data_size),
|
||||
GX_COLOR_FORMAT_565RGB, mode);
|
||||
|
||||
if (_gx_image_reader_start(&image_reader, &pic_outmap) == GX_SUCCESS)
|
||||
{
|
||||
_gx_display_driver_565rgb_rotated_pixelmap_draw(context, xpos, ypos, &pic_outmap);
|
||||
|
||||
_gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_data);
|
||||
|
||||
if (pic_outmap.gx_pixelmap_aux_data)
|
||||
{
|
||||
_gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_aux_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
126
common/src/gx_display_driver_565rgb_rotated_setup.c
Normal file
126
common/src/gx_display_driver_565rgb_rotated_setup.c
Normal file
@ -0,0 +1,126 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_rotated_setup PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Generic 16-bit 565RGB color format display driver setup routine */
|
||||
/* supporting 90 and 270 degree rotation. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* display The display control block */
|
||||
/* aux_data Driver-defined auxiliary data */
|
||||
/* toggle_function Driver-defined screen toggle */
|
||||
/* function */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_565rgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||
GX_RECTANGLE *dirty_area))
|
||||
{
|
||||
_gx_display_driver_565rgb_setup(display, aux_data, toggle_function);
|
||||
|
||||
/* Default initiate and complete function to null for general condition. */
|
||||
#if defined(GX_MOUSE_SUPPORT)
|
||||
display -> gx_display_mouse_capture = GX_NULL;
|
||||
display -> gx_display_mouse_restore = GX_NULL;
|
||||
display -> gx_display_mouse_capture = GX_NULL;
|
||||
display -> gx_display_mouse_restore = GX_NULL;
|
||||
display -> gx_display_mouse_draw = GX_NULL;
|
||||
display -> gx_display_driver_drawing_initiate = GX_NULL;
|
||||
display -> gx_display_driver_drawing_complete = GX_NULL;
|
||||
display -> gx_display_mouse_position_set = GX_NULL;
|
||||
display -> gx_display_mouse_enable = GX_NULL;
|
||||
#endif
|
||||
|
||||
// default to 90 degree rotation angle
|
||||
display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW;
|
||||
|
||||
display -> gx_display_driver_canvas_copy = _gx_display_driver_16bpp_rotated_canvas_copy;
|
||||
display -> gx_display_driver_simple_line_draw = _gx_display_driver_16bpp_rotated_simple_line_draw;
|
||||
display -> gx_display_driver_horizontal_line_draw = _gx_display_driver_16bpp_rotated_horizontal_line_draw;
|
||||
display -> gx_display_driver_vertical_line_draw = _gx_display_driver_16bpp_rotated_vertical_line_draw;
|
||||
display -> gx_display_driver_horizontal_pattern_line_draw = _gx_display_driver_16bpp_rotated_horizontal_pattern_line_draw;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_display_driver_565rgb_rotated_horizontal_pixelmap_line_draw;
|
||||
display -> gx_display_driver_vertical_pattern_line_draw = _gx_display_driver_16bpp_rotated_vertical_pattern_line_draw;
|
||||
display -> gx_display_driver_pixel_write = _gx_display_driver_16bpp_rotated_pixel_write;
|
||||
display -> gx_display_driver_block_move = _gx_display_driver_16bpp_rotated_block_move;
|
||||
|
||||
display -> gx_display_driver_pixelmap_draw = _gx_display_driver_565rgb_rotated_pixelmap_draw;
|
||||
display -> gx_display_driver_pixelmap_rotate = _gx_display_driver_565rgb_rotated_pixelmap_rotate;
|
||||
display -> gx_display_driver_alphamap_draw = _gx_display_driver_generic_rotated_alphamap_draw;
|
||||
display -> gx_display_driver_polygon_fill = _gx_display_driver_generic_rotated_polygon_fill;
|
||||
|
||||
#if defined(GX_ARC_DRAWING_SUPPORT)
|
||||
display -> gx_display_driver_circle_fill = _gx_display_driver_generic_rotated_circle_fill;
|
||||
display -> gx_display_driver_pie_fill = _gx_display_driver_generic_rotated_pie_fill;
|
||||
display -> gx_display_driver_arc_fill = _gx_display_driver_generic_rotated_arc_fill;
|
||||
display -> gx_display_driver_ellipse_fill = _gx_display_driver_generic_rotated_ellipse_fill;
|
||||
#endif
|
||||
|
||||
display -> gx_display_driver_canvas_blend = _gx_display_driver_565rgb_rotated_canvas_blend;
|
||||
display -> gx_display_driver_pixel_blend = _gx_display_driver_565rgb_rotated_pixel_blend;
|
||||
display -> gx_display_driver_pixelmap_blend = _gx_display_driver_565rgb_rotated_pixelmap_blend;
|
||||
|
||||
display -> gx_display_driver_8bit_glyph_draw = _gx_display_driver_generic_rotated_glyph_8bit_draw;
|
||||
display -> gx_display_driver_4bit_glyph_draw = _gx_display_driver_generic_rotated_glyph_4bit_draw;
|
||||
display -> gx_display_driver_1bit_glyph_draw = _gx_display_driver_565rgb_rotated_glyph_1bit_draw;
|
||||
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
display -> gx_display_driver_jpeg_draw = _gx_display_driver_565rgb_rotated_jpeg_draw;
|
||||
display -> gx_display_driver_png_draw = _gx_display_driver_565rgb_rotated_png_draw;
|
||||
#endif
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ static USHORT mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESOLU
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_setup PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -69,6 +69,10 @@ static USHORT mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESOLU
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added rotation angle */
|
||||
/* initialization, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_565rgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
@ -105,6 +109,7 @@ VOID _gx_display_driver_565rgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
display -> gx_display_mouse_define = _gx_display_driver_generic_mouse_define;
|
||||
#endif
|
||||
|
||||
display -> gx_display_rotation_angle = 0;
|
||||
display -> gx_display_driver_data = (VOID *)aux_data;
|
||||
display -> gx_display_accelerator = GX_NULL;
|
||||
display -> gx_display_layer_services = GX_NULL;
|
||||
|
@ -37,7 +37,7 @@ static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_8bit_palette_setup PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -72,6 +72,10 @@ static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added rotation angle */
|
||||
/* initialization, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_8bit_palette_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
@ -107,6 +111,8 @@ VOID _gx_display_driver_8bit_palette_setup(GX_DISPLAY *display, VOID *aux_da
|
||||
display -> gx_display_mouse.gx_mouse_cursor_info = GX_NULL;
|
||||
display -> gx_display_mouse_define = _gx_display_driver_generic_mouse_define;
|
||||
#endif
|
||||
|
||||
display -> gx_display_rotation_angle = 0;
|
||||
display -> gx_display_driver_data = (VOID *)aux_data;
|
||||
display -> gx_display_accelerator = GX_NULL;
|
||||
display -> gx_display_layer_services = GX_NULL;
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_aliased_wide_line_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -80,6 +80,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* supported display rotation, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_aliased_wide_line_draw(GX_DRAW_CONTEXT *context, INT xstart,
|
||||
@ -192,8 +195,15 @@ GX_UBYTE old_alpha;
|
||||
line_points = _gx_display_driver_generic_wide_line_points_calculate(context, xstart, ystart,
|
||||
xend, yend, brush_width, GX_TRUE);
|
||||
|
||||
if (display -> gx_display_rotation_angle)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_wide_line_fill(context, line_points);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_generic_wide_line_fill(context, line_points);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
context -> gx_draw_context_brush.gx_brush_alpha = old_alpha;
|
||||
|
637
common/src/gx_display_driver_generic_rotated_alphamap_draw.c
Normal file
637
common/src/gx_display_driver_generic_rotated_alphamap_draw.c
Normal file
@ -0,0 +1,637 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
#if defined GX_BRUSH_ALPHA_SUPPORT
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles writing with brush alpha */
|
||||
/* of uncompressed alpha map file. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha alpha value from 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_alphamap_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp, GX_UBYTE alpha)
|
||||
{
|
||||
INT xval;
|
||||
INT yval;
|
||||
GX_UBYTE *getrowalpha;
|
||||
GX_CONST GX_UBYTE *getalpha;
|
||||
GX_UBYTE combined_alpha;
|
||||
GX_COLOR fill_color;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
|
||||
/* Pick up clip rectangle. */
|
||||
clip = context -> gx_draw_context_clip;
|
||||
|
||||
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
|
||||
|
||||
/* Pick up context fill color. */
|
||||
fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
getrowalpha = (UCHAR *)(pmp -> gx_pixelmap_data);
|
||||
getrowalpha += (pmp -> gx_pixelmap_height) * (rotated_clip.gx_rectangle_top - ypos);
|
||||
getrowalpha += (rotated_clip.gx_rectangle_left - xpos);
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
getalpha = getrowalpha;
|
||||
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
combined_alpha = (GX_UBYTE)((*getalpha++) * alpha / 255);
|
||||
blend_func(context, xval, yval, fill_color, combined_alpha);
|
||||
}
|
||||
|
||||
getrowalpha += pmp -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles writing with brush alpha */
|
||||
/* of compressed alpha map file. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* alpha alpha value from 0 to 255 */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_alphamap_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp, GX_UBYTE alpha)
|
||||
{
|
||||
INT yval;
|
||||
INT xval;
|
||||
GX_CONST GX_UBYTE *get;
|
||||
GX_UBYTE count;
|
||||
GX_UBYTE falpha;
|
||||
GX_COLOR fill_color;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
GX_UBYTE combined_alpha;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
|
||||
/* Pick up clip rectangle. */
|
||||
clip = context -> gx_draw_context_clip;
|
||||
|
||||
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
|
||||
|
||||
/* Pick up context fill color. */
|
||||
fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
get = (GX_CONST GX_UBYTE *)pmp -> gx_pixelmap_data;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
/* compressed with no alpha is a two-byte count and two-byte pixel value */
|
||||
|
||||
/* first, skip to the starting row */
|
||||
for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++)
|
||||
{
|
||||
xval = 0;
|
||||
while (xval < pmp -> gx_pixelmap_height)
|
||||
{
|
||||
count = *get++;
|
||||
|
||||
if (count & 0x80)
|
||||
{
|
||||
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||
get++; /* skip repeated pixel value */
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
get += count; /* skip raw pixel values */
|
||||
}
|
||||
xval += count;
|
||||
}
|
||||
}
|
||||
|
||||
/* now we are on the first visible row, copy pixels until we get
|
||||
to the enf of the last visible row
|
||||
*/
|
||||
|
||||
while (yval <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
xval = xpos;
|
||||
|
||||
while (xval < xpos + pmp -> gx_pixelmap_height)
|
||||
{
|
||||
count = *get++;
|
||||
|
||||
if (count & 0x80)
|
||||
{
|
||||
/* repeated value */
|
||||
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||
falpha = *get++;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||
xval <= rotated_clip.gx_rectangle_right)
|
||||
{
|
||||
combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
|
||||
blend_func(context, xval, yval, fill_color, combined_alpha);
|
||||
}
|
||||
xval++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* string of non-repeated values */
|
||||
count++;
|
||||
while (count--)
|
||||
{
|
||||
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||
xval <= rotated_clip.gx_rectangle_right)
|
||||
{
|
||||
combined_alpha = (GX_UBYTE)((*get) * alpha / 255);
|
||||
blend_func(context, xval, yval, fill_color, combined_alpha);
|
||||
}
|
||||
get++;
|
||||
xval++;
|
||||
}
|
||||
}
|
||||
}
|
||||
yval++;
|
||||
}
|
||||
}
|
||||
#endif /* GX_BRUSH_ALPHA_SUPPORT*/
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_raw_draw */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles writing of uncompressed */
|
||||
/* alpha map file. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_alphamap_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_generic_rotated_alphamap_raw_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp)
|
||||
{
|
||||
INT xval;
|
||||
INT yval;
|
||||
GX_UBYTE *getrowalpha;
|
||||
GX_CONST GX_UBYTE *getalpha;
|
||||
GX_COLOR fill_color;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
|
||||
/* Pick up clip rectangle. */
|
||||
clip = context -> gx_draw_context_clip;
|
||||
|
||||
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
|
||||
|
||||
/* Pick up context fill color. */
|
||||
fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
getrowalpha = (UCHAR *)(pmp -> gx_pixelmap_data);
|
||||
getrowalpha += (pmp -> gx_pixelmap_height) * (rotated_clip.gx_rectangle_top - ypos);
|
||||
getrowalpha += (rotated_clip.gx_rectangle_left - xpos);
|
||||
|
||||
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||
{
|
||||
getalpha = getrowalpha;
|
||||
|
||||
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||
{
|
||||
blend_func(context, xval, yval, fill_color, *getalpha++);
|
||||
}
|
||||
|
||||
getrowalpha += pmp -> gx_pixelmap_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_compressed_draw */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that handles writing of compressed */
|
||||
/* alpha map file. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pixelmap Pointer to GX_PIXELMAP struct */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
//* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_alphamap_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_generic_rotated_alphamap_compressed_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp)
|
||||
{
|
||||
INT yval;
|
||||
INT xval;
|
||||
GX_CONST GX_UBYTE *get;
|
||||
GX_UBYTE count;
|
||||
GX_UBYTE pixel;
|
||||
GX_COLOR fill_color;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE rotated_clip;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||
|
||||
/* Pick up clip rectangle. */
|
||||
clip = context->gx_draw_context_clip;
|
||||
|
||||
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
|
||||
|
||||
/* Pick up context fill color. */
|
||||
fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
get = (GX_CONST GX_UBYTE *)pmp -> gx_pixelmap_data;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pmp -> gx_pixelmap_width;
|
||||
rotated_clip.gx_rectangle_left = clip -> gx_rectangle_top;
|
||||
rotated_clip.gx_rectangle_right = clip -> gx_rectangle_bottom;
|
||||
rotated_clip.gx_rectangle_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_right - 1);
|
||||
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - clip -> gx_rectangle_left - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pmp -> gx_pixelmap_height;
|
||||
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_bottom - 1);
|
||||
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - clip -> gx_rectangle_top - 1);
|
||||
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
/* compressed with no alpha is a two-byte count and two-byte pixel value */
|
||||
|
||||
/* first, skip to the starting row */
|
||||
for (yval = ypos; yval < rotated_clip.gx_rectangle_top; yval++)
|
||||
{
|
||||
xval = 0;
|
||||
while (xval < pmp -> gx_pixelmap_height)
|
||||
{
|
||||
count = *get++;
|
||||
|
||||
if (count & 0x80)
|
||||
{
|
||||
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||
get++; /* skip repeated pixel value */
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
get += count; /* skip raw pixel values */
|
||||
}
|
||||
xval += count;
|
||||
}
|
||||
}
|
||||
|
||||
/* now we are on the first visible row, copy pixels until we get
|
||||
to the enf of the last visible row
|
||||
*/
|
||||
|
||||
while (yval <= rotated_clip.gx_rectangle_bottom)
|
||||
{
|
||||
xval = xpos;
|
||||
|
||||
while (xval < xpos + pmp -> gx_pixelmap_height)
|
||||
{
|
||||
count = *get++;
|
||||
|
||||
if (count & 0x80)
|
||||
{
|
||||
/* repeated value */
|
||||
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||
pixel = *get++;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||
xval <= rotated_clip.gx_rectangle_right)
|
||||
{
|
||||
blend_func(context, xval, yval, fill_color, pixel);
|
||||
}
|
||||
xval++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* string of non-repeated values */
|
||||
count++;
|
||||
while (count--)
|
||||
{
|
||||
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||
xval <= rotated_clip.gx_rectangle_right)
|
||||
{
|
||||
blend_func(context, xval, yval, fill_color, *get);
|
||||
}
|
||||
get++;
|
||||
xval++;
|
||||
}
|
||||
}
|
||||
}
|
||||
yval++;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function blends the context fill color with the canvas */
|
||||
/* background. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xpos x-coord of top-left draw point*/
|
||||
/* ypos y-coord of top-left draw point*/
|
||||
/* pmp Pointer to GX_PIXELMAP struct */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw */
|
||||
/* Real display driver alphamap */
|
||||
/* draw function */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_raw_alpha_draw */
|
||||
/* Real display driver alphamap */
|
||||
/* draw function */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_compressed_draw */
|
||||
/* Real display driver alphamap */
|
||||
/* draw function */
|
||||
/* _gx_display_driver_generic_rotated_alphamap_raw_draw */
|
||||
/* Real display driver alphamap */
|
||||
/* draw function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* GUIX default draw funtions */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_alphamap_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pmp)
|
||||
{
|
||||
#if defined GX_BRUSH_ALPHA_SUPPORT
|
||||
GX_UBYTE alpha;
|
||||
|
||||
alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
if (alpha == 0)
|
||||
{
|
||||
/* Nothing to drawn. Just return. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (alpha != 0xff)
|
||||
{
|
||||
if (pmp -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_alphamap_compressed_alpha_draw(context, xpos, ypos, pmp, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_generic_rotated_alphamap_raw_alpha_draw(context, xpos, ypos, pmp, alpha);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pmp -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_alphamap_compressed_draw(context, xpos, ypos, pmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_generic_rotated_alphamap_raw_draw(context, xpos, ypos, pmp);
|
||||
}
|
||||
}
|
||||
|
526
common/src/gx_display_driver_generic_rotated_arc_fill.c
Normal file
526
common/src/gx_display_driver_generic_rotated_arc_fill.c
Normal file
@ -0,0 +1,526 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_arc_fill PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Display driver to fill circle sector. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xcenter x-coord of center of circle */
|
||||
/* ycenter y-coord of center of circle */
|
||||
/* r Radius of circle */
|
||||
/* start_angle The start angle of circle arc */
|
||||
/* end_angle The end angle of circle arc */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_horizontal_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal line draw routine*/
|
||||
/* _gx_display_driver_arc_clipping_get Get an arc clipping. */
|
||||
/* _gx_utility_rectangle_point_detect Detect whether a pixel is */
|
||||
/* inside rectangle */
|
||||
/* _gx_display_driver_circle_point_get Get point coord on a circle */
|
||||
/* [gx_display_driver_horizontal_pixelmap_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal pixelmap line */
|
||||
/* draw function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_arc_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_ARC_DRAWING_SUPPORT)
|
||||
VOID _gx_display_driver_generic_rotated_arc_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle)
|
||||
{
|
||||
|
||||
GX_DISPLAY *display;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE arc_clip[4];
|
||||
GX_BRUSH *brush;
|
||||
GX_POINT point;
|
||||
INT sign[4][2] = {{1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
|
||||
INT *pLineEnds;
|
||||
INT xmin;
|
||||
INT xmax;
|
||||
INT xstart;
|
||||
INT xend;
|
||||
INT ystart;
|
||||
INT yend;
|
||||
INT curx;
|
||||
INT cury;
|
||||
INT nextx;
|
||||
INT nexty;
|
||||
INT dx;
|
||||
INT dy;
|
||||
INT Index;
|
||||
INT Index1;
|
||||
INT width;
|
||||
INT xsign;
|
||||
INT ysign;
|
||||
INT decision;
|
||||
VOID (*line_draw)(GX_DRAW_CONTEXT *context, INT x1, INT x2, INT ypos, INT width, GX_COLOR color);
|
||||
GX_PIXELMAP *pixelmap = GX_NULL;
|
||||
INT ypos;
|
||||
INT skip_line;
|
||||
GX_FILL_PIXELMAP_INFO info;
|
||||
INT inner_offset;
|
||||
|
||||
display = context -> gx_draw_context_display;
|
||||
brush = &context -> gx_draw_context_brush;
|
||||
inner_offset = brush -> gx_brush_width;
|
||||
line_draw = display -> gx_display_driver_vertical_line_draw;
|
||||
clip = context -> gx_draw_context_clip;
|
||||
|
||||
if (inner_offset)
|
||||
{
|
||||
inner_offset -= 1;
|
||||
inner_offset >>= 1;
|
||||
}
|
||||
|
||||
if (r <= (UINT)inner_offset)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (brush -> gx_brush_style & GX_BRUSH_PIXELMAP_FILL)
|
||||
{
|
||||
if (brush -> gx_brush_pixelmap == GX_NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Pick up brush pixelmap. */
|
||||
pixelmap = brush -> gx_brush_pixelmap;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_format != display -> gx_display_color_format)
|
||||
{
|
||||
/* Display driver only support its native format pixelmap.*/
|
||||
/* Nothing should be drawn if pixelmap format isn't support. */
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(GX_FILL_PIXELMAP_INFO));
|
||||
|
||||
info.pixelmap = brush -> gx_brush_pixelmap;
|
||||
info.current_pixel_ptr = (GX_UBYTE *)info.pixelmap -> gx_pixelmap_data;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
info.current_aux_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
}
|
||||
|
||||
r = (UINT)(r - (UINT)(inner_offset >> 1));
|
||||
|
||||
xmax = xcenter + (INT)r;
|
||||
xmin = xcenter - (INT)r;
|
||||
|
||||
/* Get two endpoint of the arc. */
|
||||
_gx_utility_circle_point_get(xcenter, ycenter, r, start_angle, &point);
|
||||
|
||||
xstart = point.gx_point_x;
|
||||
ystart = point.gx_point_y;
|
||||
|
||||
_gx_utility_circle_point_get(xcenter, ycenter, r, end_angle, &point);
|
||||
|
||||
xend = point.gx_point_x;
|
||||
yend = point.gx_point_y;
|
||||
|
||||
skip_line = 0;
|
||||
|
||||
/* Calculate minimum y line. */
|
||||
if (((start_angle < 180) && (end_angle < 180)) ||
|
||||
((start_angle > 180) && (end_angle < 540)))
|
||||
{
|
||||
if (xstart > xend)
|
||||
{
|
||||
xmin = xend;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmin = xstart;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip -> gx_rectangle_left > xmin)
|
||||
{
|
||||
xmin = clip -> gx_rectangle_left;
|
||||
}
|
||||
|
||||
/* Calculate maximum y line. */
|
||||
if (end_angle < 360)
|
||||
{
|
||||
if (xstart > xend)
|
||||
{
|
||||
xmax = xstart;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmax = xend;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip -> gx_rectangle_right < xmax)
|
||||
{
|
||||
xmax = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
width = xmax - xmin + 1;
|
||||
|
||||
/* default the point array to being off the screen on both sides: */
|
||||
pLineEnds = _gx_system_scratchpad;
|
||||
|
||||
for (Index = 0; Index < width * 2; Index += 2)
|
||||
{
|
||||
pLineEnds[Index] = 2000;
|
||||
pLineEnds[Index + 1] = 0;
|
||||
}
|
||||
|
||||
/* Get the clipping rectangles of the circle arc. */
|
||||
_gx_display_driver_arc_clipping_get(xcenter, ycenter, r, start_angle, end_angle, &arc_clip[0], &arc_clip[1], &arc_clip[2], &arc_clip[3]);
|
||||
|
||||
curx = 0;
|
||||
cury = (INT)r;
|
||||
decision = (INT)(5 - 4 * r);
|
||||
|
||||
while (curx <= cury)
|
||||
{
|
||||
for (Index = 0; Index < 4; Index++)
|
||||
{
|
||||
point.gx_point_x = (GX_VALUE)(curx * sign[Index][0] + xcenter);
|
||||
point.gx_point_y = (GX_VALUE)(cury * sign[Index][1] + ycenter);
|
||||
|
||||
if ((point.gx_point_x >= xmin) &&
|
||||
(point.gx_point_x <= xmax))
|
||||
{
|
||||
if (_gx_utility_rectangle_point_detect(&arc_clip[0], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[1], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[2], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[3], point))
|
||||
{
|
||||
Index1 = (point.gx_point_x - xmin) << 1;
|
||||
if (point.gx_point_y < pLineEnds[Index1])
|
||||
{
|
||||
pLineEnds[Index1] = point.gx_point_y;
|
||||
}
|
||||
|
||||
if (point.gx_point_y > pLineEnds[Index1 + 1])
|
||||
{
|
||||
pLineEnds[Index1 + 1] = point.gx_point_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
point.gx_point_x = (GX_VALUE)(cury * sign[Index][0] + xcenter);
|
||||
point.gx_point_y = (GX_VALUE)(curx * sign[Index][1] + ycenter);
|
||||
|
||||
if ((point.gx_point_x >= xmin) &&
|
||||
(point.gx_point_x <= xmax))
|
||||
{
|
||||
if (_gx_utility_rectangle_point_detect(&arc_clip[0], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[1], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[2], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[3], point))
|
||||
{
|
||||
Index1 = (point.gx_point_x - xmin) << 1;
|
||||
if (point.gx_point_y < pLineEnds[Index1])
|
||||
{
|
||||
pLineEnds[Index1] = point.gx_point_y;
|
||||
}
|
||||
|
||||
if (point.gx_point_y > pLineEnds[Index1 + 1])
|
||||
{
|
||||
pLineEnds[Index1 + 1] = point.gx_point_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (decision < 0)
|
||||
{
|
||||
decision += 8 * curx + 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
decision += 8 * (curx - cury) + 20;
|
||||
cury--;
|
||||
}
|
||||
curx++;
|
||||
}
|
||||
|
||||
/* Fill in the point array by using Breshenhams line for
|
||||
the line that connect two endpoints of the arc. */
|
||||
|
||||
dx = GX_ABS(xend - xstart);
|
||||
dy = GX_ABS(yend - ystart);
|
||||
|
||||
if (xstart != xend)
|
||||
{
|
||||
/* Horizontal Line. */
|
||||
if (ystart == yend)
|
||||
{
|
||||
if (xstart > xend)
|
||||
{
|
||||
GX_SWAP_VALS(xstart, xend);
|
||||
GX_SWAP_VALS(ystart, yend);
|
||||
}
|
||||
|
||||
for (curx = xstart; curx <= xend; curx++)
|
||||
{
|
||||
if ((curx >= xmin) &&
|
||||
(curx <= xmax))
|
||||
{
|
||||
Index = (curx - xmin) << 1;
|
||||
if (ystart <= pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = ystart;
|
||||
}
|
||||
|
||||
if (ystart > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = ystart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Simple Line. */
|
||||
if (((dx >= dy && (xstart > xend)) ||
|
||||
((dy > dx) && ystart > yend)))
|
||||
{
|
||||
GX_SWAP_VALS(xend, xstart);
|
||||
GX_SWAP_VALS(yend, ystart);
|
||||
}
|
||||
|
||||
xsign = (xend - xstart) / dx;
|
||||
ysign = (yend - ystart) / dy;
|
||||
|
||||
if (dx >= dy)
|
||||
{
|
||||
for (curx = xstart, cury = ystart, nextx = xend, nexty = yend,
|
||||
decision = (dx >> 1); curx <= nextx; curx++, nextx--,
|
||||
decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += ysign;
|
||||
nexty -= ysign;
|
||||
}
|
||||
|
||||
if ((curx >= xmin) && (curx <= xmax))
|
||||
{
|
||||
Index = (curx - xmin) << 1;
|
||||
|
||||
if (cury < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = cury;
|
||||
}
|
||||
|
||||
if (cury > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = cury;
|
||||
}
|
||||
}
|
||||
|
||||
if ((nextx >= xmin) && (nextx <= xmax))
|
||||
{
|
||||
Index1 = (nextx - xmin) << 1;
|
||||
|
||||
if (nexty < pLineEnds[Index1])
|
||||
{
|
||||
pLineEnds[Index1] = nexty;
|
||||
}
|
||||
|
||||
if (nexty > pLineEnds[Index1 + 1])
|
||||
{
|
||||
pLineEnds[Index1 + 1] = nexty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (curx = xstart, cury = ystart, nextx = xend, nexty = yend,
|
||||
decision = (dy >> 1); cury <= nexty; cury++, nexty--,
|
||||
decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += xsign;
|
||||
nextx -= xsign;
|
||||
}
|
||||
|
||||
if ((curx >= xmin) && (curx <= xmax))
|
||||
{
|
||||
Index = (curx - xmin) << 1;
|
||||
if (cury < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = cury;
|
||||
}
|
||||
|
||||
if (cury > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = cury;
|
||||
}
|
||||
}
|
||||
|
||||
if ((nextx >= xmin) && (nextx <= xmax))
|
||||
{
|
||||
Index1 = (nextx - xmin) << 1;
|
||||
|
||||
if (nexty < pLineEnds[Index1])
|
||||
{
|
||||
pLineEnds[Index1] = nexty;
|
||||
}
|
||||
|
||||
if (nexty > pLineEnds[Index1 + 1])
|
||||
{
|
||||
pLineEnds[Index1 + 1] = nexty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (brush -> gx_brush_style & GX_BRUSH_PIXELMAP_FILL)
|
||||
{
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
skip_line = (xmax - (xcenter - (INT)r) + 1) % pixelmap -> gx_pixelmap_width;
|
||||
|
||||
/* Skip the un-draw line.*/
|
||||
if (skip_line)
|
||||
{
|
||||
skip_line = pixelmap -> gx_pixelmap_width - skip_line;
|
||||
}
|
||||
|
||||
xstart = xmax;
|
||||
Index = (width - 1) * 2;
|
||||
xsign = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
skip_line = (xmin - clip -> gx_rectangle_left);
|
||||
|
||||
xstart = xmin;
|
||||
Index = 0;
|
||||
xsign = 1;
|
||||
}
|
||||
|
||||
/* Skip the un-draw line.*/
|
||||
if (skip_line)
|
||||
{
|
||||
info.draw = GX_FALSE;
|
||||
while (skip_line--)
|
||||
{
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, cury, &info);
|
||||
}
|
||||
}
|
||||
|
||||
info.draw = GX_TRUE;
|
||||
ypos = ycenter - (INT)r;
|
||||
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] < clip -> gx_rectangle_top)
|
||||
{
|
||||
pLineEnds[Index] = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (pLineEnds[Index + 1] > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
pLineEnds[Index + 1] = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
/* Filling arc area with pixelmap. */
|
||||
info.x_offset = pLineEnds[Index] - ypos;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], xstart, &info);
|
||||
|
||||
xstart += xsign;
|
||||
Index += xsign;
|
||||
Index += xsign;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = 0;
|
||||
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] < clip -> gx_rectangle_top)
|
||||
{
|
||||
pLineEnds[Index] = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (pLineEnds[Index + 1] > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
pLineEnds[Index + 1] = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
/* Fill arc with horizontal lines. */
|
||||
line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], curx, 1, brush -> gx_brush_fill_color);
|
||||
|
||||
Index += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
289
common/src/gx_display_driver_generic_rotated_circle_fill.c
Normal file
289
common/src/gx_display_driver_generic_rotated_circle_fill.c
Normal file
@ -0,0 +1,289 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
|
||||
#if defined(GX_ARC_DRAWING_SUPPORT)
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_circle_fill PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Display driver fill circle. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xcenter x-coord of center of circle */
|
||||
/* ycenter y-coord of center of circle */
|
||||
/* r Radius of circle */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_horizontal_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal line draw routine*/
|
||||
/* [gx_display_driver_horizontal_pixelmap_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal pixelmap line */
|
||||
/* draw function */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_circle_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r)
|
||||
{
|
||||
GX_DISPLAY *display;
|
||||
GX_BRUSH *brush;
|
||||
GX_RECTANGLE *clip;
|
||||
INT ypos;
|
||||
INT curx;
|
||||
INT cury;
|
||||
INT xmin;
|
||||
INT xmax;
|
||||
INT yi;
|
||||
INT x1;
|
||||
INT y1;
|
||||
INT y2;
|
||||
INT width;
|
||||
INT loop;
|
||||
INT skip_line;
|
||||
GX_PIXELMAP *pixelmap = GX_NULL;
|
||||
GX_FILL_PIXELMAP_INFO info;
|
||||
INT *pLineEnds;
|
||||
INT Index;
|
||||
GX_BYTE sign[4][2] = {{1, 1}, {-1, 1}, {1, 1}, {-1, 1}};
|
||||
INT error;
|
||||
GX_COLOR fill_color;
|
||||
GX_BYTE xsign;
|
||||
|
||||
display = context -> gx_draw_context_display;
|
||||
clip = context -> gx_draw_context_clip;
|
||||
brush = &context -> gx_draw_context_brush;
|
||||
|
||||
if (brush -> gx_brush_style & GX_BRUSH_PIXELMAP_FILL)
|
||||
{
|
||||
if (brush -> gx_brush_pixelmap == GX_NULL)
|
||||
{
|
||||
/* Nothing should be drawn if pixelmap isn't set with GX_BRUSH_PIXELMAP_FILL style. */
|
||||
return;
|
||||
}
|
||||
|
||||
pixelmap = brush -> gx_brush_pixelmap;
|
||||
if (pixelmap -> gx_pixelmap_format != display -> gx_display_color_format)
|
||||
{
|
||||
/* Display driver only support its native format pixelmap.*/
|
||||
/* Nothing should be drawn if pixelmap format isn't support. */
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(GX_FILL_PIXELMAP_INFO));
|
||||
|
||||
/* If filling pixelmap, set fill pixelmap info. */
|
||||
info.pixelmap = pixelmap;
|
||||
info.current_pixel_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||
if (pixelmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
info.current_aux_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
}
|
||||
|
||||
xmin = xcenter - (INT)r;
|
||||
xmax = xcenter + (INT)r;
|
||||
|
||||
/* Calculate minimum y line. */
|
||||
if (clip -> gx_rectangle_left > xmin)
|
||||
{
|
||||
xmin = clip -> gx_rectangle_left;
|
||||
}
|
||||
|
||||
/* Calculat maximum y line. */
|
||||
if (clip -> gx_rectangle_right < xmax)
|
||||
{
|
||||
xmax = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
width = xmax - xmin + 1;
|
||||
pLineEnds = _gx_system_scratchpad;
|
||||
|
||||
/* default the point array to being off the screen on both sides: */
|
||||
for (loop = 0; loop < width * 2; loop += 2)
|
||||
{
|
||||
pLineEnds[loop] = 2000;
|
||||
pLineEnds[loop + 1] = 0;
|
||||
}
|
||||
|
||||
curx = 0;
|
||||
cury = (INT)r;
|
||||
error = 0;
|
||||
|
||||
/* For shapes pixelmap-fill driver function, it must fill shapes line by line from up to bottom.
|
||||
So this contains two steps here: first, calculate the boudary point of circle; Second, draw pixelmap line by line. */
|
||||
while (curx <= cury)
|
||||
{
|
||||
for (loop = 0; loop < 4; loop++)
|
||||
{
|
||||
/* Upper half part. */
|
||||
if (loop < 2)
|
||||
{
|
||||
x1 = curx * sign[loop][0];
|
||||
y1 = (cury - 1) * sign[loop][1];
|
||||
}
|
||||
/* lower half part. */
|
||||
else
|
||||
{
|
||||
x1 = (cury - 1) * sign[loop][0];
|
||||
y1 = curx * sign[loop][1];
|
||||
}
|
||||
|
||||
y2 = -y1;
|
||||
y1 += ycenter;
|
||||
y2 += ycenter;
|
||||
x1 += xcenter;
|
||||
|
||||
if ((x1 >= xmin) && (x1 <= xmax))
|
||||
{
|
||||
if (y1 > y2)
|
||||
{
|
||||
GX_SWAP_VALS(y1, y2);
|
||||
}
|
||||
|
||||
if (y1 < clip -> gx_rectangle_top)
|
||||
{
|
||||
y1 = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (y2 > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
y2 = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
Index = (x1 - xmin) << 1;
|
||||
pLineEnds[Index] = y1;
|
||||
pLineEnds[Index + 1] = y2;
|
||||
}
|
||||
}
|
||||
|
||||
curx++;
|
||||
yi = (INT)(r * r) - curx * curx;
|
||||
error = (cury << 8) - (INT)(_gx_utility_math_sqrt((UINT)(yi << 10)) << 3);
|
||||
|
||||
while (error >= 255)
|
||||
{
|
||||
error -= 255;
|
||||
cury--;
|
||||
}
|
||||
}
|
||||
|
||||
if (pixelmap)
|
||||
{
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
skip_line = (xmax - (xcenter - (INT)r) + 1) % pixelmap -> gx_pixelmap_width;
|
||||
|
||||
if (skip_line)
|
||||
{
|
||||
skip_line = pixelmap -> gx_pixelmap_width - skip_line;
|
||||
}
|
||||
|
||||
x1 = xmax;
|
||||
xsign = -1;
|
||||
Index = (width - 1) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
skip_line = (xmin - clip -> gx_rectangle_left);
|
||||
|
||||
x1 = xmin;
|
||||
xsign = 1;
|
||||
Index = 0;
|
||||
}
|
||||
|
||||
if (skip_line)
|
||||
{
|
||||
|
||||
info.draw = GX_FALSE;
|
||||
while (skip_line--)
|
||||
{
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, 0, &info);
|
||||
}
|
||||
}
|
||||
|
||||
info.draw = GX_TRUE;
|
||||
ypos = ycenter - (INT)r;
|
||||
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] <= pLineEnds[Index + 1])
|
||||
{
|
||||
info.x_offset = pLineEnds[Index] - ypos;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], x1, &info);
|
||||
}
|
||||
|
||||
x1 += xsign;
|
||||
Index += xsign;
|
||||
Index += xsign;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = 0;
|
||||
fill_color = brush -> gx_brush_fill_color;
|
||||
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] <= pLineEnds[Index + 1])
|
||||
{
|
||||
display -> gx_display_driver_vertical_line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], curx, 1, fill_color);
|
||||
}
|
||||
Index += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
316
common/src/gx_display_driver_generic_rotated_ellipse_fill.c
Normal file
316
common/src/gx_display_driver_generic_rotated_ellipse_fill.c
Normal file
@ -0,0 +1,316 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
#if defined(GX_ARC_DRAWING_SUPPORT)
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_ellipse_fill PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Display driver to draw a filled ellipse. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xcenter x-coord of center of ellipse */
|
||||
/* ycenter y-coord of center of ellipse */
|
||||
/* a Length of the Semi-major Axis */
|
||||
/* b Length of the Semi-minor Axis */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_horizontal_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal line draw routine*/
|
||||
/* [gx_display_driver_horizontal_pixelmap_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal pixelmap line */
|
||||
/* draw function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_ellipse_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, INT a, INT b)
|
||||
{
|
||||
/* The ellipse fill function follows Bresenham ellipse algorithm while
|
||||
connecting the two point that symmetric with respect to y-axis. */
|
||||
|
||||
GX_DISPLAY *display;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_BRUSH *brush;
|
||||
INT x1;
|
||||
INT x;
|
||||
INT y;
|
||||
INT y0;
|
||||
INT y1;
|
||||
INT d;
|
||||
INT sign[2] = {1, -1};
|
||||
INT *pLineEnds;
|
||||
INT index;
|
||||
INT width;
|
||||
INT Index;
|
||||
INT aa;
|
||||
INT bb;
|
||||
INT ypos;
|
||||
INT xmin;
|
||||
INT xmax;
|
||||
INT skip_line;
|
||||
GX_PIXELMAP *pixelmap = GX_NULL;
|
||||
GX_COLOR fill_color;
|
||||
GX_FILL_PIXELMAP_INFO info;
|
||||
GX_BYTE xsign;
|
||||
|
||||
|
||||
display = context -> gx_draw_context_display;
|
||||
clip = context -> gx_draw_context_clip;
|
||||
brush = &context -> gx_draw_context_brush;
|
||||
|
||||
if (brush -> gx_brush_style & GX_BRUSH_PIXELMAP_FILL)
|
||||
{
|
||||
if (brush -> gx_brush_pixelmap == GX_NULL)
|
||||
{
|
||||
/* Nothing should be drawn if pixelmap isn't set with GX_BRUSH_PIXELMAP_FILL style. */
|
||||
return;
|
||||
}
|
||||
|
||||
pixelmap = brush -> gx_brush_pixelmap;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_format != display -> gx_display_color_format)
|
||||
{
|
||||
/* Display driver only support its native format pixelmap.*/
|
||||
/* Nothing should be drawn if pixelmap format isn't support. */
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(GX_FILL_PIXELMAP_INFO));
|
||||
|
||||
info.pixelmap = brush -> gx_brush_pixelmap;
|
||||
info.current_pixel_ptr = (GX_UBYTE *)info.pixelmap -> gx_pixelmap_data;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
info.current_aux_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
}
|
||||
|
||||
xmin = xcenter - a;
|
||||
xmax = xcenter + a;
|
||||
|
||||
/* Calculate minimum y line. */
|
||||
if (clip -> gx_rectangle_left > xmin)
|
||||
{
|
||||
xmin = clip -> gx_rectangle_left;
|
||||
}
|
||||
|
||||
/* Calculate maximum y line. */
|
||||
if (clip -> gx_rectangle_right < xmax)
|
||||
{
|
||||
xmax = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
width = (xmax - xmin + 1);
|
||||
pLineEnds = _gx_system_scratchpad;
|
||||
|
||||
/* default the point array to being off the screen on both sides: */
|
||||
for (Index = 0; Index < width * 2; Index += 2)
|
||||
{
|
||||
pLineEnds[Index] = 2000;
|
||||
pLineEnds[Index + 1] = 0;
|
||||
}
|
||||
|
||||
aa = a * a;
|
||||
bb = b * b;
|
||||
x = 0;
|
||||
y = b;
|
||||
d = (bb << 2) + aa * (1 - (b << 1));
|
||||
|
||||
/* Region I of the first quarter of the ellipse. */
|
||||
while (2 * bb * (x + 1) < aa * (2 * y - 1))
|
||||
{
|
||||
y0 = ycenter - y;
|
||||
y1 = ycenter + y;
|
||||
|
||||
if (y0 < clip -> gx_rectangle_top)
|
||||
{
|
||||
y0 = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (y1 > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
y1 = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
for (index = 0; index < 2; index++)
|
||||
{
|
||||
x1 = x * sign[index] + xcenter;
|
||||
|
||||
if ((x1 >= xmin) && (x1 <= xmax))
|
||||
{
|
||||
Index = (x1 - xmin) << 1;
|
||||
pLineEnds[Index] = y0;
|
||||
pLineEnds[Index + 1] = y1;
|
||||
}
|
||||
}
|
||||
|
||||
if (d < 0)
|
||||
{
|
||||
d += (bb << 1) * ((x << 1) + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
d += (bb << 1) * ((x << 1) + 3) + (aa << 2) * (1 - y);
|
||||
y--;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
|
||||
d = bb * x * (x + 1) + aa * y * (y - 1) - aa * bb;
|
||||
|
||||
/* Region II of the first quarter of the ellipse. */
|
||||
while (y >= 0)
|
||||
{
|
||||
y0 = ycenter - y;
|
||||
y1 = ycenter + y;
|
||||
|
||||
if (y0 < clip -> gx_rectangle_top)
|
||||
{
|
||||
y0 = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (y1 > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
y1 = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
for (index = 0; index < 2; index++)
|
||||
{
|
||||
x1 = x * sign[index] + xcenter;
|
||||
|
||||
if ((x1 >= xmin) && (x1 <= xmax))
|
||||
{
|
||||
Index = (x1 - xmin) << 1;
|
||||
pLineEnds[Index] = y0;
|
||||
pLineEnds[Index + 1] = y1;
|
||||
}
|
||||
}
|
||||
y--;
|
||||
|
||||
if (d < 0)
|
||||
{
|
||||
x++;
|
||||
d += (bb << 1) * (x + 1) - aa * (1 + (y << 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
d += aa * (-1 - (y << 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (pixelmap != GX_NULL)
|
||||
{
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
skip_line = (xmax - (xcenter - a) + 1) % pixelmap -> gx_pixelmap_width;
|
||||
|
||||
if (skip_line)
|
||||
{
|
||||
skip_line = pixelmap -> gx_pixelmap_width - skip_line;
|
||||
}
|
||||
|
||||
x1 = xmax;
|
||||
xsign = -1;
|
||||
Index = (width - 1) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
skip_line = (xmin - clip -> gx_rectangle_left);
|
||||
|
||||
x1 = xmin;
|
||||
xsign = 1;
|
||||
Index = 0;
|
||||
}
|
||||
|
||||
if (skip_line)
|
||||
{
|
||||
info.draw = GX_FALSE;
|
||||
while (skip_line--)
|
||||
{
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, 0, &info);
|
||||
}
|
||||
}
|
||||
|
||||
info.draw = GX_TRUE;
|
||||
ypos = ycenter - b;
|
||||
|
||||
for (x = xmin; x <= xmax; x++)
|
||||
{
|
||||
info.x_offset = pLineEnds[Index] - ypos;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], x1, &info);
|
||||
|
||||
x1 += xsign;
|
||||
Index += xsign;
|
||||
Index += xsign;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = 0;
|
||||
fill_color = brush -> gx_brush_fill_color;
|
||||
|
||||
for (x = xmin; x <= xmax; x++)
|
||||
{
|
||||
display -> gx_display_driver_vertical_line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], x, 1, fill_color);
|
||||
Index += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
294
common/src/gx_display_driver_generic_rotated_glyph_4bit_draw.c
Normal file
294
common/src/gx_display_driver_generic_rotated_glyph_4bit_draw.c
Normal file
@ -0,0 +1,294 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_glyph_4bit_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function draws the specified text using the current context, */
|
||||
/* clipped to one viewport */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Draw context */
|
||||
/* draw_area The rectangle where the glyph */
|
||||
/* is drawn to */
|
||||
/* map_offset Offset from the glyph map */
|
||||
/* glyph The glyph structure */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_pixel_blend] Call display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX internal code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph)
|
||||
{
|
||||
GX_UBYTE *glyph_row;
|
||||
GX_UBYTE *glyph_data;
|
||||
UINT row;
|
||||
UINT col;
|
||||
UINT pixel_width = 0;
|
||||
UINT leading_pixel;
|
||||
UINT trailing_pixel;
|
||||
GX_COLOR text_color;
|
||||
UINT y_height;
|
||||
GX_UBYTE alpha;
|
||||
UINT pitch;
|
||||
UINT index;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
|
||||
GX_UBYTE brush_alpha = 0xff;
|
||||
GX_VALUE rotated_map_offset_x;
|
||||
GX_VALUE rotated_map_offset_y;
|
||||
GX_VALUE rotated_left;
|
||||
GX_VALUE rotated_top;
|
||||
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
INT alpha_sum;
|
||||
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
if (brush_alpha == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
text_color = context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
|
||||
y_height = (UINT)(draw_area -> gx_rectangle_right - draw_area -> gx_rectangle_left + 1);
|
||||
|
||||
/* Find the width of the glyph */
|
||||
pitch = glyph -> gx_glyph_height;
|
||||
/* Make it byte-aligned. */
|
||||
pitch = (pitch + 1) >> 1;
|
||||
|
||||
pixel_width = (UINT)(draw_area -> gx_rectangle_bottom - draw_area -> gx_rectangle_top + 1);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_left = draw_area -> gx_rectangle_top;
|
||||
rotated_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - draw_area -> gx_rectangle_right - 1);
|
||||
|
||||
rotated_map_offset_x = map_offset -> gx_point_y;
|
||||
rotated_map_offset_y = (GX_VALUE)(glyph -> gx_glyph_width - map_offset -> gx_point_x - (GX_VALUE)y_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_display_offset_y - draw_area -> gx_rectangle_bottom - 1);
|
||||
rotated_top = draw_area -> gx_rectangle_left;
|
||||
|
||||
rotated_map_offset_x = (GX_VALUE)(glyph -> gx_glyph_height - map_offset -> gx_point_y - (GX_VALUE)pixel_width);
|
||||
rotated_map_offset_y = map_offset -> gx_point_x;
|
||||
}
|
||||
|
||||
glyph_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
|
||||
if (rotated_map_offset_y)
|
||||
{
|
||||
glyph_row = glyph_row + ((INT)pitch * rotated_map_offset_y);
|
||||
}
|
||||
|
||||
glyph_row += (rotated_map_offset_x >> 1);
|
||||
|
||||
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format)
|
||||
|
||||
leading_pixel = (rotated_map_offset_x & 1);
|
||||
|
||||
pixel_width -= leading_pixel;
|
||||
|
||||
trailing_pixel = pixel_width & 1;
|
||||
|
||||
pixel_width = pixel_width >> 1;
|
||||
|
||||
if (brush_alpha == 0xff)
|
||||
{
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
col = 0;
|
||||
glyph_data = glyph_row;
|
||||
|
||||
if (leading_pixel)
|
||||
{
|
||||
alpha = (*glyph_data) & 0x0f;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha << 4));
|
||||
|
||||
if (alpha > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha);
|
||||
}
|
||||
col++;
|
||||
glyph_data++;
|
||||
}
|
||||
|
||||
for (index = 0; index < pixel_width; index++)
|
||||
{
|
||||
alpha = (*glyph_data) & 0xf0;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha >> 4));
|
||||
|
||||
if (alpha > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha);
|
||||
}
|
||||
col++;
|
||||
|
||||
alpha = (*glyph_data) & 0x0f;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha << 4));
|
||||
|
||||
if (alpha > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha);
|
||||
}
|
||||
col++;
|
||||
glyph_data++;
|
||||
}
|
||||
|
||||
if (trailing_pixel)
|
||||
{
|
||||
alpha = (*glyph_data) & 0xf0;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha >> 4));
|
||||
|
||||
if (alpha > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha);
|
||||
}
|
||||
}
|
||||
glyph_row += pitch;
|
||||
}
|
||||
}
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
else
|
||||
{
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
col = 0;
|
||||
glyph_data = glyph_row;
|
||||
|
||||
if (leading_pixel)
|
||||
{
|
||||
alpha = (*glyph_data) & 0x0f;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha << 4));
|
||||
|
||||
alpha_sum = alpha * brush_alpha / 255;
|
||||
|
||||
if (alpha_sum > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha_sum);
|
||||
}
|
||||
col++;
|
||||
glyph_data++;
|
||||
}
|
||||
|
||||
for (index = 0; index < pixel_width; index++)
|
||||
{
|
||||
alpha = (*glyph_data) & 0xf0;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha >> 4));
|
||||
alpha_sum = alpha * brush_alpha / 255;
|
||||
|
||||
if (alpha_sum > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha_sum);
|
||||
}
|
||||
col++;
|
||||
|
||||
alpha = (*glyph_data) & 0x0f;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha << 4));
|
||||
alpha_sum = alpha * brush_alpha / 255;
|
||||
|
||||
if (alpha_sum > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha_sum);
|
||||
}
|
||||
col++;
|
||||
glyph_data++;
|
||||
}
|
||||
|
||||
if (trailing_pixel)
|
||||
{
|
||||
alpha = (*glyph_data) & 0xf0;
|
||||
alpha = (GX_UBYTE)(alpha | (GX_UBYTE)(alpha >> 4));
|
||||
alpha_sum = alpha * brush_alpha / 255;
|
||||
|
||||
if (alpha_sum > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha_sum);
|
||||
}
|
||||
}
|
||||
glyph_row += pitch;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
184
common/src/gx_display_driver_generic_rotated_glyph_8bit_draw.c
Normal file
184
common/src/gx_display_driver_generic_rotated_glyph_8bit_draw.c
Normal file
@ -0,0 +1,184 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_glyph_8bit_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function draws the specified text using the current context, */
|
||||
/* clipped to one viewport */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Draw context */
|
||||
/* draw_position The X and Y coordinate where */
|
||||
/* the glyph is drawn to */
|
||||
/* string String to draw */
|
||||
/* count Count of string characters */
|
||||
/* view view to clip drawing within */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_565rgb_pixel_blend Call display driver pixel */
|
||||
/* blend function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX internal code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_glyph_8bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph)
|
||||
{
|
||||
GX_UBYTE *glyph_row;
|
||||
GX_UBYTE *glyph_data;
|
||||
UINT row;
|
||||
UINT col;
|
||||
UINT pixel_width = 0;
|
||||
GX_COLOR text_color;
|
||||
UINT y_height;
|
||||
GX_UBYTE alpha1;
|
||||
GX_UBYTE brush_alpha = 0xff;
|
||||
GX_VALUE rotated_map_offset_x;
|
||||
GX_VALUE rotated_map_offset_y;
|
||||
GX_VALUE rotated_left;
|
||||
GX_VALUE rotated_top;
|
||||
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color, GX_UBYTE alpha);
|
||||
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||
if (brush_alpha == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
GX_SET_BLEND_FUNCTION(blend_func, context->gx_draw_context_display->gx_display_color_format)
|
||||
|
||||
text_color = context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
|
||||
pixel_width = (UINT)(draw_area -> gx_rectangle_bottom - draw_area -> gx_rectangle_top + 1);
|
||||
y_height = (UINT)(draw_area -> gx_rectangle_right - draw_area -> gx_rectangle_left + 1);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
rotated_left = draw_area -> gx_rectangle_top;
|
||||
rotated_top = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - draw_area -> gx_rectangle_right - 1);
|
||||
|
||||
rotated_map_offset_x = map_offset -> gx_point_y;
|
||||
rotated_map_offset_y = (GX_VALUE)(glyph -> gx_glyph_width - map_offset -> gx_point_x - (GX_VALUE)y_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_display_offset_y - draw_area -> gx_rectangle_bottom - 1);
|
||||
rotated_top = draw_area -> gx_rectangle_left;
|
||||
|
||||
rotated_map_offset_x = (GX_VALUE)(glyph -> gx_glyph_height - map_offset -> gx_point_y - (GX_VALUE)pixel_width);
|
||||
rotated_map_offset_y = map_offset -> gx_point_x;
|
||||
}
|
||||
|
||||
glyph_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
|
||||
if (rotated_map_offset_y)
|
||||
{
|
||||
glyph_row = glyph_row + (glyph -> gx_glyph_height * rotated_map_offset_y);
|
||||
}
|
||||
|
||||
glyph_row += rotated_map_offset_x;
|
||||
|
||||
if (brush_alpha == 0xff)
|
||||
{
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
glyph_data = glyph_row;
|
||||
|
||||
for (col = 0; col < pixel_width; col++)
|
||||
{
|
||||
alpha1 = *glyph_data;
|
||||
|
||||
if (alpha1 > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha1);
|
||||
}
|
||||
glyph_data++;
|
||||
}
|
||||
glyph_row += glyph -> gx_glyph_height;
|
||||
}
|
||||
}
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
else
|
||||
{
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
glyph_data = glyph_row;
|
||||
|
||||
for (col = 0; col < pixel_width; col++)
|
||||
{
|
||||
alpha1 = *glyph_data;
|
||||
alpha1 = (GX_UBYTE)(alpha1 * brush_alpha / 255);
|
||||
|
||||
if (alpha1 > 0)
|
||||
{
|
||||
blend_func(context,
|
||||
rotated_left + (GX_VALUE)col,
|
||||
rotated_top + (GX_VALUE)row,
|
||||
text_color, (GX_UBYTE)alpha1);
|
||||
}
|
||||
|
||||
glyph_data++;
|
||||
}
|
||||
glyph_row += glyph -> gx_glyph_height;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
630
common/src/gx_display_driver_generic_rotated_pie_fill.c
Normal file
630
common/src/gx_display_driver_generic_rotated_pie_fill.c
Normal file
@ -0,0 +1,630 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_simple_pie_fill PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Display driver to fill a pie chart. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xcenter x-coord of center of circle */
|
||||
/* ycenter y-coord of center of circle */
|
||||
/* r Radius of circle */
|
||||
/* start_angle Starting angle */
|
||||
/* end_angle Ending angle */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_arc_clipping_get Get an arc clipping. */
|
||||
/* _gx_utility_rectangle_overlap_detect Detects two rectangles being */
|
||||
/* overlap */
|
||||
/* _gx_utility_rectangle_point_detect Detect whether a pixel is */
|
||||
/* inside rectangle */
|
||||
/* _gx_display_driver_circle_point_get Get point coord on a circle */
|
||||
/* [gx_display_driver_horizontal_pixelmap_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal pixelmap line */
|
||||
/* draw function */
|
||||
/* [gx_display_driver_horizontal_line_draw] */
|
||||
/* Basic display driver */
|
||||
/* horizontal line draw routine*/
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_ARC_DRAWING_SUPPORT)
|
||||
|
||||
static VOID _gx_display_driver_generic_rotated_simple_pie_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter,
|
||||
UINT r, INT start_angle, INT end_angle, GX_BOOL skip_end)
|
||||
{
|
||||
/* The function will only fill a pie with both start angle and end angle are
|
||||
between 0 and 180 or beween 180 and 360.*/
|
||||
|
||||
GX_DISPLAY *display;
|
||||
GX_BRUSH *brush;
|
||||
GX_RECTANGLE *clip;
|
||||
GX_RECTANGLE arc_clip[4];
|
||||
GX_POINT point;
|
||||
GX_POINT points[3];
|
||||
INT sign[4][2] = {{1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
|
||||
INT *pLineEnds;
|
||||
GX_POINT *pGet;
|
||||
INT xmin;
|
||||
INT xmax;
|
||||
INT xstart;
|
||||
INT xend;
|
||||
INT ystart;
|
||||
INT yend;
|
||||
INT curx;
|
||||
INT cury;
|
||||
INT nextx;
|
||||
INT nexty;
|
||||
INT dx;
|
||||
INT dy;
|
||||
INT Index;
|
||||
INT loop;
|
||||
INT width;
|
||||
INT xsign;
|
||||
INT ysign;
|
||||
INT decision;
|
||||
int fillingwards;
|
||||
VOID (*line_draw)(GX_DRAW_CONTEXT *context, INT x1, INT x2, INT ypos, INT width, GX_COLOR color);
|
||||
INT xpos = 0;
|
||||
GX_PIXELMAP *pixelmap = GX_NULL;
|
||||
INT skip_line;
|
||||
GX_FILL_PIXELMAP_INFO info;
|
||||
|
||||
display = context -> gx_draw_context_display;
|
||||
brush = &context -> gx_draw_context_brush;
|
||||
line_draw = display -> gx_display_driver_vertical_line_draw;
|
||||
|
||||
if (brush -> gx_brush_style & GX_BRUSH_PIXELMAP_FILL)
|
||||
{
|
||||
if (brush -> gx_brush_pixelmap == GX_NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Pick up brush pixelmap. */
|
||||
pixelmap = brush -> gx_brush_pixelmap;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_format != display -> gx_display_color_format)
|
||||
{
|
||||
/* Display driver only support its native format pixelmap.*/
|
||||
/* Nothing should be drawn if pixelmap format isn't support. */
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(GX_FILL_PIXELMAP_INFO));
|
||||
|
||||
info.pixelmap = pixelmap;
|
||||
info.current_pixel_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||
if (pixelmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
info.current_aux_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
}
|
||||
|
||||
pGet = points;
|
||||
|
||||
points[1].gx_point_x = (GX_VALUE)xcenter;
|
||||
points[1].gx_point_y = (GX_VALUE)ycenter;
|
||||
|
||||
_gx_utility_circle_point_get(xcenter, ycenter, r, start_angle, &points[0]);
|
||||
_gx_utility_circle_point_get(xcenter, ycenter, r, end_angle, &points[2]);
|
||||
|
||||
_gx_display_driver_arc_clipping_get(xcenter, ycenter, r, start_angle, end_angle,
|
||||
&arc_clip[0], &arc_clip[1], &arc_clip[2], &arc_clip[3]);
|
||||
|
||||
/* Pie is in left side. */
|
||||
xmin = points[0].gx_point_x;
|
||||
xmax = points[2].gx_point_x;
|
||||
|
||||
if (xmin > xmax)
|
||||
{
|
||||
GX_SWAP_VALS(xmin, xmax);
|
||||
}
|
||||
|
||||
if (xmax < xcenter)
|
||||
{
|
||||
xmax = xcenter;
|
||||
}
|
||||
else if (xmin > xcenter)
|
||||
{
|
||||
xmin = xcenter;
|
||||
}
|
||||
|
||||
clip = context -> gx_draw_context_clip;
|
||||
|
||||
if (clip -> gx_rectangle_left > xmin)
|
||||
{
|
||||
xmin = clip -> gx_rectangle_left;
|
||||
}
|
||||
skip_line = xmin - (xcenter - (INT)r);
|
||||
|
||||
if (clip -> gx_rectangle_right < xmax)
|
||||
{
|
||||
xmax = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
width = xmax - xmin + 1;
|
||||
|
||||
pLineEnds = _gx_system_scratchpad;
|
||||
|
||||
/* default the point array to being off the screen on both sides: */
|
||||
|
||||
for (loop = 0; loop < width * 2; loop += 2)
|
||||
{
|
||||
pLineEnds[loop] = 2000;
|
||||
pLineEnds[loop + 1] = 0;
|
||||
}
|
||||
|
||||
curx = 0;
|
||||
cury = (INT)r;
|
||||
decision = 5 - (INT)(4 * r);
|
||||
|
||||
while (curx <= cury)
|
||||
{
|
||||
for (loop = 0; loop < 4; loop++)
|
||||
{
|
||||
point.gx_point_x = (GX_VALUE)(curx * sign[loop][0] + xcenter);
|
||||
point.gx_point_y = (GX_VALUE)(cury * sign[loop][1] + ycenter);
|
||||
|
||||
if ((point.gx_point_x >= xmin) && (point.gx_point_x <= xmax))
|
||||
{
|
||||
if (_gx_utility_rectangle_point_detect(&arc_clip[0], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[1], point))
|
||||
{
|
||||
Index = (point.gx_point_x - xmin) << 1;
|
||||
if (point.gx_point_y < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = point.gx_point_y;
|
||||
}
|
||||
|
||||
if (point.gx_point_y > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = point.gx_point_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
point.gx_point_x = (GX_VALUE)(cury * sign[loop][0] + xcenter);
|
||||
point.gx_point_y = (GX_VALUE)(curx * sign[loop][1] + ycenter);
|
||||
|
||||
if ((point.gx_point_x >= xmin) && (point.gx_point_x <= xmax))
|
||||
{
|
||||
if (_gx_utility_rectangle_point_detect(&arc_clip[0], point) ||
|
||||
_gx_utility_rectangle_point_detect(&arc_clip[1], point))
|
||||
{
|
||||
Index = (point.gx_point_x - xmin) << 1;
|
||||
if (point.gx_point_y < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = point.gx_point_y;
|
||||
}
|
||||
|
||||
if (point.gx_point_y > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = point.gx_point_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (decision < 0)
|
||||
{
|
||||
decision += 8 * curx + 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
decision += 8 * (curx - cury) + 20;
|
||||
cury--;
|
||||
}
|
||||
curx++;
|
||||
}
|
||||
|
||||
/* Fill in the point array by using Breshenhams line for
|
||||
2 lines of circle sector
|
||||
*/
|
||||
|
||||
for (loop = 0; loop < 2; loop++)
|
||||
{
|
||||
xstart = pGet -> gx_point_x;
|
||||
ystart = pGet -> gx_point_y;
|
||||
pGet++;
|
||||
xend = pGet -> gx_point_x;
|
||||
yend = pGet -> gx_point_y;
|
||||
dx = GX_ABS(xend - xstart);
|
||||
dy = GX_ABS(yend - ystart);
|
||||
|
||||
/* Vertical Line. */
|
||||
if (xstart == xend)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Horizontal Line. */
|
||||
if (ystart == yend)
|
||||
{
|
||||
if (xstart > xend)
|
||||
{
|
||||
GX_SWAP_VALS(xstart, xend);
|
||||
GX_SWAP_VALS(ystart, yend);
|
||||
}
|
||||
|
||||
if (skip_end)
|
||||
{
|
||||
ystart--;
|
||||
}
|
||||
|
||||
for (curx = xstart; curx <= xend; curx++)
|
||||
{
|
||||
if ((curx >= xmin) && (curx <= xmax))
|
||||
{
|
||||
Index = (curx - xmin) << 1;
|
||||
if (ystart < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = ystart;
|
||||
}
|
||||
|
||||
if (ystart > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = ystart;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Simple Line. */
|
||||
if (((dx >= dy && (xstart > xend)) ||
|
||||
((dy > dx) && ystart > yend)))
|
||||
{
|
||||
GX_SWAP_VALS(xend, xstart);
|
||||
GX_SWAP_VALS(yend, ystart);
|
||||
}
|
||||
|
||||
xsign = (xend - xstart) / dx;
|
||||
ysign = (yend - ystart) / dy;
|
||||
|
||||
if (dx >= dy)
|
||||
{
|
||||
for (curx = xstart, cury = ystart, nextx = xend, nexty = yend,
|
||||
decision = (dx >> 1); curx <= nextx; curx++, nextx--,
|
||||
decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += ysign;
|
||||
nexty -= ysign;
|
||||
}
|
||||
|
||||
if ((curx >= xmin) && (curx <= xmax))
|
||||
{
|
||||
Index = (curx - xmin) << 1;
|
||||
|
||||
if (cury < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = cury;
|
||||
}
|
||||
|
||||
if (cury - 1 > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = cury - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((nextx >= xmin) && (nextx <= xmax))
|
||||
{
|
||||
Index = (nextx - xmin) << 1;
|
||||
|
||||
if (nexty < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = nexty;
|
||||
}
|
||||
|
||||
if (nexty - 1 > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = nexty - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (start_angle < 180)
|
||||
{
|
||||
if (loop == 0)
|
||||
{
|
||||
fillingwards = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fillingwards = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (loop == 0)
|
||||
{
|
||||
fillingwards = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fillingwards = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (curx = xstart, cury = ystart, nextx = xend, nexty = yend,
|
||||
decision = (dy >> 1); cury <= nexty; cury++, nexty--,
|
||||
decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += xsign;
|
||||
nextx -= xsign;
|
||||
}
|
||||
|
||||
if ((curx - 1 + fillingwards >= xmin) && (curx - 1 + fillingwards <= xmax))
|
||||
{
|
||||
Index = (curx - 1 + fillingwards - xmin) << 1;
|
||||
|
||||
if (cury < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = cury;
|
||||
}
|
||||
|
||||
if (cury > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = cury;
|
||||
}
|
||||
}
|
||||
|
||||
if ((nextx - 1 + fillingwards >= xmin) && (nextx - 1 + fillingwards <= xmax))
|
||||
{
|
||||
Index = (nextx - 1 + fillingwards - xmin) << 1;
|
||||
|
||||
if (nexty < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = nexty;
|
||||
}
|
||||
|
||||
if (nexty > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = nexty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Filling circle sector with horizontal line. */
|
||||
if (pixelmap)
|
||||
{
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
skip_line = (xmax - (xcenter - (INT)r) + 1) % pixelmap -> gx_pixelmap_width;
|
||||
|
||||
/*Skip the un-draw line.*/
|
||||
if (skip_line)
|
||||
{
|
||||
skip_line = pixelmap -> gx_pixelmap_width - skip_line;
|
||||
}
|
||||
|
||||
Index = (width - 1) << 1;
|
||||
xsign = -1;
|
||||
xstart = xmax;
|
||||
}
|
||||
else
|
||||
{
|
||||
skip_line = (xmin - clip -> gx_rectangle_left);
|
||||
|
||||
Index = 0;
|
||||
xsign = 1;
|
||||
xstart = xmin;
|
||||
}
|
||||
|
||||
/*Skip the un-draw line.*/
|
||||
if (skip_line)
|
||||
{
|
||||
info.draw = GX_FALSE;
|
||||
while (skip_line--)
|
||||
{
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, 0, &info);
|
||||
}
|
||||
}
|
||||
|
||||
info.draw = GX_TRUE;
|
||||
xpos = ycenter - (INT)r;
|
||||
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] < clip -> gx_rectangle_top)
|
||||
{
|
||||
pLineEnds[Index] = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (pLineEnds[Index + 1] > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
pLineEnds[Index + 1] = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
info.x_offset = pLineEnds[Index] - xpos;
|
||||
|
||||
/* Filling pie area with pixelmap. */
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], xstart, &info);
|
||||
|
||||
xstart += xsign;
|
||||
Index += xsign;
|
||||
Index += xsign;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = 0;
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] <= pLineEnds[Index + 1])
|
||||
{
|
||||
if (pLineEnds[Index] < clip -> gx_rectangle_top)
|
||||
{
|
||||
pLineEnds[Index] = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (pLineEnds[Index + 1] > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
pLineEnds[Index + 1] = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], curx, 1,
|
||||
brush -> gx_brush_fill_color);
|
||||
}
|
||||
|
||||
Index += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_pie_fill PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Display driver to fill a pie. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* xcenter x-coord of center of circle */
|
||||
/* ycenter y-coord of center of circle */
|
||||
/* r Radius of circle */
|
||||
/* start_angle The start angle of circle arc */
|
||||
/* end_angle The end angle of circle arc */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_simple_pie_fill */
|
||||
/* Real display driver draw */
|
||||
/* filled-pie function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_canvas_pie_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_pie_fill(GX_DRAW_CONTEXT *context, INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle)
|
||||
{
|
||||
/* The function fills a pie.*/
|
||||
|
||||
|
||||
if (start_angle < 180)
|
||||
{
|
||||
if (end_angle < 180)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, start_angle, end_angle, GX_FALSE);
|
||||
}
|
||||
else if (end_angle < 360)
|
||||
{
|
||||
/* Skip-end parameter should only be set when drawing the above area.
|
||||
It would be set to GX_TRUE to skip the bottom line to avoid case that this line will be drawn twice, which
|
||||
is not correct, when brush alpha is set. */
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 180, GX_TRUE);
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, 180, end_angle, GX_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 180, GX_TRUE);
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, 180, 360, GX_FALSE);
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, 0, end_angle - 360, GX_TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (end_angle < 360)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, start_angle, end_angle, GX_FALSE);
|
||||
}
|
||||
else if (end_angle < 540)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 360, GX_FALSE);
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, 0, end_angle - 360, GX_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, start_angle, 360, GX_FALSE);
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, 0, 180, GX_TRUE);
|
||||
_gx_display_driver_generic_rotated_simple_pie_fill(context, xcenter, ycenter, r, 180, end_angle - 360, GX_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
946
common/src/gx_display_driver_generic_rotated_polygon_fill.c
Normal file
946
common/src/gx_display_driver_generic_rotated_polygon_fill.c
Normal file
@ -0,0 +1,946 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_canvas.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_min_max_get PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that calculates the top most and bottom */
|
||||
/* most y coordinate of the specified polygon. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* vertex Array of points of the polygon, */
|
||||
/* terminated by NULL entry */
|
||||
/* num Number of points of polygon */
|
||||
/* xmin Retrieved left most x coordinate */
|
||||
/* xmax Retrieved right most x coordinate */
|
||||
/* ymin Retrieved top most y coordinate */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_min_max_get(GX_POINT *vertex, INT num, INT *xmin, INT *xmax, INT *ymin)
|
||||
{
|
||||
GX_VALUE index = (GX_VALUE)num;
|
||||
INT x_min;
|
||||
INT x_max;
|
||||
INT y_min;
|
||||
|
||||
x_min = vertex[0].gx_point_x;
|
||||
x_max = vertex[0].gx_point_x;
|
||||
y_min = vertex[0].gx_point_y;
|
||||
|
||||
while (index--)
|
||||
{
|
||||
if (vertex[index].gx_point_x < x_min)
|
||||
{
|
||||
x_min = vertex[index].gx_point_x;
|
||||
}
|
||||
else if (vertex[index].gx_point_x > x_max)
|
||||
{
|
||||
x_max = vertex[index].gx_point_x;
|
||||
}
|
||||
|
||||
if (vertex[index].gx_point_y < y_min)
|
||||
{
|
||||
y_min = vertex[index].gx_point_y;
|
||||
}
|
||||
}
|
||||
|
||||
*xmin = x_min;
|
||||
*xmax = x_max;
|
||||
*ymin = y_min;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_new_edge_table_init_90 PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that Initiates new edge table, which */
|
||||
/* contain all the edges of the specified polygon. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* vertex Array of points of the polygon, */
|
||||
/* terminated by NULL entry */
|
||||
/* num Number of points of polygon */
|
||||
/* net Pointer to new edge table */
|
||||
/* net_size New edge table size */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_new_edge_table_init_90(GX_POINT *vertex, INT num, GX_POLYGON_EDGE *net, INT *net_size)
|
||||
{
|
||||
GX_POLYGON_EDGE edge;
|
||||
INT index;
|
||||
GX_POINT s_point;
|
||||
GX_POINT ss_point;
|
||||
GX_POINT e_point;
|
||||
GX_POINT ee_point;
|
||||
GX_VALUE net_index = 0;
|
||||
|
||||
for (index = 0; index < num; index++)
|
||||
{
|
||||
s_point = vertex[index];
|
||||
e_point = vertex[(index + 1) % num];
|
||||
ss_point = vertex[(index - 1 + num) % num];
|
||||
ee_point = vertex[(index + 2) % num];
|
||||
|
||||
/* Skip vertical line. */
|
||||
if (s_point.gx_point_x != e_point.gx_point_x)
|
||||
{
|
||||
/* Add one edge to new edge table, s_point and e_point are two endpoints of the added edge. */
|
||||
|
||||
edge.gx_polygon_edge_dx = GX_ABS(e_point.gx_point_x - s_point.gx_point_x);
|
||||
edge.gx_polygon_edge_dy = GX_ABS(e_point.gx_point_y - s_point.gx_point_y);
|
||||
edge.gx_polygon_edge_x_decision = edge.gx_polygon_edge_dx >> 1;
|
||||
if (((e_point.gx_point_x > s_point.gx_point_x) && (e_point.gx_point_y > s_point.gx_point_y)) ||
|
||||
((e_point.gx_point_x < s_point.gx_point_x) && (e_point.gx_point_y < s_point.gx_point_y)))
|
||||
{
|
||||
edge.gx_polygon_edge_sign = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
edge.gx_polygon_edge_sign = 1;
|
||||
}
|
||||
|
||||
if (e_point.gx_point_x > s_point.gx_point_x)
|
||||
{
|
||||
/* Set xi value, which is the y coordinate value of the edge's rightmost point. */
|
||||
edge.gx_polygon_edge_xi = e_point.gx_point_y;
|
||||
|
||||
/* Set min x coordinate of the edge. */
|
||||
edge.gx_polygon_edge_ymax = s_point.gx_point_x;
|
||||
|
||||
if (ss_point.gx_point_x <= s_point.gx_point_x)
|
||||
{
|
||||
/* If e_point isn't the left most point, reset xmin to xmin - 1.
|
||||
To avoid producing 2 intersections when scan line comes to the vertex point. */
|
||||
edge.gx_polygon_edge_ymax += 1;
|
||||
}
|
||||
|
||||
edge.gx_polygon_edge_ymin = e_point.gx_point_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set xi value. */
|
||||
edge.gx_polygon_edge_xi = s_point.gx_point_y;
|
||||
|
||||
/* Set max x coordinate of the edge. */
|
||||
edge.gx_polygon_edge_ymax = e_point.gx_point_x;
|
||||
|
||||
if (ee_point.gx_point_x <= e_point.gx_point_x)
|
||||
{
|
||||
/* If e_point isn't the left most point, reset xmin to xmin - 1. */
|
||||
edge.gx_polygon_edge_ymax += 1;
|
||||
}
|
||||
|
||||
edge.gx_polygon_edge_ymin = s_point.gx_point_x;
|
||||
}
|
||||
|
||||
net[net_index++] = edge;
|
||||
}
|
||||
}
|
||||
|
||||
*net_size = net_index;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_new_edge_table_init_270 PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that Initiates new edge table, which */
|
||||
/* contain all the edges of the specified polygon. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* vertex Array of points of the polygon, */
|
||||
/* terminated by NULL entry */
|
||||
/* num Number of points of polygon */
|
||||
/* net Pointer to new edge table */
|
||||
/* net_size New edge table size */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_new_edge_table_init_270(GX_POINT *vertex, INT num, GX_POLYGON_EDGE *net, INT *net_size)
|
||||
{
|
||||
GX_POLYGON_EDGE edge;
|
||||
INT index;
|
||||
GX_POINT s_point;
|
||||
GX_POINT ss_point;
|
||||
GX_POINT e_point;
|
||||
GX_POINT ee_point;
|
||||
GX_VALUE net_index = 0;
|
||||
|
||||
for (index = 0; index < num; index++)
|
||||
{
|
||||
s_point = vertex[index];
|
||||
e_point = vertex[(index + 1) % num];
|
||||
ss_point = vertex[(index - 1 + num) % num];
|
||||
ee_point = vertex[(index + 2) % num];
|
||||
|
||||
/* Skip vertical line. */
|
||||
if (s_point.gx_point_x != e_point.gx_point_x)
|
||||
{
|
||||
/* Add one edge to new edge table, s_point and e_point are two endpoints of the added edge. */
|
||||
edge.gx_polygon_edge_dx = GX_ABS(e_point.gx_point_x - s_point.gx_point_x);
|
||||
edge.gx_polygon_edge_dy = GX_ABS(e_point.gx_point_y - s_point.gx_point_y);
|
||||
edge.gx_polygon_edge_x_decision = edge.gx_polygon_edge_dx >> 1;
|
||||
if (((e_point.gx_point_x > s_point.gx_point_x) && (e_point.gx_point_y > s_point.gx_point_y)) ||
|
||||
((e_point.gx_point_x < s_point.gx_point_x) && (e_point.gx_point_y < s_point.gx_point_y)))
|
||||
{
|
||||
edge.gx_polygon_edge_sign = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
edge.gx_polygon_edge_sign = -1;
|
||||
}
|
||||
|
||||
if (e_point.gx_point_x > s_point.gx_point_x)
|
||||
{
|
||||
/* Set xi value. */
|
||||
edge.gx_polygon_edge_xi = s_point.gx_point_y;
|
||||
|
||||
/* Set max x coordinate of the edge. */
|
||||
edge.gx_polygon_edge_ymax = e_point.gx_point_x;
|
||||
|
||||
if (ee_point.gx_point_x >= e_point.gx_point_x)
|
||||
{
|
||||
/* If e_point isn't the right most point, reset xmax to xmax - 1. */
|
||||
edge.gx_polygon_edge_ymax -= 1;
|
||||
}
|
||||
|
||||
edge.gx_polygon_edge_ymin = s_point.gx_point_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set xi value, which is the y coordinate value of the edge's leftmost point. */
|
||||
edge.gx_polygon_edge_xi = e_point.gx_point_y;
|
||||
|
||||
/* Set max x coordinate of the edge. */
|
||||
edge.gx_polygon_edge_ymax = s_point.gx_point_x;
|
||||
|
||||
if (ss_point.gx_point_x >= s_point.gx_point_x)
|
||||
{
|
||||
/* If e_point isn't the right most point, reset xmax to xmax - 1.
|
||||
To avoid producing 2 intersections when scan line comes to the vertex point. */
|
||||
edge.gx_polygon_edge_ymax -= 1;
|
||||
}
|
||||
|
||||
edge.gx_polygon_edge_ymin = e_point.gx_point_x;
|
||||
}
|
||||
|
||||
net[net_index++] = edge;
|
||||
}
|
||||
}
|
||||
|
||||
*net_size = net_index;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_active_edge_insert PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that Inserts an edge from new edge table to*/
|
||||
/* active edge table. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* aet Pointer to active edge table */
|
||||
/* net Pointer to new edge table */
|
||||
/* x X coordinate of current scan line */
|
||||
/* net Pointer to new edge table */
|
||||
/* net_size New edge table size */
|
||||
/* aet_size Retured active edge table size */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_active_edge_insert(GX_POLYGON_EDGE *aet, GX_POLYGON_EDGE *net, INT x, INT net_size, INT *aet_size)
|
||||
{
|
||||
GX_VALUE ni = (GX_VALUE)(net_size - 1);
|
||||
GX_VALUE ai;
|
||||
INT active_edge_table_size = *aet_size;
|
||||
|
||||
for (ni = 0; ni < net_size; ni++)
|
||||
{
|
||||
if (net[ni].gx_polygon_edge_ymin == x)
|
||||
{
|
||||
/* If the rightmost x coordinate value of the edge equals to the current scan line x,
|
||||
Insert the edge to active edge table, and increase aet size by 1. */
|
||||
|
||||
ai = (GX_VALUE)(active_edge_table_size - 1);
|
||||
while ((ai >= 0) && (net[ni].gx_polygon_edge_xi < aet[ai].gx_polygon_edge_xi))
|
||||
{
|
||||
aet[ai + 1] = aet[ai];
|
||||
ai--;
|
||||
}
|
||||
aet[ai + 1] = net[ni];
|
||||
active_edge_table_size++;
|
||||
}
|
||||
}
|
||||
|
||||
*aet_size = active_edge_table_size;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_non_active_edge_remove PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that removes an edge from active edge table*/
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* aet Pointer to active edge table */
|
||||
/* x X coordinate of current scan line */
|
||||
/* aet_size Active edge table size */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_non_active_edge_remove(GX_POLYGON_EDGE *aet, INT x, INT *aet_size)
|
||||
{
|
||||
INT i;
|
||||
INT j;
|
||||
|
||||
for (i = 0; i < *aet_size; i++)
|
||||
{
|
||||
/* If the bottom most y coordinate value of the edge equals to the current scan line y,
|
||||
Remove the edge from active edge table, and decrease aet size by 1. */
|
||||
if (aet[i].gx_polygon_edge_ymax == x)
|
||||
{
|
||||
for (j = i; j < *aet_size - 1; j++)
|
||||
{
|
||||
aet[j] = aet[j + 1];
|
||||
}
|
||||
(*aet_size)--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_scan_line_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that filling area between pair */
|
||||
/* intersections. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* aet Pointer to active edge table */
|
||||
/* x X coordinate of current scan line */
|
||||
/* aet_size Active edge table size */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_horizontal_line_draw] */
|
||||
/* Basic display driver horizontal */
|
||||
/* line draw function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_scan_line_draw(GX_DRAW_CONTEXT *context, GX_POLYGON_EDGE *aet, INT x, INT aet_size)
|
||||
{
|
||||
GX_VALUE index;
|
||||
INT y1, y2;
|
||||
GX_DISPLAY *display = context -> gx_draw_context_display;
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_COLOR fill_color;
|
||||
|
||||
fill_color = context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||
|
||||
for (index = 0; index < aet_size - 1; index = (GX_VALUE)(index + (GX_VALUE)2))
|
||||
{
|
||||
|
||||
/* Pick up y coordinate value of the pair intersections. */
|
||||
y1 = aet[index].gx_polygon_edge_xi;
|
||||
y2 = aet[index + 1].gx_polygon_edge_xi;
|
||||
|
||||
if (context -> gx_draw_context_brush.gx_brush_style & GX_BRUSH_ALIAS)
|
||||
{
|
||||
if ((aet[index].gx_polygon_edge_dy > aet[index].gx_polygon_edge_dx) &&
|
||||
(aet[index].gx_polygon_edge_sign < 0))
|
||||
{
|
||||
y1 += 1;
|
||||
}
|
||||
|
||||
if (aet[index + 1].gx_polygon_edge_dy >= aet[index + 1].gx_polygon_edge_dx)
|
||||
{
|
||||
if (aet[index + 1].gx_polygon_edge_sign > 0)
|
||||
{
|
||||
y2 -= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y2 -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cliping segments y1y2. */
|
||||
if (y1 < clip -> gx_rectangle_top)
|
||||
{
|
||||
y1 = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (y2 > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
y2 = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
if (y1 <= y2)
|
||||
{
|
||||
/* Filling area between pairs of the intersections. */
|
||||
display -> gx_display_driver_vertical_line_draw(context, y1, y2, x, 1, fill_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_pixelmap_scan_line_draw PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that filling area between pair */
|
||||
/* intersections with pixelmap. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* aet Pointer to active edge table */
|
||||
/* aet_size Active edge table size */
|
||||
/* ypos Y coord of draw start position */
|
||||
/* x X coordinate of current scan line */
|
||||
/* pixelmap Pixelmap to fill */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_display_driver_horizontal_pixelmap_line_draw] */
|
||||
/* Basic display driver horizontal */
|
||||
/* pixelmap line draw function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static VOID _gx_display_driver_polygon_pixelmap_scan_line_draw(GX_DRAW_CONTEXT *context, GX_POLYGON_EDGE *aet, INT aet_size,
|
||||
INT ypos, INT x, GX_FILL_PIXELMAP_INFO *info)
|
||||
{
|
||||
GX_VALUE index;
|
||||
INT y1, y2;
|
||||
GX_DISPLAY *display = context -> gx_draw_context_display;
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_FILL_PIXELMAP_INFO old_info;
|
||||
GX_BOOL is_drawn = GX_FALSE;
|
||||
|
||||
/* Store the ptr info in case that this line will be drawn several times.*/
|
||||
old_info = (*info);
|
||||
|
||||
for (index = 0; index < aet_size - 1; index = (GX_VALUE)(index + (GX_VALUE)2))
|
||||
{
|
||||
/* if aet_size is bigger than 2, it means there's at least two segment in this line.
|
||||
So it must be drawn this line several times and should always be started from the "correct" position. */
|
||||
(*info) = old_info;
|
||||
|
||||
/* Pick up y coordinate value of the pair intersections. */
|
||||
y1 = aet[index].gx_polygon_edge_xi;
|
||||
y2 = aet[index + 1].gx_polygon_edge_xi;
|
||||
|
||||
if (context -> gx_draw_context_brush.gx_brush_style & GX_BRUSH_ALIAS)
|
||||
{
|
||||
if ((aet[index].gx_polygon_edge_dy > aet[index].gx_polygon_edge_dx) &&
|
||||
(aet[index].gx_polygon_edge_sign < 0))
|
||||
{
|
||||
y1 += 1;
|
||||
}
|
||||
|
||||
if (aet[index + 1].gx_polygon_edge_dy >= aet[index + 1].gx_polygon_edge_dx)
|
||||
{
|
||||
if (aet[index + 1].gx_polygon_edge_sign > 0)
|
||||
{
|
||||
y2 -= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y2 -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cliping segments y1y2. */
|
||||
if (y1 < clip -> gx_rectangle_top)
|
||||
{
|
||||
y1 = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (y2 > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
y2 = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
if (y1 > y2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Filling area between pairs of the intersections. */
|
||||
info -> x_offset = y1 - ypos;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, y1, y2, x, info);
|
||||
|
||||
is_drawn = GX_TRUE;
|
||||
}
|
||||
|
||||
if (!is_drawn)
|
||||
{
|
||||
info -> draw = GX_FALSE;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, 0, info);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_polygon_active_edge_table_update_and_restore */
|
||||
/* PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Internal helper function that updates x coordinate of intersection */
|
||||
/* according to edge gradient, and sort intersections by increase x */
|
||||
/* coordinate value. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* aet Pointer to active edge table */
|
||||
/* aet_size Active edge table size */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_polygon_fill */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static UINT _gx_display_driver_polygon_active_edge_table_update_and_restore(GX_POLYGON_EDGE *aet, INT aet_size)
|
||||
{
|
||||
GX_VALUE index = (GX_VALUE)aet_size, xi, yi;
|
||||
GX_POLYGON_EDGE temp;
|
||||
|
||||
/* Update xi value. */
|
||||
while (index--)
|
||||
{
|
||||
if (aet[index].gx_polygon_edge_dy == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* When scan line move one step from right to left,
|
||||
we need to update y value of active edges with the delta of the edge,
|
||||
the following codes equals to y += delta(x). */
|
||||
aet[index].gx_polygon_edge_x_decision += aet[index].gx_polygon_edge_dy;
|
||||
|
||||
while (aet[index].gx_polygon_edge_x_decision > aet[index].gx_polygon_edge_dx)
|
||||
{
|
||||
aet[index].gx_polygon_edge_xi += aet[index].gx_polygon_edge_sign;
|
||||
aet[index].gx_polygon_edge_x_decision -= aet[index].gx_polygon_edge_dx;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort with xi value in ascending order. */
|
||||
for (xi = 0; xi < aet_size - 1; xi++)
|
||||
{
|
||||
for (yi = (GX_VALUE)(xi + 1); yi < aet_size; yi++)
|
||||
{
|
||||
if (aet[xi].gx_polygon_edge_xi > aet[yi].gx_polygon_edge_xi)
|
||||
{
|
||||
temp = aet[yi];
|
||||
aet[yi] = aet[xi];
|
||||
aet[xi] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_polygon_fill PORTABLE C */
|
||||
/* x.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This fills a polygon. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* num Number of points of polygon */
|
||||
/* vertex Array of points of the polygon, */
|
||||
/* terminated by NULL entry. */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_canvas_line_draw Draw the specified line */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_polygon_fill(GX_DRAW_CONTEXT *context, GX_POINT *vertex, INT num)
|
||||
{
|
||||
INT xmin;
|
||||
INT xmax;
|
||||
INT ypos;
|
||||
INT x;
|
||||
INT xstart;
|
||||
GX_BYTE xsign;
|
||||
static GX_POLYGON_EDGE net[GX_POLYGON_MAX_EDGE_NUM]; /* new edge table: obtain all edges of the polygon. */
|
||||
static GX_POLYGON_EDGE aet[GX_POLYGON_MAX_EDGE_NUM]; /* active edge table: obtain all edges that touched by the current scan line. */
|
||||
GX_BRUSH *brush;
|
||||
INT aet_size = 0;
|
||||
INT net_size = num;
|
||||
GX_PIXELMAP *pixelmap = GX_NULL;
|
||||
GX_FILL_PIXELMAP_INFO info;
|
||||
GX_DISPLAY *display = context -> gx_draw_context_display;
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
INT skip_line;
|
||||
|
||||
if (num <= GX_POLYGON_MAX_EDGE_NUM)
|
||||
{
|
||||
brush = &context -> gx_draw_context_brush;
|
||||
if (brush -> gx_brush_style & GX_BRUSH_PIXELMAP_FILL)
|
||||
{
|
||||
if (brush -> gx_brush_pixelmap == GX_NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Pick up brush pixelmap. */
|
||||
pixelmap = brush -> gx_brush_pixelmap;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_format != display -> gx_display_color_format)
|
||||
{
|
||||
/* Display driver only support its native format pixelmap.*/
|
||||
/* Nothing should be drawn if pixelmap format isn't support. */
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(GX_FILL_PIXELMAP_INFO));
|
||||
|
||||
info.pixelmap = brush -> gx_brush_pixelmap;
|
||||
info.current_pixel_ptr = (GX_UBYTE *)info.pixelmap -> gx_pixelmap_data;
|
||||
|
||||
if (pixelmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
info.current_aux_ptr = (GX_UBYTE *)pixelmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the top most and bottom most y coordinate of the specified polygon. */
|
||||
_gx_display_driver_polygon_min_max_get(vertex, num, &xmin, &xmax, &ypos);
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
/* Initiate new edge table. */
|
||||
_gx_display_driver_polygon_new_edge_table_init_90(vertex, num, net, &net_size);
|
||||
|
||||
if (pixelmap)
|
||||
{
|
||||
skip_line = (xmax - xmin + 1) % pixelmap -> gx_pixelmap_width;
|
||||
|
||||
if (skip_line)
|
||||
{
|
||||
skip_line = pixelmap -> gx_pixelmap_width - skip_line;
|
||||
|
||||
info.draw = GX_FALSE;
|
||||
while (skip_line--)
|
||||
{
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, 0, &info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_polygon_new_edge_table_init_270(vertex, num, net, &net_size);
|
||||
}
|
||||
|
||||
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||
{
|
||||
xstart = xmax;
|
||||
xsign = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xstart = xmin;
|
||||
xsign = 1;
|
||||
}
|
||||
|
||||
/* Moving scan line from polygon top to bottom. */
|
||||
for (x = xmin; x <= xmax; x++)
|
||||
{
|
||||
/* This function will check if the scan line comes to the top most y coordinate of any edges in net table.
|
||||
If it is true, add it to the aet table. */
|
||||
_gx_display_driver_polygon_active_edge_insert(aet, net, xstart, net_size, &aet_size);
|
||||
|
||||
if ((xstart < clip -> gx_rectangle_left) ||
|
||||
(xstart > clip -> gx_rectangle_right))
|
||||
{
|
||||
if (pixelmap)
|
||||
{
|
||||
/* skip the undraw lines. */
|
||||
info.draw = GX_FALSE;
|
||||
display -> gx_display_driver_horizontal_pixelmap_line_draw(context, 0, 0, 0, &info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pixelmap)
|
||||
{
|
||||
info.draw = GX_TRUE;
|
||||
_gx_display_driver_polygon_pixelmap_scan_line_draw(context, aet, aet_size, ypos, xstart, &info);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Filling the polygon area that touched by scan line. */
|
||||
_gx_display_driver_polygon_scan_line_draw(context, aet, xstart, aet_size);
|
||||
}
|
||||
}
|
||||
/* This function will check if the scan line comes to the bottom most y coordinate of any edges in aet table.
|
||||
If it is true, remove it from aet table. */
|
||||
_gx_display_driver_polygon_non_active_edge_remove(aet, xstart, &aet_size);
|
||||
|
||||
/* Update x coordinate of intersections between polygon and scan line, and sort them by increase x coordinate value. */
|
||||
_gx_display_driver_polygon_active_edge_table_update_and_restore(aet, aet_size);
|
||||
|
||||
xstart += xsign;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
381
common/src/gx_display_driver_generic_rotated_wide_line_fill.c
Normal file
381
common/src/gx_display_driver_generic_rotated_wide_line_fill.c
Normal file
@ -0,0 +1,381 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_display.h"
|
||||
#include "gx_system.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_rotated_wide_line_fill PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* Fill a wide line after the four corner points have been calculated. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* context Drawing context */
|
||||
/* pPoints Pre-computed end points */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* GX_ABS Compute the absolute value */
|
||||
/* GX_SWAP_VALUE Swap two values */
|
||||
/* [_gx_display_driver_horizontal_line_draw] */
|
||||
/* Driver for horizontal line */
|
||||
/* draw */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_simple_wide_line_draw */
|
||||
/* _gx_display_driver_generic_aliased_wide_line_draw */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_rotated_wide_line_fill(GX_DRAW_CONTEXT *context, GX_FIXED_POINT *pPoints)
|
||||
{
|
||||
/*
|
||||
Use Breshenham's line to compute the points along each line that bounds
|
||||
the wide line and save the points to an array. Then draw horizontal lines
|
||||
to connect the points.
|
||||
*/
|
||||
|
||||
GX_FIXED_POINT *pGet = pPoints;
|
||||
INT *pLineEnds;
|
||||
INT xmin;
|
||||
INT xmax;
|
||||
INT xstart;
|
||||
INT xend;
|
||||
INT ystart;
|
||||
INT yend;
|
||||
INT curx;
|
||||
INT cury;
|
||||
INT test;
|
||||
GX_FIXED_VAL dx;
|
||||
GX_FIXED_VAL dy;
|
||||
INT Index;
|
||||
INT loop;
|
||||
INT width;
|
||||
INT xsign;
|
||||
INT ysign;
|
||||
INT decision;
|
||||
INT shift;
|
||||
VOID (*line_draw)(GX_DRAW_CONTEXT *context, INT x1, INT x2, INT ypos, INT width, GX_COLOR color);
|
||||
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||
GX_COLOR linecolor = context -> gx_draw_context_brush.gx_brush_line_color;
|
||||
GX_BOOL aliased = GX_FALSE;
|
||||
INT x_fraction;
|
||||
INT y_fraction;
|
||||
|
||||
if ((context -> gx_draw_context_brush.gx_brush_style & GX_BRUSH_ALIAS) &&
|
||||
context -> gx_draw_context_display -> gx_display_driver_pixel_blend)
|
||||
{
|
||||
aliased = GX_TRUE;
|
||||
}
|
||||
|
||||
xmin = GX_FIXED_VAL_TO_INT(pPoints[0].x);
|
||||
xmax = GX_FIXED_VAL_RND_UP(pPoints[2].x);
|
||||
|
||||
if (xmin < clip -> gx_rectangle_left)
|
||||
{
|
||||
xmin = clip -> gx_rectangle_left;
|
||||
}
|
||||
|
||||
if (xmax > clip -> gx_rectangle_right)
|
||||
{
|
||||
xmax = clip -> gx_rectangle_right;
|
||||
}
|
||||
|
||||
width = xmax - xmin + 1;
|
||||
|
||||
pLineEnds = _gx_system_scratchpad;
|
||||
|
||||
/* default the point array to being off the screen on both sides: */
|
||||
|
||||
for (loop = 0; loop < width * 2; loop += 2)
|
||||
{
|
||||
pLineEnds[loop] = 2000;
|
||||
pLineEnds[loop + 1] = 0;
|
||||
}
|
||||
|
||||
/* Fill in the point array by using Breshenhams line for
|
||||
all 4 sides of the bounding rectangle
|
||||
*/
|
||||
|
||||
for (loop = 0; loop < 4; loop++)
|
||||
{
|
||||
xstart = pGet -> x;
|
||||
ystart = pGet -> y;
|
||||
pGet++;
|
||||
xend = pGet -> x;
|
||||
yend = pGet -> y;
|
||||
dx = GX_ABS(xend - xstart);
|
||||
dy = GX_ABS(yend - ystart);
|
||||
|
||||
xsign = ysign = 1;
|
||||
|
||||
if (((dx >= dy && (xstart > xend)) ||
|
||||
((dy > dx) && ystart > yend)))
|
||||
{
|
||||
GX_SWAP_VALS(xend, xstart);
|
||||
GX_SWAP_VALS(yend, ystart);
|
||||
}
|
||||
if (dx)
|
||||
{
|
||||
xsign = (xend - xstart) / dx;
|
||||
}
|
||||
if (dy)
|
||||
{
|
||||
ysign = (yend - ystart) / dy;
|
||||
}
|
||||
|
||||
x_fraction = (xstart & GX_FIXED_VAL_FRACTION_MASK);
|
||||
y_fraction = (ystart & GX_FIXED_VAL_FRACTION_MASK);
|
||||
|
||||
shift = 0;
|
||||
|
||||
if (dx >= dy)
|
||||
{
|
||||
if (ysign < 0)
|
||||
{
|
||||
cury = GX_FIXED_VAL_RND_UP(ystart);
|
||||
|
||||
if (y_fraction)
|
||||
{
|
||||
y_fraction = GX_FIXED_VAL_ONE - y_fraction;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cury = GX_FIXED_VAL_TO_INT(ystart);
|
||||
}
|
||||
|
||||
decision = (y_fraction * dx - x_fraction * dy) / GX_FIXED_VAL_ONE;
|
||||
|
||||
if (decision < 0)
|
||||
{
|
||||
decision += dx;
|
||||
cury -= ysign;
|
||||
}
|
||||
|
||||
xstart = GX_FIXED_VAL_TO_INT(xstart);
|
||||
|
||||
if (aliased)
|
||||
{
|
||||
xend = GX_FIXED_VAL_TO_INT(xend);
|
||||
|
||||
if (x_fraction)
|
||||
{
|
||||
xstart++;
|
||||
decision += dy;
|
||||
}
|
||||
|
||||
if (dy)
|
||||
{
|
||||
if ((loop == 1) || (loop == 2))
|
||||
{
|
||||
shift = ysign;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xend = GX_FIXED_VAL_RND(xend);
|
||||
|
||||
if (x_fraction >= GX_FIXED_VAL_HALF)
|
||||
{
|
||||
xstart++;
|
||||
decision += dy;
|
||||
}
|
||||
|
||||
decision += (dx >> 1);
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += ysign;
|
||||
}
|
||||
}
|
||||
|
||||
for (curx = xstart; curx <= xend; curx++, decision += dy)
|
||||
{
|
||||
if (decision >= dx)
|
||||
{
|
||||
decision -= dx;
|
||||
cury += ysign;
|
||||
}
|
||||
|
||||
test = cury + shift;
|
||||
|
||||
if ((curx >= xmin) && (curx <= xmax))
|
||||
{
|
||||
Index = (curx - xmin) << 1;
|
||||
|
||||
test = cury + shift;
|
||||
if (test < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = test;
|
||||
}
|
||||
|
||||
if (test > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = test;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xsign < 0)
|
||||
{
|
||||
curx = GX_FIXED_VAL_RND_UP(xstart);
|
||||
|
||||
if (x_fraction)
|
||||
{
|
||||
x_fraction = GX_FIXED_VAL_FRACTION_MASK - x_fraction;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
curx = GX_FIXED_VAL_TO_INT(xstart);
|
||||
}
|
||||
|
||||
decision = (x_fraction * dy - y_fraction * dx) / GX_FIXED_VAL_ONE;
|
||||
|
||||
if (decision < 0)
|
||||
{
|
||||
decision += dy;
|
||||
curx -= xsign;
|
||||
}
|
||||
|
||||
ystart = GX_FIXED_VAL_TO_INT(ystart);
|
||||
|
||||
if (aliased)
|
||||
{
|
||||
yend = GX_FIXED_VAL_TO_INT(yend);
|
||||
|
||||
if (y_fraction)
|
||||
{
|
||||
ystart++;
|
||||
decision += dx;
|
||||
}
|
||||
|
||||
if (dx)
|
||||
{
|
||||
if (loop == 2 || loop == 3)
|
||||
{
|
||||
shift = xsign;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yend = GX_FIXED_VAL_RND(yend);
|
||||
|
||||
if (y_fraction >= GX_FIXED_VAL_HALF)
|
||||
{
|
||||
ystart++;
|
||||
decision += dx;
|
||||
}
|
||||
|
||||
decision += (dy >> 1);
|
||||
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += xsign;
|
||||
}
|
||||
}
|
||||
|
||||
for (cury = ystart; cury <= yend; cury++, decision += dx)
|
||||
{
|
||||
if (decision >= dy)
|
||||
{
|
||||
decision -= dy;
|
||||
curx += xsign;
|
||||
}
|
||||
|
||||
test = curx + shift;
|
||||
|
||||
if ((test >= xmin) && (test <= xmax))
|
||||
{
|
||||
Index = (test - xmin) << 1;
|
||||
|
||||
if (cury < pLineEnds[Index])
|
||||
{
|
||||
pLineEnds[Index] = cury;
|
||||
}
|
||||
|
||||
if (cury > pLineEnds[Index + 1])
|
||||
{
|
||||
pLineEnds[Index + 1] = cury;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Index = 0;
|
||||
line_draw = context -> gx_draw_context_display -> gx_display_driver_vertical_line_draw;
|
||||
|
||||
for (curx = xmin; curx <= xmax; curx++)
|
||||
{
|
||||
if (pLineEnds[Index] < clip -> gx_rectangle_top)
|
||||
{
|
||||
pLineEnds[Index] = clip -> gx_rectangle_top;
|
||||
}
|
||||
|
||||
if (pLineEnds[Index + 1] > clip -> gx_rectangle_bottom)
|
||||
{
|
||||
pLineEnds[Index + 1] = clip -> gx_rectangle_bottom;
|
||||
}
|
||||
|
||||
if (pLineEnds[Index] <= pLineEnds[Index + 1])
|
||||
{
|
||||
line_draw(context, pLineEnds[Index], pLineEnds[Index + 1], curx, 1, linecolor);
|
||||
}
|
||||
Index += 2;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_generic_simple_wide_line_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -77,6 +77,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* supported display rotation, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_generic_simple_wide_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart,
|
||||
@ -186,9 +189,15 @@ GX_UBYTE old_alpha;
|
||||
*/
|
||||
line_points = _gx_display_driver_generic_wide_line_points_calculate(context, xstart, ystart,
|
||||
xend, yend, brush_width, GX_FALSE);
|
||||
|
||||
if (display -> gx_display_rotation_angle)
|
||||
{
|
||||
_gx_display_driver_generic_rotated_wide_line_fill(context, line_points);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gx_display_driver_generic_wide_line_fill(context, line_points);
|
||||
}
|
||||
}
|
||||
#if defined(GX_BRUSH_ALPHA_SUPPORT)
|
||||
context -> gx_draw_context_brush.gx_brush_alpha = old_alpha;
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@ static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_display_driver_monochrome_setup PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -68,6 +68,10 @@ static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESO
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added rotation angle */
|
||||
/* initialization, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_display_driver_monochrome_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||
@ -104,6 +108,7 @@ VOID _gx_display_driver_monochrome_setup(GX_DISPLAY *display, VOID *aux_data
|
||||
display -> gx_display_mouse_define = _gx_display_driver_generic_mouse_define;
|
||||
#endif
|
||||
|
||||
display -> gx_display_rotation_angle = 0;
|
||||
display -> gx_display_driver_data = (VOID *)aux_data;
|
||||
display -> gx_display_accelerator = GX_NULL;
|
||||
display -> gx_display_layer_services = GX_NULL;
|
||||
|
@ -260,6 +260,67 @@ GX_PIXEL pixel;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_image_reader_one_row_rotated_convert PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This helper function converts pixel data to specified color format */
|
||||
/* for one row of the pixelmap with rotation. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* image_reader Image reader control block */
|
||||
/* width Pointer to pixelmap width */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [gx_image_reader_pixel_read] Read a pixel from input buffer*/
|
||||
/* [gx_image_reader_pixel_write] Write a pixel out with */
|
||||
/* specified color format */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_image_reader_colorspace_convert */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||
static VOID _gx_image_reader_one_row_rotated_convert(GX_IMAGE_READER *image_reader, INT *width)
|
||||
{
|
||||
INT xval;
|
||||
GX_PIXEL pixel;
|
||||
|
||||
image_reader -> gx_image_reader_putdata = image_reader -> gx_image_reader_putdatarow;
|
||||
image_reader -> gx_image_reader_putauxdata = image_reader -> gx_image_reader_putauxdatarow;
|
||||
|
||||
for (xval = 0; xval < (*width); xval++)
|
||||
{
|
||||
image_reader -> gx_image_reader_pixel_read(image_reader, xval, &pixel);
|
||||
image_reader -> gx_image_reader_pixel_write(image_reader, &pixel);
|
||||
}
|
||||
|
||||
image_reader -> gx_image_reader_putdatarow += image_reader -> gx_image_reader_putdatarow_stride;
|
||||
image_reader -> gx_image_reader_putauxdatarow += image_reader -> gx_image_reader_putauxdatarow_stride;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@ -332,15 +393,22 @@ VOID (*row_convert)(GX_IMAGE_READER *, INT *);
|
||||
else
|
||||
{
|
||||
param = &width;
|
||||
|
||||
if (image_reader -> gx_image_reader_mode & (GX_IMAGE_READER_MODE_ROTATE_CW | GX_IMAGE_READER_MODE_ROTATE_CCW))
|
||||
{
|
||||
row_convert = _gx_image_reader_one_row_rotated_convert;
|
||||
}
|
||||
else
|
||||
{
|
||||
row_convert = _gx_image_reader_one_row_convert;
|
||||
}
|
||||
}
|
||||
|
||||
image_reader -> gx_image_reader_size_testing = GX_FALSE;
|
||||
|
||||
/* Run color space convert. */
|
||||
for (yval = 0; yval < height; yval++)
|
||||
{
|
||||
|
||||
row_convert(image_reader, param);
|
||||
|
||||
image_reader -> gx_image_reader_getdata += image_reader -> gx_image_reader_input_stride;
|
||||
|
@ -410,7 +410,7 @@ GX_UBYTE *pAlpha;
|
||||
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 3));
|
||||
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3));
|
||||
|
||||
if (image_reader->gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA)
|
||||
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA)
|
||||
{
|
||||
pAlpha = image_reader -> gx_image_reader_putauxdata;
|
||||
|
||||
@ -423,6 +423,80 @@ GX_UBYTE *pAlpha;
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_image_reader_565rgb_rotated_pixel_write PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function rotates a pixel to output pixemap data structure. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* image_reader Image reader control block. */
|
||||
/* pixel Pixel to write. */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_image_reader_pixel_write_callback_set */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static UINT _gx_image_reader_565rgb_rotated_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel)
|
||||
{
|
||||
USHORT *pLine;
|
||||
GX_UBYTE *pAlpha;
|
||||
|
||||
pLine = (USHORT *)image_reader -> gx_image_reader_putdata;
|
||||
|
||||
pixel -> gx_pixel_red &= 0xf8;
|
||||
pixel -> gx_pixel_green &= 0xfc;
|
||||
pixel -> gx_pixel_blue &= 0xf8;
|
||||
|
||||
(*pLine) = (USHORT)(pixel -> gx_pixel_red << 8);
|
||||
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 3));
|
||||
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3));
|
||||
|
||||
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA)
|
||||
{
|
||||
pAlpha = image_reader -> gx_image_reader_putauxdata;
|
||||
|
||||
(*pAlpha) = pixel -> gx_pixel_alpha;
|
||||
}
|
||||
|
||||
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW)
|
||||
{
|
||||
image_reader -> gx_image_reader_putauxdata -= image_reader -> gx_image_reader_image_height;
|
||||
image_reader -> gx_image_reader_putdata -= (image_reader -> gx_image_reader_image_height << 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
image_reader -> gx_image_reader_putauxdata += image_reader -> gx_image_reader_image_height;
|
||||
image_reader -> gx_image_reader_putdata += (image_reader -> gx_image_reader_image_height << 1);
|
||||
}
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@ -561,7 +635,7 @@ GX_UBYTE *pAlpha;
|
||||
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 2));
|
||||
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3));
|
||||
|
||||
if (image_reader->gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA)
|
||||
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA)
|
||||
{
|
||||
pAlpha = image_reader -> gx_image_reader_putauxdata;
|
||||
|
||||
@ -1128,12 +1202,102 @@ GX_UBYTE color;
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_image_reader_pixel_rotated_write_callback_set PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function sets pixel write callback of the image reader when */
|
||||
/* rotation mode is set. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* image_reader Image reader control block */
|
||||
/* outmap Outpu pixelmap. */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* Completion Status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_image_reader_565rgb_rotated_pixel_write */
|
||||
/* Write 565 rgb format pixel */
|
||||
/* in rotation mode */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _gx_image_reader_pixel_write_callback_set */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static UINT _gx_image_reader_pixel_rotated_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap)
|
||||
{
|
||||
switch (outmap -> gx_pixelmap_format)
|
||||
{
|
||||
case GX_COLOR_FORMAT_565RGB:
|
||||
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_565rgb_rotated_pixel_write;
|
||||
|
||||
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW)
|
||||
{
|
||||
outmap -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_90;
|
||||
|
||||
image_reader -> gx_image_reader_putdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_data;
|
||||
image_reader -> gx_image_reader_putdatarow += (outmap -> gx_pixelmap_width - 1) * (outmap -> gx_pixelmap_height << 1);
|
||||
|
||||
if (outmap -> gx_pixelmap_aux_data)
|
||||
{
|
||||
image_reader -> gx_image_reader_putauxdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data;
|
||||
image_reader -> gx_image_reader_putauxdatarow += (outmap -> gx_pixelmap_width - 1) * outmap -> gx_pixelmap_height;
|
||||
}
|
||||
|
||||
image_reader -> gx_image_reader_putdatarow_stride = 2;
|
||||
image_reader -> gx_image_reader_putauxdatarow_stride = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
outmap -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_270;
|
||||
|
||||
image_reader -> gx_image_reader_putdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_data;
|
||||
image_reader -> gx_image_reader_putdatarow += (outmap -> gx_pixelmap_height - 1) * 2;
|
||||
|
||||
if (outmap -> gx_pixelmap_aux_data)
|
||||
{
|
||||
image_reader -> gx_image_reader_putauxdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data;
|
||||
image_reader -> gx_image_reader_putauxdatarow += (outmap -> gx_pixelmap_height - 1);
|
||||
}
|
||||
|
||||
image_reader -> gx_image_reader_putdatarow_stride = -2;
|
||||
image_reader -> gx_image_reader_putauxdatarow_stride = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return GX_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_image_reader_pixel_write_callback_set PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -1198,11 +1362,49 @@ GX_UBYTE color;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* supported rotation mode, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
UINT _gx_image_reader_pixel_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap)
|
||||
{
|
||||
/* Allocate memory for data of the output pixelmap. */
|
||||
if (outmap -> gx_pixelmap_data_size)
|
||||
{
|
||||
outmap -> gx_pixelmap_data = (GX_UBYTE *)_gx_system_memory_allocator(outmap -> gx_pixelmap_data_size);
|
||||
|
||||
if (outmap -> gx_pixelmap_data == GX_NULL)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
memset((void *)outmap -> gx_pixelmap_data, 0, outmap -> gx_pixelmap_data_size);
|
||||
|
||||
image_reader -> gx_image_reader_putdata = (GX_UBYTE *)outmap -> gx_pixelmap_data;
|
||||
}
|
||||
|
||||
/* Allocate memory for aux data of the output pixelmap. */
|
||||
if (outmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
outmap -> gx_pixelmap_aux_data = (GX_UBYTE *)_gx_system_memory_allocator(outmap -> gx_pixelmap_aux_data_size);
|
||||
|
||||
if (outmap -> gx_pixelmap_aux_data == GX_NULL)
|
||||
{
|
||||
_gx_system_memory_free((void *)outmap -> gx_pixelmap_data);
|
||||
outmap -> gx_pixelmap_data = GX_NULL;
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
memset((void *)outmap -> gx_pixelmap_aux_data, 0, outmap -> gx_pixelmap_aux_data_size);
|
||||
|
||||
image_reader -> gx_image_reader_putauxdata = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
|
||||
if (image_reader -> gx_image_reader_mode & (GX_IMAGE_READER_MODE_ROTATE_CW | GX_IMAGE_READER_MODE_ROTATE_CCW))
|
||||
{
|
||||
return _gx_image_reader_pixel_rotated_write_callback_set(image_reader, outmap);
|
||||
}
|
||||
|
||||
/* Set pixel write callback. */
|
||||
switch (outmap -> gx_pixelmap_format)
|
||||
@ -1289,38 +1491,6 @@ UINT _gx_image_reader_pixel_write_callback_set(GX_IMAGE_READER *image_reader, GX
|
||||
return GX_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* Allocate memory for data of the output pixelmap. */
|
||||
if (outmap -> gx_pixelmap_data_size)
|
||||
{
|
||||
outmap -> gx_pixelmap_data = (GX_UBYTE *)_gx_system_memory_allocator(outmap -> gx_pixelmap_data_size);
|
||||
|
||||
if (outmap -> gx_pixelmap_data == GX_NULL)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
memset((void *)outmap -> gx_pixelmap_data, 0, outmap -> gx_pixelmap_data_size);
|
||||
|
||||
image_reader -> gx_image_reader_putdata = (GX_UBYTE *)outmap -> gx_pixelmap_data;
|
||||
}
|
||||
|
||||
/* Allocate memory for aux data of the output pixelmap. */
|
||||
if (outmap -> gx_pixelmap_aux_data_size)
|
||||
{
|
||||
outmap -> gx_pixelmap_aux_data = (GX_UBYTE *)_gx_system_memory_allocator(outmap -> gx_pixelmap_aux_data_size);
|
||||
|
||||
if (outmap -> gx_pixelmap_aux_data == GX_NULL)
|
||||
{
|
||||
_gx_system_memory_free((void *)outmap -> gx_pixelmap_data);
|
||||
outmap -> gx_pixelmap_data = GX_NULL;
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
memset((void *)outmap -> gx_pixelmap_aux_data, 0, outmap -> gx_pixelmap_aux_data_size);
|
||||
|
||||
image_reader -> gx_image_reader_putauxdata = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data;
|
||||
}
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_menu_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -78,6 +78,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* set menu event process, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
|
||||
@ -91,6 +94,7 @@ UINT _gx_menu_create(GX_MENU *menu, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
|
||||
/* Populate the rest of menu control block - overriding as necessary. */
|
||||
menu -> gx_widget_type = GX_TYPE_MENU;
|
||||
menu -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_menu_draw;
|
||||
menu -> gx_widget_event_process_function = (UINT(*)(GX_WIDGET*, GX_EVENT*))_gx_menu_event_process;
|
||||
menu -> gx_widget_style |= GX_STYLE_TEXT_LEFT | GX_STYLE_ENABLED;
|
||||
menu -> gx_menu_text_x_offset = 10;
|
||||
menu -> gx_menu_text_y_offset = 0;
|
||||
|
96
common/src/gx_menu_event_process.c
Normal file
96
common/src/gx_menu_event_process.c
Normal file
@ -0,0 +1,96 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Menu Management (Menu) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_widget.h"
|
||||
#include "gx_prompt.h"
|
||||
#include "gx_menu.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_menu_event_process PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function processes events for the specified menu. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* menu Pointer to menu control */
|
||||
/* block */
|
||||
/* event_ptr Incoming event to process */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_widget_delete Delete a widget */
|
||||
/* _gx_prompt_event_process Default prompt event process */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* GUIX Internal Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr)
|
||||
{
|
||||
|
||||
/* Process relative to the type of event. */
|
||||
switch (event_ptr -> gx_event_type)
|
||||
{
|
||||
case GX_EVENT_DELETE:
|
||||
if (menu -> gx_menu_list.gx_widget_first_child &&
|
||||
(menu -> gx_menu_list.gx_widget_parent == GX_NULL))
|
||||
{
|
||||
_gx_widget_delete((GX_WIDGET *)&menu -> gx_menu_list);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Do nothing. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Return completion status. */
|
||||
return _gx_prompt_event_process((GX_PROMPT *)menu, event_ptr);
|
||||
}
|
||||
|
@ -29,13 +29,14 @@
|
||||
#include "gx_multi_line_text_input.h"
|
||||
#include "gx_multi_line_text_view.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_system.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_multi_line_text_input_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -81,6 +82,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* supported dynamic buffer, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input,
|
||||
@ -102,6 +106,23 @@ GX_STRING string;
|
||||
/* Call the multi-line text view create function. */
|
||||
_gx_multi_line_text_view_create(view, name, GX_NULL, 0, style, text_input_id, size);
|
||||
|
||||
if ((!input_buffer) && buffer_size)
|
||||
{
|
||||
if (!_gx_system_memory_allocator)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
input_buffer = _gx_system_memory_allocator(buffer_size);
|
||||
|
||||
if (!input_buffer)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
text_input -> gx_widget_status |= GX_STATUS_DYNAMIC_BUFFER;
|
||||
}
|
||||
|
||||
if (_gx_utility_string_length_check(input_buffer, &string.gx_string_length, buffer_size - 1) == GX_SUCCESS)
|
||||
{
|
||||
string.gx_string_ptr = input_buffer;
|
||||
|
@ -303,7 +303,7 @@ GX_VALUE click_y;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_multi_line_text_input_event_process PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -357,6 +357,10 @@ GX_VALUE click_y;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added logic to release */
|
||||
/* dynamic input buffer, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_multi_line_text_input_event_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr)
|
||||
@ -576,6 +580,19 @@ ULONG old_style;
|
||||
_gx_multi_line_text_input_mark_home(text_input);
|
||||
break;
|
||||
|
||||
case GX_EVENT_DELETE:
|
||||
if (text_input -> gx_widget_status & GX_STATUS_DYNAMIC_BUFFER)
|
||||
{
|
||||
if (!_gx_system_memory_free)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
_gx_system_memory_free((void *)text_input -> gx_multi_line_text_view_text.gx_string_ptr);
|
||||
text_input -> gx_multi_line_text_view_text.gx_string_ptr = GX_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Call the multi-line text view event processing. */
|
||||
status = _gx_multi_line_text_view_event_process(view, event_ptr);
|
||||
|
@ -28,13 +28,14 @@
|
||||
#include "gx_scroll_wheel.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_widget.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_scroll_wheel_gradient_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -68,11 +69,17 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_scroll_wheel_gradient_create(GX_SCROLL_WHEEL *wheel)
|
||||
{
|
||||
GX_UBYTE gradient_mode;
|
||||
INT height;
|
||||
GX_CANVAS *canvas;
|
||||
GX_DISPLAY *display;
|
||||
|
||||
/* test to see if the scroll wheel has an alpha-mask overlay */
|
||||
if (wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_start ||
|
||||
@ -81,12 +88,34 @@ INT height;
|
||||
/* yes, test to see if it has been created */
|
||||
if (wheel -> gx_scroll_wheel_gradient.gx_gradient_pixelmap.gx_pixelmap_data == GX_NULL)
|
||||
{
|
||||
_gx_widget_canvas_get((GX_WIDGET *)wheel, &canvas);
|
||||
|
||||
if (canvas)
|
||||
{
|
||||
display = canvas -> gx_canvas_display;
|
||||
gradient_mode = GX_GRADIENT_TYPE_MIRROR | GX_GRADIENT_TYPE_ALPHA;
|
||||
height = wheel -> gx_widget_size.gx_rectangle_bottom - wheel -> gx_widget_size.gx_rectangle_top + 1;
|
||||
|
||||
if (display -> gx_display_rotation_angle == 0)
|
||||
{
|
||||
_gx_utility_gradient_create(&wheel -> gx_scroll_wheel_gradient, 3, (GX_VALUE)height,
|
||||
GX_GRADIENT_TYPE_MIRROR | GX_GRADIENT_TYPE_ALPHA | GX_GRADIENT_TYPE_VERTICAL,
|
||||
gradient_mode | GX_GRADIENT_TYPE_VERTICAL,
|
||||
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_start,
|
||||
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_end);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Generate rotated gradient map. */
|
||||
_gx_utility_gradient_create(&wheel -> gx_scroll_wheel_gradient, (GX_VALUE)height, 3,
|
||||
gradient_mode,
|
||||
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_start,
|
||||
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_end);
|
||||
|
||||
GX_SWAP_VALS(wheel -> gx_scroll_wheel_gradient.gx_gradient_pixelmap.gx_pixelmap_width,
|
||||
wheel -> gx_scroll_wheel_gradient.gx_gradient_pixelmap.gx_pixelmap_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_single_line_text_input_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -81,6 +81,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* supported dynamic buffer, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_single_line_text_input_create(GX_SINGLE_LINE_TEXT_INPUT *text_input,
|
||||
@ -102,6 +105,24 @@ GX_RECTANGLE client;
|
||||
/* Call the prompt widget create function. */
|
||||
_gx_prompt_create((GX_PROMPT *)text_input, name, GX_NULL, 0, style, text_input_id, size);
|
||||
|
||||
|
||||
if ((!input_buffer) && buffer_size)
|
||||
{
|
||||
if (!_gx_system_memory_allocator)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
input_buffer = _gx_system_memory_allocator(buffer_size);
|
||||
|
||||
if (!input_buffer)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
text_input -> gx_widget_status |= GX_STATUS_DYNAMIC_BUFFER;
|
||||
}
|
||||
|
||||
cursor_ptr = &text_input -> gx_single_line_text_input_cursor_instance;
|
||||
|
||||
/* Finish the rest of the single line text input widget creation process. */
|
||||
|
@ -238,7 +238,7 @@ GX_VALUE click_x;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_single_line_text_input_event_process PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -290,6 +290,10 @@ GX_VALUE click_x;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added logic to release */
|
||||
/* dynamic input buffer, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_single_line_text_input_event_process(GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr)
|
||||
@ -490,6 +494,19 @@ ULONG old_style;
|
||||
_gx_single_line_text_input_mark_end(text_input);
|
||||
break;
|
||||
|
||||
case GX_EVENT_DELETE:
|
||||
if (text_input -> gx_widget_status & GX_STATUS_DYNAMIC_BUFFER)
|
||||
{
|
||||
if (!_gx_system_memory_free)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
_gx_system_memory_free(text_input -> gx_single_line_text_input_buffer);
|
||||
text_input -> gx_single_line_text_input_buffer = GX_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Call the widget default processing. */
|
||||
status = _gx_widget_event_process(widget, event_ptr);
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_system_animation_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -68,6 +68,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), init */
|
||||
/* animation canvas to null, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if (GX_ANIMATION_POOL_SIZE > 0)
|
||||
@ -87,7 +90,8 @@ GX_ANIMATION *free_block;
|
||||
_gx_system_animation_free_list = free_block -> gx_animation_next;
|
||||
free_block -> gx_animation_next = GX_NULL;
|
||||
free_block -> gx_animation_system_allocated = GX_TRUE;
|
||||
free_block ->gx_animation_status = GX_ANIMATION_IDLE;
|
||||
free_block -> gx_animation_status = GX_ANIMATION_IDLE;
|
||||
free_block -> gx_animation_canvas = GX_NULL;
|
||||
*animation = free_block;
|
||||
}
|
||||
else
|
||||
|
@ -1612,7 +1612,7 @@ static GX_CONST GX_GLYPH SYSTEM_FONT_GLYPHS_4BPP[95] =
|
||||
};
|
||||
GX_CONST GX_FONT _gx_system_font_4bpp =
|
||||
{
|
||||
0x04, /* format */
|
||||
GX_FONT_FORMAT_4BPP, /* format */
|
||||
0, /* line pre-space */
|
||||
0, /* line post-space */
|
||||
18, /* font data height */
|
||||
|
@ -1130,5 +1130,5 @@ static GX_CONST GX_GLYPH font_SansPro_Regular_ttf_18_aa[95] =
|
||||
{char_7e, 8, -5, 9, 0, 9, 3} /* '~' */
|
||||
};
|
||||
|
||||
GX_FONT _gx_system_font_8bpp = { 0x08, 0, 0, 18, 13, 0x20, 0x7e, {font_SansPro_Regular_ttf_18_aa}, NULL };
|
||||
GX_FONT _gx_system_font_8bpp = { GX_FONT_FORMAT_8BPP, 0, 0, 18, 13, 0x20, 0x7e, {font_SansPro_Regular_ttf_18_aa}, NULL };
|
||||
|
||||
|
@ -1613,7 +1613,7 @@ static GX_CONST GX_GLYPH SYSTEM_FONT_GLYPHS_MONO[95] =
|
||||
|
||||
GX_CONST GX_FONT _gx_system_font_mono =
|
||||
{
|
||||
0x01, /* format */
|
||||
GX_FONT_FORMAT_1BPP, /* format */
|
||||
0, /* line pre-space */
|
||||
0, /* line post-space */
|
||||
18, /* font data height */
|
||||
|
@ -39,7 +39,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_system_initialize PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -78,6 +78,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_system_initialize(VOID)
|
||||
@ -248,7 +252,6 @@ UINT length;
|
||||
/* First initialize all ThreadX objects to 0. */
|
||||
memset(&_gx_system_event_queue, 0, sizeof(_gx_system_event_queue));
|
||||
memset(&_gx_system_protect, 0, sizeof(_gx_system_protect));
|
||||
memset(&_gx_system_timer, 0, sizeof(_gx_system_timer));
|
||||
|
||||
/* Check the validity of the GX_EVENT_SIZE constant. */
|
||||
if (GX_EVENT_SIZE < sizeof(GX_EVENT))
|
||||
@ -264,9 +267,13 @@ UINT length;
|
||||
return(GX_SYSTEM_ERROR);
|
||||
}
|
||||
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
memset(&_gx_system_timer, 0, sizeof(_gx_system_timer));
|
||||
|
||||
/* create the ThreadX timer that drives all GUIX timers */
|
||||
tx_timer_create(&_gx_system_timer, "guix timer", _gx_system_timer_expiration, 0,
|
||||
GX_SYSTEM_TIMER_TICKS, GX_SYSTEM_TIMER_TICKS, TX_NO_ACTIVATE);
|
||||
#endif
|
||||
|
||||
#ifdef TX_DISABLE_ERROR_CHECKING
|
||||
tx_queue_create(&_gx_system_event_queue, "GUIX System Event Queue", (GX_EVENT_SIZE / sizeof(ULONG)),
|
||||
|
@ -34,7 +34,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_system_timer_expiration PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -69,6 +69,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_system_timer_expiration(ULONG val)
|
||||
@ -82,7 +86,9 @@ GX_EVENT timer_event;
|
||||
_gx_system_animation_list == GX_NULL)
|
||||
{
|
||||
#ifdef GX_THREADX_BINDING
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
tx_timer_deactivate(&_gx_system_timer);
|
||||
#endif
|
||||
#else
|
||||
GX_TIMER_STOP;
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_system_timer_start PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -72,6 +72,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_system_timer_start(GX_WIDGET *owner, UINT timer_id, UINT initial_ticks, UINT reschedule_ticks)
|
||||
@ -132,6 +136,7 @@ UINT tx_timer_active;
|
||||
_gx_system_active_timer_list = found;
|
||||
|
||||
#ifdef GX_THREADX_BINDING
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
/* if the low-level timer is not active, start it */
|
||||
tx_timer_info_get(&_gx_system_timer, (CHAR **)TX_NULL, &tx_timer_active,
|
||||
(ULONG *)TX_NULL, (ULONG *)TX_NULL, (TX_TIMER **)TX_NULL);
|
||||
@ -140,6 +145,7 @@ UINT tx_timer_active;
|
||||
{
|
||||
tx_timer_activate(&_gx_system_timer);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
GX_TIMER_START;
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_system_timer_stop PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -70,6 +70,10 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added GX_DISABLE_THREADX_ */
|
||||
/* TIMER_SOURCE configuration, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_system_timer_stop(GX_WIDGET *owner, UINT timer_id)
|
||||
@ -137,7 +141,9 @@ GX_TIMER *search;
|
||||
_gx_system_animation_list == GX_NULL)
|
||||
{
|
||||
#ifdef GX_THREADX_BINDING
|
||||
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE
|
||||
tx_timer_deactivate(&_gx_system_timer);
|
||||
#endif
|
||||
#else
|
||||
GX_TIMER_STOP;
|
||||
#endif
|
||||
|
@ -504,6 +504,3 @@ UINT status;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* 11-15-2018 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 5.5 */
|
||||
|
@ -3050,7 +3050,7 @@ GX_BIDI_CONTEXT context;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_bidi_paragraph_reorder PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -3081,6 +3081,10 @@ GX_BIDI_CONTEXT context;
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* made this function a public */
|
||||
/* api, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_utility_bidi_paragraph_reorder(GX_BIDI_TEXT_INFO *input_info, GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head)
|
||||
@ -3183,67 +3187,5 @@ GX_STRING string = input_info -> gx_bidi_text_info_text;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_bidi_resolved_text_info_delete PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function deletes a reordered bidi text information link. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* reordered_text The head pointer of reordered */
|
||||
/* bidi text information link */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_utility_bidi_resolved_text_info_delete(GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head)
|
||||
{
|
||||
GX_BIDI_RESOLVED_TEXT_INFO *info;
|
||||
GX_BIDI_RESOLVED_TEXT_INFO *next;
|
||||
|
||||
if (!_gx_system_memory_free)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
info = *resolved_info_head;
|
||||
|
||||
while (info)
|
||||
{
|
||||
next = info-> gx_bidi_resolved_text_info_next;
|
||||
_gx_system_memory_free(info);
|
||||
info = next;
|
||||
}
|
||||
|
||||
*resolved_info_head = GX_NULL;
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
95
common/src/gx_utility_bidi_resolved_text_info_delete.c
Normal file
95
common/src/gx_utility_bidi_resolved_text_info_delete.c
Normal file
@ -0,0 +1,95 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Utility (Utility) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_utility.h"
|
||||
#include "gx_system.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_bidi_resolved_text_info_delete PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function deletes a reordered bidi text information link. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* reordered_text The head pointer of reordered */
|
||||
/* bidi text information link */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
UINT _gx_utility_bidi_resolved_text_info_delete(GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head)
|
||||
{
|
||||
GX_BIDI_RESOLVED_TEXT_INFO *info;
|
||||
GX_BIDI_RESOLVED_TEXT_INFO *next;
|
||||
|
||||
if (!_gx_system_memory_free)
|
||||
{
|
||||
return GX_SYSTEM_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
info = *resolved_info_head;
|
||||
|
||||
while (info)
|
||||
{
|
||||
next = info -> gx_bidi_resolved_text_info_next;
|
||||
_gx_system_memory_free(info);
|
||||
info = next;
|
||||
}
|
||||
|
||||
*resolved_info_head = GX_NULL;
|
||||
|
||||
return GX_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
@ -279,7 +279,7 @@ GX_UBYTE *data = (GX_UBYTE *)gradient -> gx_gradient_pixelmap.gx_pixelmap_data;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_gradient_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -317,6 +317,9 @@ GX_UBYTE *data = (GX_UBYTE *)gradient -> gx_gradient_pixelmap.gx_pixelmap_data;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), removed */
|
||||
/* errant comment, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_utility_gradient_create(GX_GRADIENT *gradient, GX_VALUE width, GX_VALUE height,
|
||||
@ -338,9 +341,7 @@ UINT status = GX_FAILURE;
|
||||
}
|
||||
|
||||
memset(&gradient -> gx_gradient_pixelmap, 0, sizeof(GX_PIXELMAP));
|
||||
gradient -> gx_gradient_pixelmap.gx_pixelmap_width = width;/* 11-15-2018 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 5.5 */
|
||||
|
||||
gradient -> gx_gradient_pixelmap.gx_pixelmap_width = width;
|
||||
gradient -> gx_gradient_pixelmap.gx_pixelmap_height = height;
|
||||
gradient -> gx_gradient_type = type;
|
||||
gradient -> gx_gradient_alpha_start = alpha_start;
|
||||
|
@ -32,7 +32,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_pixelmap_resize PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -77,11 +77,15 @@
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added 565bgr format support,*/
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_utility_pixelmap_resize(GX_PIXELMAP *src, GX_PIXELMAP *destination, INT width, INT height)
|
||||
{
|
||||
UINT status = GX_SUCCESS;
|
||||
GX_PIXELMAP rotated_src;
|
||||
|
||||
memset(destination, 0, sizeof(GX_PIXELMAP));
|
||||
|
||||
@ -97,6 +101,16 @@ UINT status = GX_SUCCESS;
|
||||
return GX_INVALID_HEIGHT;
|
||||
}
|
||||
|
||||
if ((src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) ||
|
||||
(src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
rotated_src = (*src);
|
||||
GX_SWAP_VALS(rotated_src.gx_pixelmap_width, rotated_src.gx_pixelmap_height);
|
||||
GX_SWAP_VALS(width, height);
|
||||
|
||||
src = &rotated_src;
|
||||
}
|
||||
|
||||
switch (src -> gx_pixelmap_format)
|
||||
{
|
||||
case GX_COLOR_FORMAT_32ARGB:
|
||||
@ -142,6 +156,12 @@ UINT status = GX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) ||
|
||||
(src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
GX_SWAP_VALS(destination -> gx_pixelmap_width, destination -> gx_pixelmap_height);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_pixelmap_rotation PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -81,11 +81,15 @@
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added 565bgr format support,*/
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_utility_pixelmap_rotate(GX_PIXELMAP *src, INT angle, GX_PIXELMAP *destination, INT *rot_cx, INT *rot_cy)
|
||||
{
|
||||
UINT status = GX_SUCCESS;
|
||||
GX_PIXELMAP rotated_src;
|
||||
|
||||
/* Limit pixelmap width to 14bits. */
|
||||
if (src -> gx_pixelmap_width > GX_MAX_PIXELMAP_RESOLUTION)
|
||||
@ -99,6 +103,28 @@ UINT status = GX_SUCCESS;
|
||||
return GX_INVALID_HEIGHT;
|
||||
}
|
||||
|
||||
if ((src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) ||
|
||||
(src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
rotated_src = (*src);
|
||||
GX_SWAP_VALS(rotated_src.gx_pixelmap_width, rotated_src.gx_pixelmap_height);
|
||||
src = &rotated_src;
|
||||
|
||||
if (rot_cx && rot_cy)
|
||||
{
|
||||
GX_SWAP_VALS(*rot_cx, *rot_cy);
|
||||
|
||||
if (src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
*rot_cy = src -> gx_pixelmap_height - 1 - (*rot_cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
*rot_cx = src -> gx_pixelmap_width - 1 - (*rot_cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
angle = angle % 360;
|
||||
|
||||
if (angle == 0)
|
||||
@ -122,9 +148,10 @@ UINT status = GX_SUCCESS;
|
||||
|
||||
if ((angle % 90) == 0)
|
||||
{
|
||||
return _gx_utility_pixelmap_simple_rotate(src, angle, destination, rot_cx, rot_cy);
|
||||
_gx_utility_pixelmap_simple_rotate(src, angle, destination, rot_cx, rot_cy);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
memset(destination, 0, sizeof(GX_PIXELMAP));
|
||||
destination -> gx_pixelmap_format = src -> gx_pixelmap_format;
|
||||
destination -> gx_pixelmap_version_major = src -> gx_pixelmap_version_major;
|
||||
@ -178,6 +205,27 @@ UINT status = GX_SUCCESS;
|
||||
default:
|
||||
return GX_INVALID_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
if ((src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) ||
|
||||
(src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
GX_SWAP_VALS(destination -> gx_pixelmap_width, destination -> gx_pixelmap_height);
|
||||
|
||||
if (rot_cx && rot_cy)
|
||||
{
|
||||
GX_SWAP_VALS(*rot_cx, *rot_cy);
|
||||
|
||||
if (src -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
*rot_cx = destination -> gx_pixelmap_width - 1 - (*rot_cx);
|
||||
}
|
||||
else
|
||||
{
|
||||
*rot_cy = destination -> gx_pixelmap_height - 1 - (*rot_cy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_string_to_alphamap PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -84,6 +84,9 @@
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
|
||||
@ -109,7 +112,7 @@ GX_STRING string;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_string_to_alphamap_ext PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -151,6 +154,9 @@ GX_STRING string;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_utility_string_to_alphamap_ext(GX_CONST GX_STRING *string, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap)
|
||||
@ -252,7 +258,7 @@ UINT glyph_len;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_glyph_8bpp_to_alphamap_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -291,6 +297,9 @@ UINT glyph_len;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_utility_glyph_8bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph)
|
||||
@ -303,14 +312,35 @@ UINT row;
|
||||
UINT col;
|
||||
UINT pixel_width = 0;
|
||||
UINT y_height;
|
||||
USHORT write_stride;
|
||||
|
||||
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_height;
|
||||
pixel_width = glyph -> gx_glyph_height;
|
||||
y_height = glyph -> gx_glyph_width;
|
||||
GX_SWAP_VALS(xpos, ypos)
|
||||
|
||||
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
ypos = (map -> gx_pixelmap_width - ypos - glyph -> gx_glyph_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = (map -> gx_pixelmap_height - xpos - glyph -> gx_glyph_height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_width;
|
||||
pixel_width = glyph -> gx_glyph_width;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
}
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
|
||||
write_row = (GX_UBYTE *)map -> gx_pixelmap_data;
|
||||
write_row += ypos * map -> gx_pixelmap_width;
|
||||
write_row += ypos * write_stride;
|
||||
write_row += xpos;
|
||||
|
||||
for (row = 0; row < y_height; row++)
|
||||
@ -322,8 +352,8 @@ UINT y_height;
|
||||
{
|
||||
*write_data++ = *read_data++;
|
||||
}
|
||||
read_row += glyph -> gx_glyph_width;
|
||||
write_row += map -> gx_pixelmap_width;
|
||||
read_row += pixel_width;
|
||||
write_row += write_stride;
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,7 +362,7 @@ UINT y_height;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_glyph_4bpp_to_alphamap_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -371,6 +401,9 @@ UINT y_height;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_utility_glyph_4bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph)
|
||||
@ -382,20 +415,42 @@ GX_UBYTE *write_row;
|
||||
UINT row;
|
||||
UINT col;
|
||||
UINT pixel_width = 0;
|
||||
UINT byte_width;
|
||||
UINT read_stride;
|
||||
USHORT write_stride;
|
||||
UINT y_height;
|
||||
GX_UBYTE data;
|
||||
|
||||
pixel_width = glyph -> gx_glyph_width;
|
||||
byte_width = (pixel_width + 1) / 2;
|
||||
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_height;
|
||||
pixel_width = glyph -> gx_glyph_height;
|
||||
y_height = glyph -> gx_glyph_width;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos)
|
||||
|
||||
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
ypos = (INT)map -> gx_pixelmap_width - (INT)ypos - (INT)y_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = (INT)map -> gx_pixelmap_height - (INT)xpos - (INT)pixel_width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_width = (USHORT)glyph -> gx_glyph_width;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
write_stride = (USHORT)map -> gx_pixelmap_width;
|
||||
}
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
|
||||
write_row = (GX_UBYTE *)map -> gx_pixelmap_data;
|
||||
write_row += ypos * map -> gx_pixelmap_width;
|
||||
write_row += ypos * write_stride;
|
||||
write_row += xpos;
|
||||
|
||||
read_stride = (pixel_width + 1) / 2;
|
||||
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
read_data = read_row;
|
||||
@ -413,8 +468,8 @@ GX_UBYTE data;
|
||||
*write_data++ = (GX_UBYTE)((data << 4) | (data & 0x0f));
|
||||
}
|
||||
}
|
||||
read_row += byte_width;
|
||||
write_row += map -> gx_pixelmap_width;
|
||||
read_row += read_stride;
|
||||
write_row += write_stride;
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,7 +478,7 @@ GX_UBYTE data;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_glyph_reversed_4bpp_to_alphamap_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -462,6 +517,9 @@ GX_UBYTE data;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SYNERGY_FONT_FORMAT_SUPPORT)
|
||||
@ -476,18 +534,42 @@ UINT col;
|
||||
UINT pixel_width = 0;
|
||||
UINT byte_width;
|
||||
UINT y_height;
|
||||
USHORT write_stride;
|
||||
GX_UBYTE data;
|
||||
|
||||
|
||||
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_height;
|
||||
pixel_width = glyph -> gx_glyph_height;
|
||||
y_height = glyph -> gx_glyph_width;
|
||||
|
||||
GX_SWAP_VALS(xpos, ypos)
|
||||
|
||||
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
ypos = (INT)map -> gx_pixelmap_width - (INT)ypos - (INT)y_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = (INT)map -> gx_pixelmap_height - (INT)xpos - (INT)pixel_width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_width = glyph -> gx_glyph_width;
|
||||
byte_width = (pixel_width + 1) / 2;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
write_stride = (USHORT)map -> gx_pixelmap_width;
|
||||
}
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
|
||||
write_row = (GX_UBYTE *)map -> gx_pixelmap_data;
|
||||
write_row += ypos * map -> gx_pixelmap_width;
|
||||
write_row += ypos * write_stride;
|
||||
write_row += xpos;
|
||||
|
||||
byte_width = (pixel_width + 1) / 2;
|
||||
|
||||
|
||||
for (row = 0; row < y_height; row++)
|
||||
{
|
||||
read_data = read_row;
|
||||
@ -506,7 +588,7 @@ GX_UBYTE data;
|
||||
}
|
||||
}
|
||||
read_row += byte_width;
|
||||
write_row += map -> gx_pixelmap_width;
|
||||
write_row += write_stride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -516,7 +598,7 @@ GX_UBYTE data;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_glyph_1bpp_to_alphamap_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -555,6 +637,9 @@ GX_UBYTE data;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_utility_glyph_1bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph)
|
||||
@ -566,31 +651,55 @@ GX_UBYTE *write_row;
|
||||
UINT row;
|
||||
UINT col;
|
||||
UINT y_height;
|
||||
GX_UBYTE glyph_width;
|
||||
GX_UBYTE data;
|
||||
UINT pixel_in_first_byte = 8;
|
||||
UINT pixel_in_last_byte;
|
||||
UINT num_bits;
|
||||
UINT num_bytes;
|
||||
USHORT write_stride;
|
||||
GX_UBYTE mask;
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_height;
|
||||
y_height = glyph -> gx_glyph_width;
|
||||
glyph_width = (USHORT)glyph -> gx_glyph_height;
|
||||
GX_SWAP_VALS(xpos, ypos)
|
||||
|
||||
pixel_in_last_byte = ((UINT)glyph -> gx_glyph_width) & 0x7;
|
||||
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
ypos = (map -> gx_pixelmap_width - ypos - glyph -> gx_glyph_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = (map -> gx_pixelmap_height - xpos - glyph -> gx_glyph_height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_width;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
glyph_width = glyph -> gx_glyph_width;
|
||||
}
|
||||
|
||||
pixel_in_last_byte = ((UINT)glyph_width) & 0x7;
|
||||
if (pixel_in_last_byte == 0)
|
||||
{
|
||||
pixel_in_last_byte = 8;
|
||||
}
|
||||
|
||||
num_bytes = (((UINT)glyph -> gx_glyph_width) + 7) >> 3;
|
||||
num_bytes = (((UINT)glyph_width) + 7) >> 3;
|
||||
|
||||
if (num_bytes == 1)
|
||||
{
|
||||
pixel_in_first_byte = pixel_in_last_byte;
|
||||
}
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
|
||||
write_row = (GX_UBYTE *)map -> gx_pixelmap_data;
|
||||
write_row += ypos * map -> gx_pixelmap_width;
|
||||
write_row += ypos * write_stride;
|
||||
write_row += xpos;
|
||||
|
||||
for (row = 0; row < y_height; row++)
|
||||
@ -643,7 +752,7 @@ GX_UBYTE mask;
|
||||
}
|
||||
|
||||
read_row += num_bytes;
|
||||
write_row += map -> gx_pixelmap_width;
|
||||
write_row += write_stride;
|
||||
}
|
||||
}
|
||||
|
||||
@ -652,7 +761,7 @@ GX_UBYTE mask;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_glyph_reversed_1bpp_to_alphamap_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -691,6 +800,9 @@ GX_UBYTE mask;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_SYNERGY_FONT_FORMAT_SUPPORT)
|
||||
@ -703,31 +815,55 @@ GX_UBYTE *write_row;
|
||||
UINT row;
|
||||
UINT col;
|
||||
UINT y_height;
|
||||
GX_UBYTE glyph_width;
|
||||
GX_UBYTE data;
|
||||
UINT pixel_in_first_byte = 8;
|
||||
UINT pixel_in_last_byte;
|
||||
UINT num_bits;
|
||||
UINT num_bytes;
|
||||
USHORT write_stride;
|
||||
GX_UBYTE mask;
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270))
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_height;
|
||||
y_height = glyph -> gx_glyph_width;
|
||||
glyph_width = glyph -> gx_glyph_height;
|
||||
GX_SWAP_VALS(xpos, ypos)
|
||||
|
||||
pixel_in_last_byte = ((UINT)glyph -> gx_glyph_width) & 0x7;
|
||||
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90)
|
||||
{
|
||||
ypos = (map -> gx_pixelmap_width - ypos - glyph -> gx_glyph_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos = (map -> gx_pixelmap_height - xpos - glyph -> gx_glyph_height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write_stride = (USHORT)map -> gx_pixelmap_width;
|
||||
y_height = glyph -> gx_glyph_height;
|
||||
glyph_width = glyph -> gx_glyph_width;
|
||||
}
|
||||
|
||||
pixel_in_last_byte = ((UINT)glyph_width) & 0x7;
|
||||
if (pixel_in_last_byte == 0)
|
||||
{
|
||||
pixel_in_last_byte = 8;
|
||||
}
|
||||
|
||||
num_bytes = (((UINT)glyph -> gx_glyph_width) + 7) >> 3;
|
||||
num_bytes = (((UINT)glyph_width) + 7) >> 3;
|
||||
|
||||
if (num_bytes == 1)
|
||||
{
|
||||
pixel_in_first_byte = pixel_in_last_byte;
|
||||
}
|
||||
|
||||
read_row = (GX_UBYTE *)glyph -> gx_glyph_map;
|
||||
|
||||
write_row = (GX_UBYTE *)map -> gx_pixelmap_data;
|
||||
write_row += ypos * map -> gx_pixelmap_width;
|
||||
write_row += ypos * write_stride;
|
||||
write_row += xpos;
|
||||
|
||||
for (row = 0; row < y_height; row++)
|
||||
@ -780,7 +916,7 @@ GX_UBYTE mask;
|
||||
}
|
||||
|
||||
read_row += num_bytes;
|
||||
write_row += map -> gx_pixelmap_width;
|
||||
write_row += write_stride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -790,7 +926,7 @@ GX_UBYTE mask;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_utility_string_to_alphamap_draw PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -833,6 +969,9 @@ GX_UBYTE mask;
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), added */
|
||||
/* display rotation support, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _gx_utility_string_to_alphamap_draw(GX_CONST GX_STRING *string, GX_CONST GX_FONT *font, GX_PIXELMAP *map)
|
||||
@ -863,6 +1002,15 @@ UINT glyph_len;
|
||||
xpos = 0;
|
||||
string_copy = *string;
|
||||
|
||||
if (font -> gx_font_format & GX_FONT_FORMAT_ROTATED_90)
|
||||
{
|
||||
map -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_90;
|
||||
}
|
||||
else if (font -> gx_font_format & GX_FONT_FORMAT_ROTATED_270)
|
||||
{
|
||||
map -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_270;
|
||||
}
|
||||
|
||||
switch (font -> gx_font_format & GX_FONT_FORMAT_BPP_MASK)
|
||||
{
|
||||
case GX_FONT_FORMAT_8BPP:
|
||||
|
@ -127,7 +127,7 @@ GX_WIDGET *end = GX_NULL;
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gx_widget_event_process PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -167,6 +167,10 @@ GX_WIDGET *end = GX_NULL;
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added new event entries, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* avoid pass widget delete */
|
||||
/* event to parent, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gx_widget_event_process(GX_WIDGET *widget, GX_EVENT *event_ptr)
|
||||
@ -355,6 +359,7 @@ UINT status = GX_SUCCESS;
|
||||
case GX_EVENT_CLIENT_UPDATED:
|
||||
case GX_EVENT_PARENT_SIZED:
|
||||
case GX_EVENT_RESIZED:
|
||||
case GX_EVENT_DELETE:
|
||||
break;
|
||||
|
||||
case GX_EVENT_PEN_UP:
|
||||
|
99
common/src/gxe_menu_event_process.c
Normal file
99
common/src/gxe_menu_event_process.c
Normal file
@ -0,0 +1,99 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Menu Management (Menu) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_menu.h"
|
||||
|
||||
/* Bring in externs for caller checking code. */
|
||||
GX_CALLER_CHECKING_EXTERNS
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gxe_menu_event_process PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks for errors in the menu event process */
|
||||
/* function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* menu Pointer to menu control */
|
||||
/* block */
|
||||
/* event_ptr Incoming event to process */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_menu_event_process Actual menu event process */
|
||||
/* function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gxe_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr)
|
||||
{
|
||||
UINT status;
|
||||
|
||||
/* Check for appropriate caller. */
|
||||
GX_INIT_AND_THREADS_CALLER_CHECKING
|
||||
|
||||
/* Check for invalid input pointers. */
|
||||
if ((menu == GX_NULL) || (event_ptr == GX_NULL))
|
||||
{
|
||||
return(GX_PTR_ERROR);
|
||||
}
|
||||
|
||||
/* Check for invalid widget. */
|
||||
if (menu -> gx_widget_type == 0)
|
||||
{
|
||||
return(GX_INVALID_WIDGET);
|
||||
}
|
||||
|
||||
/* Call actual menu event process function. */
|
||||
status = _gx_menu_event_process(menu, event_ptr);
|
||||
|
||||
/* Return successful completion. */
|
||||
return(status);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ GX_CALLER_CHECKING_EXTERNS
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gxe_multi_line_text_input_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -79,6 +79,9 @@ GX_CALLER_CHECKING_EXTERNS
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* removed input buffer check, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _gxe_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr,
|
||||
@ -97,7 +100,7 @@ UINT status;
|
||||
GX_INIT_AND_THREADS_CALLER_CHECKING
|
||||
|
||||
/* Check for invalid pointer. */
|
||||
if ((text_input_ptr == GX_NULL) || (input_buffer == GX_NULL) || (size == GX_NULL))
|
||||
if ((text_input_ptr == GX_NULL) || (size == GX_NULL))
|
||||
{
|
||||
return(GX_PTR_ERROR);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ GX_CALLER_CHECKING_EXTERNS
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gxe_single_line_text_input_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -81,6 +81,9 @@ GX_CALLER_CHECKING_EXTERNS
|
||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* removed input buffer check, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -100,7 +103,7 @@ UINT status;
|
||||
GX_INIT_AND_THREADS_CALLER_CHECKING
|
||||
|
||||
/* Check for invalid input pointers. */
|
||||
if ((text_input == GX_NULL) || (input_buffer == GX_NULL) || (size == GX_NULL))
|
||||
if ((text_input == GX_NULL) || (size == GX_NULL))
|
||||
{
|
||||
return(GX_PTR_ERROR);
|
||||
}
|
||||
|
91
common/src/gxe_utility_bidi_paragraph_reorder.c
Normal file
91
common/src/gxe_utility_bidi_paragraph_reorder.c
Normal file
@ -0,0 +1,91 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Utility (Utility) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
|
||||
GX_CALLER_CHECKING_EXTERNS
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gxe_utility_bidi_resolved_text_info_delete PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks for errors in the utility bidi resolved text */
|
||||
/* info delete function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* reordered_text The head pointer of reordered */
|
||||
/* bidi text information link */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_utility_bidi_resolved_text_info_delete */
|
||||
/* Actual utility bidi resolved */
|
||||
/* text into delete function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
UINT _gxe_utility_bidi_paragraph_reorder(GX_BIDI_TEXT_INFO *input_info, GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head)
|
||||
{
|
||||
UINT status;
|
||||
|
||||
/* Check for invalid input pointers. */
|
||||
if ((input_info == GX_NULL) || (resolved_info_head == GX_NULL))
|
||||
{
|
||||
return GX_PTR_ERROR;
|
||||
}
|
||||
|
||||
/* Call the actual utility bidi paragraph reorder function. */
|
||||
status = _gx_utility_bidi_paragraph_reorder(input_info, resolved_info_head);
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
91
common/src/gxe_utility_bidi_resolved_text_info_delete.c
Normal file
91
common/src/gxe_utility_bidi_resolved_text_info_delete.c
Normal file
@ -0,0 +1,91 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Utility (Utility) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
|
||||
#define GX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_utility.h"
|
||||
|
||||
GX_CALLER_CHECKING_EXTERNS
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _gxe_utility_bidi_resolved_text_info_delete PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function checks for errors in the utility bidi resolved text */
|
||||
/* info delete function call. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* reordered_text The head pointer of reordered */
|
||||
/* bidi text information link */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_utility_bidi_resolved_text_info_delete */
|
||||
/* Actual utility bidi resolved */
|
||||
/* text into delete function */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
|
||||
UINT _gxe_utility_bidi_resolved_text_info_delete(GX_BIDI_RESOLVED_TEXT_INFO **resolved_info_head)
|
||||
{
|
||||
UINT status;
|
||||
|
||||
/* Check for invalid input pointers. */
|
||||
if (resolved_info_head == GX_NULL)
|
||||
{
|
||||
return GX_PTR_ERROR;
|
||||
}
|
||||
|
||||
/* Call the actual utility pixelmap resize function. */
|
||||
status = _gx_utility_bidi_resolved_text_info_delete(resolved_info_head);
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
BIN
fonts/NotoSansCJKsc-Regular.otf
Normal file
BIN
fonts/NotoSansCJKsc-Regular.otf
Normal file
Binary file not shown.
96
fonts/NotoSansCJKsc-Regular_license.txt
Normal file
96
fonts/NotoSansCJKsc-Regular_license.txt
Normal file
@ -0,0 +1,96 @@
|
||||
source:
|
||||
https://www.google.com/get/noto/help/cjk/
|
||||
|
||||
license info:
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font
|
||||
creation efforts of academic and linguistic communities, and to
|
||||
provide a free and open framework in which fonts may be shared and
|
||||
improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply to
|
||||
any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software
|
||||
components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to,
|
||||
deleting, or substituting -- in part or in whole -- any of the
|
||||
components of the Original Version, by changing formats or by porting
|
||||
the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed,
|
||||
modify, redistribute, and sell modified and unmodified copies of the
|
||||
Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in
|
||||
Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the
|
||||
corresponding Copyright Holder. This restriction only applies to the
|
||||
primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created using
|
||||
the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
BIN
fonts/verasans/Vera.ttf
Normal file
BIN
fonts/verasans/Vera.ttf
Normal file
Binary file not shown.
BIN
fonts/verasans/VeraBI.ttf
Normal file
BIN
fonts/verasans/VeraBI.ttf
Normal file
Binary file not shown.
BIN
fonts/verasans/VeraBd.ttf
Normal file
BIN
fonts/verasans/VeraBd.ttf
Normal file
Binary file not shown.
BIN
fonts/verasans/VeraIt.ttf
Normal file
BIN
fonts/verasans/VeraIt.ttf
Normal file
Binary file not shown.
45
fonts/verasans/vera_license.txt
Normal file
45
fonts/verasans/vera_license.txt
Normal file
@ -0,0 +1,45 @@
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
|
||||
Vera is a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the fonts accompanying this license ("Fonts") and associated
|
||||
documentation files (the "Font Software"), to reproduce and distribute
|
||||
the Font Software, including without limitation the rights to use,
|
||||
copy, merge, publish, distribute, and/or sell copies of the Font
|
||||
Software, and to permit persons to whom the Font Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice
|
||||
shall be included in all copies of one or more of the Font Software
|
||||
typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in
|
||||
particular the designs of glyphs or characters in the Fonts may be
|
||||
modified and additional glyphs or characters may be added to the
|
||||
Fonts, only if the fonts are renamed to names not containing either
|
||||
the words "Bitstream" or the word "Vera".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts
|
||||
or Font Software that has been modified and is distributed under the
|
||||
"Bitstream Vera" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but
|
||||
no copy of one or more of the Font Software typefaces may be sold by
|
||||
itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
|
||||
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
|
||||
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome
|
||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||
otherwise to promote the sale, use or other dealings in this Font
|
||||
Software without prior written authorization from the Gnome Foundation
|
||||
or Bitstream Inc., respectively. For further information, contact:
|
||||
fonts at gnome dot org.
|
BIN
fonts/veraserif/VeraSe.ttf
Normal file
BIN
fonts/veraserif/VeraSe.ttf
Normal file
Binary file not shown.
BIN
fonts/veraserif/VeraSeBd.ttf
Normal file
BIN
fonts/veraserif/VeraSeBd.ttf
Normal file
Binary file not shown.
45
fonts/veraserif/vera_license.txt
Normal file
45
fonts/veraserif/vera_license.txt
Normal file
@ -0,0 +1,45 @@
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
|
||||
Vera is a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the fonts accompanying this license (<28>Fonts<74>) and associated
|
||||
documentation files (the <20>Font Software<72>), to reproduce and distribute
|
||||
the Font Software, including without limitation the rights to use,
|
||||
copy, merge, publish, distribute, and/or sell copies of the Font
|
||||
Software, and to permit persons to whom the Font Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice
|
||||
shall be included in all copies of one or more of the Font Software
|
||||
typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in
|
||||
particular the designs of glyphs or characters in the Fonts may be
|
||||
modified and additional glyphs or characters may be added to the
|
||||
Fonts, only if the fonts are renamed to names not containing either
|
||||
the words <20>Bitstream<61> or the word <20>Vera<72>.
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts
|
||||
or Font Software that has been modified and is distributed under the
|
||||
<EFBFBD>Bitstream Vera<72> names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but
|
||||
no copy of one or more of the Font Software typefaces may be sold by
|
||||
itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED <20>AS IS<49>, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
|
||||
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
|
||||
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome
|
||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||
otherwise to promote the sale, use or other dealings in this Font
|
||||
Software without prior written authorization from the Gnome Foundation
|
||||
or Bitstream Inc., respectively. For further information, contact:
|
||||
fonts at gnome dot org.
|
@ -24,7 +24,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_api.h Win32/Visual */
|
||||
/* 6.1 */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
@ -39,6 +39,9 @@
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */
|
||||
/* 12-31-2020 Kenneth Maxwell Modified comment(s), */
|
||||
/* added new defines, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@ -71,6 +74,18 @@ typedef SHORT GX_VALUE;
|
||||
|
||||
#define GX_WIDGET_USER_DATA
|
||||
|
||||
/* Define Win32 event thread create. */
|
||||
#define GX_WIN32_EVENT_THREAD_CREATE(driver_data, thread_name) tx_thread_create(&driver_data->win32_driver_thread, thread_name, \
|
||||
gx_win32_driver_thread_entry, (ULONG)driver_data, \
|
||||
(GX_UBYTE *)driver_data -> win32_driver_thread_stack, GX_WIN32_STACK_SIZE,\
|
||||
GX_SYSTEM_THREAD_PRIORITY + 1, GX_SYSTEM_THREAD_PRIORITY + 1, \
|
||||
GX_SYSTEM_THREAD_TIMESLICE, TX_AUTO_START)
|
||||
|
||||
/* Define Win32 event thread exit. */
|
||||
#define GX_WIN32_EVENT_THREAD_EXIT(code) exit(code)
|
||||
|
||||
#define GX_WIN32_DISPLAY_DRIVER_EXTRA_MEMBERS_DECLEARE
|
||||
|
||||
/* Define the basic system parameters. */
|
||||
|
||||
#ifndef GX_THREAD_STACK_SIZE
|
||||
@ -149,7 +164,7 @@ typedef SHORT GX_VALUE;
|
||||
|
||||
#ifdef GX_SYSTEM_INIT
|
||||
CHAR _gx_version_id[] =
|
||||
"Copyright (c) Microsoft Corporation. All rights reserved. * GUIX Win32/Visual Version 6.1 *";
|
||||
"Copyright (c) Microsoft Corporation. All rights reserved. * GUIX Win32/Visual Version 6.1.3 *";
|
||||
#else
|
||||
extern CHAR _gx_version_id[];
|
||||
#endif
|
118
ports/win32/inc/gx_win32_display_driver.h
Normal file
118
ports/win32/inc/gx_win32_display_driver.h
Normal file
@ -0,0 +1,118 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Win32 Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* gx_win32_driver.h PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the GUIX Win32 display drivers. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GX_WIN32_DRIVER_H
|
||||
#define GX_WIN32_DRIVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* Yes, C++ compiler is present. Use standard C. */
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
#include "tx_api.h"
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_display.h"
|
||||
#include "windows.h"
|
||||
|
||||
#define GX_MAX_WIN32_DISPLAYS 2
|
||||
#define GX_WIN32_STACK_SIZE (16 * 1024)
|
||||
|
||||
/* Define Windows bitmap structure. */
|
||||
typedef struct GUIX_BMP_INFO_STRUCT
|
||||
{
|
||||
BITMAPINFOHEADER gx_bmp_header;
|
||||
DWORD gx_bmp_colors[256];
|
||||
} GX_BMP_INFO;
|
||||
|
||||
/* Define win32 display driver data structure. */
|
||||
typedef struct GX_WIN32_DISPLAY_DRIVER_STRUCT
|
||||
{
|
||||
ULONG win32_driver_type;
|
||||
GX_BMP_INFO win32_driver_bmpinfo;
|
||||
HWND win32_driver_winhandle;
|
||||
INT win32_driver_ready;
|
||||
TX_THREAD win32_driver_thread;
|
||||
ULONG win32_driver_thread_stack[GX_WIN32_STACK_SIZE / sizeof(ULONG)];
|
||||
GX_WIN32_DISPLAY_DRIVER_EXTRA_MEMBERS_DECLEARE
|
||||
} GX_WIN32_DISPLAY_DRIVER_DATA;
|
||||
|
||||
/* Define win32 driver functions. */
|
||||
UINT win32_graphics_driver_setup_monochrome(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_4bpp_grayscale(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_8bit_palette(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_565rgb(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_565rgb_rotated(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_565bgr(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_1555xrgb(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_4444argb(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *display);
|
||||
UINT win32_graphics_driver_setup_32argb(GX_DISPLAY *display);
|
||||
|
||||
UINT win32_chromeart_graphics_driver_setup_565rgb(GX_DISPLAY *display);
|
||||
UINT win32_synergy_graphics_driver_setup_8bit_palette(GX_DISPLAY *display);
|
||||
UINT win32_synergy_graphics_driver_setup_24xrgb(GX_DISPLAY *display);
|
||||
UINT win32_synergy_graphics_driver_setup_565rgb(GX_DISPLAY *display);
|
||||
UINT win32_synergy_graphics_driver_setup_565rgb_rotated(GX_DISPLAY *display);
|
||||
|
||||
void gx_win32_display_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
|
||||
void gx_win32_driver_thread_entry(ULONG thread_input);
|
||||
HWND gx_win32_window_create(GX_WIN32_DISPLAY_DRIVER_DATA *gx_driver_ptr, WNDPROC gx_win32_event_process, INT xpos, INT ypos);
|
||||
LRESULT CALLBACK gx_win32_event_process(HWND, UINT, WPARAM, LPARAM);
|
||||
void gx_win32_message_to_guix(USHORT event_type);
|
||||
void gx_win32_input_driver();
|
||||
GX_WIN32_DISPLAY_DRIVER_DATA *gx_win32_get_free_data_instance();
|
||||
GX_WIN32_DISPLAY_DRIVER_DATA *gx_win32_get_data_instance_by_win_handle(HWND winHandle);
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
C conditional started above. */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GX_WIN32_DRIVER_H */
|
||||
|
BIN
ports/win32/lib/vs_2019/tx.lib
Normal file
BIN
ports/win32/lib/vs_2019/tx.lib
Normal file
Binary file not shown.
2222
ports/win32/lib/vs_2019/tx_api.h
Normal file
2222
ports/win32/lib/vs_2019/tx_api.h
Normal file
File diff suppressed because it is too large
Load Diff
453
ports/win32/lib/vs_2019/tx_port.h
Normal file
453
ports/win32/lib/vs_2019/tx_port.h
Normal file
@ -0,0 +1,453 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Port Specific */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* PORT SPECIFIC C INFORMATION RELEASE */
|
||||
/* */
|
||||
/* tx_port.h Win32/Visual */
|
||||
/* 6.1 */
|
||||
/* */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file contains data type definitions that make the ThreadX */
|
||||
/* real-time kernel function identically on a variety of different */
|
||||
/* processor architectures. For example, the size or number of bits */
|
||||
/* in an "int" data type vary between microprocessor architectures and */
|
||||
/* even C compilers for the same microprocessor. ThreadX does not */
|
||||
/* directly use native C data types. Instead, ThreadX creates its */
|
||||
/* own special types that can be mapped to actual data types by this */
|
||||
/* file to guarantee consistency in the interface and functionality. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 William E. Lamie Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TX_PORT_H
|
||||
#define TX_PORT_H
|
||||
|
||||
|
||||
/* Determine if the optional ThreadX user define file should be used. */
|
||||
|
||||
#ifdef TX_INCLUDE_USER_DEFINE_FILE
|
||||
|
||||
|
||||
/* Yes, include the user defines in tx_user.h. The defines in this file may
|
||||
alternately be defined on the command line. */
|
||||
|
||||
#include "tx_user.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Define compiler library include files. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Define performance metric symbols. */
|
||||
|
||||
#ifndef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_MUTEX_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_MUTEX_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_THREAD_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_THREAD_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
#ifndef TX_TIMER_ENABLE_PERFORMANCE_INFO
|
||||
#define TX_TIMER_ENABLE_PERFORMANCE_INFO
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable trace info. */
|
||||
|
||||
#ifndef TX_ENABLE_EVENT_TRACE
|
||||
#define TX_ENABLE_EVENT_TRACE
|
||||
#endif
|
||||
|
||||
|
||||
/* Define ThreadX basic types for this port. */
|
||||
|
||||
#define VOID void
|
||||
typedef char CHAR;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
typedef long LONG;
|
||||
typedef unsigned long ULONG;
|
||||
typedef short SHORT;
|
||||
typedef unsigned short USHORT;
|
||||
|
||||
|
||||
/* Add Win32 debug insert prototype. */
|
||||
|
||||
void _tx_win32_debug_entry_insert(char *action, char *file, unsigned long line);
|
||||
|
||||
#ifndef TX_WIN32_DEBUG_ENABLE
|
||||
|
||||
/* If Win32 debug is not enabled, turn logging into white-space. */
|
||||
|
||||
#define _tx_win32_debug_entry_insert(a, b, c)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Define the TX_MEMSET macro to remove library reference. */
|
||||
|
||||
#define TX_MEMSET(a,b,c) { \
|
||||
UCHAR *ptr; \
|
||||
UCHAR value; \
|
||||
UINT i, size; \
|
||||
ptr = (UCHAR *) ((VOID *) a); \
|
||||
value = (UCHAR) b; \
|
||||
size = (UINT) c; \
|
||||
for (i = 0; i < size; i++) \
|
||||
{ \
|
||||
*ptr++ = value; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/* Include windows include file. */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
/* Define the priority levels for ThreadX. Legal values range
|
||||
from 32 to 1024 and MUST be evenly divisible by 32. */
|
||||
|
||||
#ifndef TX_MAX_PRIORITIES
|
||||
#define TX_MAX_PRIORITIES 32
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the minimum stack for a ThreadX thread on this processor. If the size supplied during
|
||||
thread creation is less than this value, the thread create call will return an error. */
|
||||
|
||||
#ifndef TX_MINIMUM_STACK
|
||||
#define TX_MINIMUM_STACK 200 /* Minimum stack size for this port */
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the system timer thread's default stack size and priority. These are only applicable
|
||||
if TX_TIMER_PROCESS_IN_ISR is not defined. */
|
||||
|
||||
#ifndef TX_TIMER_THREAD_STACK_SIZE
|
||||
#define TX_TIMER_THREAD_STACK_SIZE 400 /* Default timer thread stack size - Not used in Win32 port! */
|
||||
#endif
|
||||
|
||||
#ifndef TX_TIMER_THREAD_PRIORITY
|
||||
#define TX_TIMER_THREAD_PRIORITY 0 /* Default timer thread priority */
|
||||
#endif
|
||||
|
||||
|
||||
/* Define various constants for the ThreadX port. */
|
||||
|
||||
#define TX_INT_DISABLE 1 /* Disable interrupts */
|
||||
#define TX_INT_ENABLE 0 /* Enable interrupts */
|
||||
|
||||
|
||||
/* Define the clock source for trace event entry time stamp. The following two item are port specific.
|
||||
For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock
|
||||
source constants would be:
|
||||
|
||||
#define TX_TRACE_TIME_SOURCE *((ULONG *) 0x0a800024)
|
||||
#define TX_TRACE_TIME_MASK 0x0000FFFFUL
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TX_TRACE_TIME_SOURCE
|
||||
#define TX_TRACE_TIME_SOURCE ((ULONG) (_tx_win32_time_stamp.LowPart));
|
||||
#endif
|
||||
#ifndef TX_TRACE_TIME_MASK
|
||||
#define TX_TRACE_TIME_MASK 0xFFFFFFFFUL
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the port-specific trace extension to pickup the Windows timer. */
|
||||
|
||||
#define TX_TRACE_PORT_EXTENSION QueryPerformanceCounter((LARGE_INTEGER *)&_tx_win32_time_stamp);
|
||||
|
||||
|
||||
/* Define the port specific options for the _tx_build_options variable. This variable indicates
|
||||
how the ThreadX library was built. */
|
||||
|
||||
#define TX_PORT_SPECIFIC_BUILD_OPTIONS 0
|
||||
|
||||
|
||||
/* Define the in-line initialization constant so that modules with in-line
|
||||
initialization capabilities can prevent their initialization from being
|
||||
a function call. */
|
||||
|
||||
#define TX_INLINE_INITIALIZATION
|
||||
|
||||
|
||||
/* Define the Win32-specific initialization code that is expanded in the generic source. */
|
||||
|
||||
void _tx_initialize_start_interrupts(void);
|
||||
|
||||
#define TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION _tx_initialize_start_interrupts();
|
||||
|
||||
|
||||
/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
|
||||
disabled. When the following is defined, ThreadX thread stack checking is enabled. If stack
|
||||
checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
|
||||
define is negated, thereby forcing the stack fill which is necessary for the stack checking
|
||||
logic. */
|
||||
|
||||
#ifdef TX_ENABLE_STACK_CHECKING
|
||||
#undef TX_DISABLE_STACK_FILLING
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the TX_THREAD control block extensions for this port. The main reason
|
||||
for the multiple macros is so that backward compatibility can be maintained with
|
||||
existing ThreadX kernel awareness modules. */
|
||||
|
||||
#define TX_THREAD_EXTENSION_0 HANDLE tx_thread_win32_thread_handle; \
|
||||
DWORD tx_thread_win32_thread_id; \
|
||||
HANDLE tx_thread_win32_thread_run_semaphore; \
|
||||
UINT tx_thread_win32_suspension_type; \
|
||||
UINT tx_thread_win32_int_disabled_flag;
|
||||
#define TX_THREAD_EXTENSION_1
|
||||
#define TX_THREAD_EXTENSION_2
|
||||
#define TX_THREAD_EXTENSION_3
|
||||
|
||||
|
||||
/* Define the port extensions of the remaining ThreadX objects. */
|
||||
|
||||
#define TX_BLOCK_POOL_EXTENSION
|
||||
#define TX_BYTE_POOL_EXTENSION
|
||||
#define TX_EVENT_FLAGS_GROUP_EXTENSION
|
||||
#define TX_MUTEX_EXTENSION
|
||||
#define TX_QUEUE_EXTENSION
|
||||
#define TX_SEMAPHORE_EXTENSION
|
||||
#define TX_TIMER_EXTENSION
|
||||
|
||||
|
||||
/* Define the user extension field of the thread control block. Nothing
|
||||
additional is needed for this port so it is defined as white space. */
|
||||
|
||||
#ifndef TX_THREAD_USER_EXTENSION
|
||||
#define TX_THREAD_USER_EXTENSION
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the macros for processing extensions in tx_thread_create, tx_thread_delete,
|
||||
tx_thread_shell_entry, and tx_thread_terminate. */
|
||||
|
||||
|
||||
#define TX_THREAD_CREATE_EXTENSION(thread_ptr)
|
||||
#define TX_THREAD_DELETE_EXTENSION(thread_ptr)
|
||||
#define TX_THREAD_COMPLETED_EXTENSION(thread_ptr)
|
||||
#define TX_THREAD_TERMINATED_EXTENSION(thread_ptr)
|
||||
|
||||
|
||||
/* Define the ThreadX object creation extensions for the remaining objects. */
|
||||
|
||||
#define TX_BLOCK_POOL_CREATE_EXTENSION(pool_ptr)
|
||||
#define TX_BYTE_POOL_CREATE_EXTENSION(pool_ptr)
|
||||
#define TX_EVENT_FLAGS_GROUP_CREATE_EXTENSION(group_ptr)
|
||||
#define TX_MUTEX_CREATE_EXTENSION(mutex_ptr)
|
||||
#define TX_QUEUE_CREATE_EXTENSION(queue_ptr)
|
||||
#define TX_SEMAPHORE_CREATE_EXTENSION(semaphore_ptr)
|
||||
#define TX_TIMER_CREATE_EXTENSION(timer_ptr)
|
||||
|
||||
|
||||
/* Define the ThreadX object deletion extensions for the remaining objects. */
|
||||
|
||||
#define TX_BLOCK_POOL_DELETE_EXTENSION(pool_ptr)
|
||||
#define TX_BYTE_POOL_DELETE_EXTENSION(pool_ptr)
|
||||
#define TX_EVENT_FLAGS_GROUP_DELETE_EXTENSION(group_ptr)
|
||||
#define TX_MUTEX_DELETE_EXTENSION(mutex_ptr)
|
||||
#define TX_QUEUE_DELETE_EXTENSION(queue_ptr)
|
||||
#define TX_SEMAPHORE_DELETE_EXTENSION(semaphore_ptr)
|
||||
#define TX_TIMER_DELETE_EXTENSION(timer_ptr)
|
||||
|
||||
|
||||
struct TX_THREAD_STRUCT;
|
||||
|
||||
/* Define the Win32 critical section data structure. */
|
||||
|
||||
typedef struct TX_WIN32_CRITICAL_SECTION_STRUCT
|
||||
{
|
||||
HANDLE tx_win32_critical_section_mutex_handle;
|
||||
DWORD tx_win32_critical_section_owner;
|
||||
ULONG tx_win32_critical_section_nested_count;
|
||||
} TX_WIN32_CRITICAL_SECTION;
|
||||
|
||||
|
||||
/* Define Win32-specific critical section APIs. */
|
||||
|
||||
void _tx_win32_critical_section_obtain(TX_WIN32_CRITICAL_SECTION *critical_section);
|
||||
void _tx_win32_critical_section_release(TX_WIN32_CRITICAL_SECTION *critical_section);
|
||||
void _tx_win32_critical_section_release_all(TX_WIN32_CRITICAL_SECTION *critical_section);
|
||||
|
||||
|
||||
/* Define post completion processing for tx_thread_delete, so that the Win32 thread resources are properly removed. */
|
||||
|
||||
#define TX_THREAD_DELETE_PORT_COMPLETION(thread_ptr) \
|
||||
{ \
|
||||
BOOL win32_status; \
|
||||
DWORD exitcode; \
|
||||
HANDLE threadrunsemaphore; \
|
||||
HANDLE threadhandle; \
|
||||
threadhandle = thread_ptr -> tx_thread_win32_thread_handle; \
|
||||
threadrunsemaphore = thread_ptr -> tx_thread_win32_thread_run_semaphore; \
|
||||
_tx_thread_interrupt_restore(tx_saved_posture); \
|
||||
do \
|
||||
{ \
|
||||
win32_status = GetExitCodeThread(threadhandle, &exitcode); \
|
||||
if ((win32_status) && (exitcode != STILL_ACTIVE)) \
|
||||
{ \
|
||||
break; \
|
||||
} \
|
||||
ResumeThread(threadhandle); \
|
||||
ReleaseSemaphore(threadrunsemaphore, 1, NULL); \
|
||||
Sleep(1); \
|
||||
} while (1); \
|
||||
CloseHandle(threadhandle); \
|
||||
tx_saved_posture = _tx_thread_interrupt_disable(); \
|
||||
}
|
||||
|
||||
|
||||
/* Define post completion processing for tx_thread_reset, so that the Win32 thread resources are properly removed. */
|
||||
|
||||
#define TX_THREAD_RESET_PORT_COMPLETION(thread_ptr) \
|
||||
{ \
|
||||
BOOL win32_status; \
|
||||
DWORD exitcode; \
|
||||
HANDLE threadrunsemaphore; \
|
||||
HANDLE threadhandle; \
|
||||
threadhandle = thread_ptr -> tx_thread_win32_thread_handle; \
|
||||
threadrunsemaphore = thread_ptr -> tx_thread_win32_thread_run_semaphore; \
|
||||
_tx_thread_interrupt_restore(tx_saved_posture); \
|
||||
do \
|
||||
{ \
|
||||
win32_status = GetExitCodeThread(threadhandle, &exitcode); \
|
||||
if ((win32_status) && (exitcode != STILL_ACTIVE)) \
|
||||
{ \
|
||||
break; \
|
||||
} \
|
||||
ResumeThread(threadhandle); \
|
||||
ReleaseSemaphore(threadrunsemaphore, 1, NULL); \
|
||||
Sleep(1); \
|
||||
} while (1); \
|
||||
CloseHandle(threadhandle); \
|
||||
tx_saved_posture = _tx_thread_interrupt_disable(); \
|
||||
}
|
||||
|
||||
|
||||
/* Define ThreadX interrupt lockout and restore macros for protection on
|
||||
access of critical kernel information. The restore interrupt macro must
|
||||
restore the interrupt posture of the running thread prior to the value
|
||||
present prior to the disable macro. In most cases, the save area macro
|
||||
is used to define a local function save area for the disable and restore
|
||||
macros. */
|
||||
|
||||
UINT _tx_thread_interrupt_disable(void);
|
||||
VOID _tx_thread_interrupt_restore(UINT previous_posture);
|
||||
|
||||
#define TX_INTERRUPT_SAVE_AREA UINT tx_saved_posture;
|
||||
|
||||
#define TX_DISABLE tx_saved_posture = _tx_thread_interrupt_disable();
|
||||
|
||||
#define TX_RESTORE _tx_thread_interrupt_restore(tx_saved_posture);
|
||||
|
||||
|
||||
/* Define the interrupt lockout macros for each ThreadX object. */
|
||||
|
||||
#define TX_BLOCK_POOL_DISABLE TX_DISABLE
|
||||
#define TX_BYTE_POOL_DISABLE TX_DISABLE
|
||||
#define TX_EVENT_FLAGS_GROUP_DISABLE TX_DISABLE
|
||||
#define TX_MUTEX_DISABLE TX_DISABLE
|
||||
#define TX_QUEUE_DISABLE TX_DISABLE
|
||||
#define TX_SEMAPHORE_DISABLE TX_DISABLE
|
||||
|
||||
|
||||
/* Define the version ID of ThreadX. This may be utilized by the application. */
|
||||
|
||||
#ifdef TX_THREAD_INIT
|
||||
CHAR _tx_version_id[] =
|
||||
"Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX Win32/Visual Studio Version 6.1 *";
|
||||
#else
|
||||
extern CHAR _tx_version_id[];
|
||||
#endif
|
||||
|
||||
|
||||
/* Define externals for the Win32 port of ThreadX. */
|
||||
|
||||
extern TX_WIN32_CRITICAL_SECTION _tx_win32_critical_section;
|
||||
extern HANDLE _tx_win32_scheduler_semaphore;
|
||||
extern DWORD _tx_win32_scheduler_id;
|
||||
extern ULONG _tx_win32_global_int_disabled_flag;
|
||||
extern LARGE_INTEGER _tx_win32_time_stamp;
|
||||
extern ULONG _tx_win32_system_error;
|
||||
extern HANDLE _tx_win32_timer_handle;
|
||||
extern DWORD _tx_win32_timer_id;
|
||||
extern LARGE_INTEGER _tx_win32_time_stamp;
|
||||
|
||||
|
||||
#ifndef TX_WIN32_MEMORY_SIZE
|
||||
#define TX_WIN32_MEMORY_SIZE 64000
|
||||
#endif
|
||||
|
||||
#ifndef TX_TIMER_PERIODIC
|
||||
#define TX_TIMER_PERIODIC 18
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
1397
ports/win32/src/gx_win32_display_driver.c
Normal file
1397
ports/win32/src/gx_win32_display_driver.c
Normal file
File diff suppressed because it is too large
Load Diff
164
ports/win32/src/gx_win32_display_driver_1555xrgb.c
Normal file
164
ports/win32/src/gx_win32_display_driver_1555xrgb.c
Normal file
@ -0,0 +1,164 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Win32 Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
#ifdef WIN32
|
||||
#include "tx_api.h"
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_display.h"
|
||||
#include "windows.h"
|
||||
#include "gx_win32_display_driver.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* win32_1555xrgb_bitmap_header_create PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function creates bitmap header for 1555xrgb display driver. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* display Pointer to GX_DISPLAY */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* win32_graphics_driver_setup_1555xrgb */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static void win32_1555xrgb_bitmap_header_create(GX_DISPLAY *display)
|
||||
{
|
||||
DWORD *putmask;
|
||||
|
||||
GX_WIN32_DISPLAY_DRIVER_DATA *instance = (GX_WIN32_DISPLAY_DRIVER_DATA *)display -> gx_display_driver_data;
|
||||
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biWidth = display -> gx_display_width;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biHeight = display -> gx_display_height;
|
||||
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biPlanes = 1;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biBitCount = 16;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biSizeImage = display -> gx_display_width * display -> gx_display_height * 2;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biClrUsed = 65535;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biClrImportant = 65535;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biCompression = BI_BITFIELDS;
|
||||
|
||||
putmask = (DWORD *)&(instance -> win32_driver_bmpinfo.gx_bmp_colors[0]);
|
||||
|
||||
*putmask++ = 0x00007c00;
|
||||
*putmask++ = 0x000003e0;
|
||||
*putmask = 0x0000001f;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* win32_graphics_driver_setup_1555xrgb PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function creates a Windows specific 1555xrgb display driver. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* display Pointer to GX_DISPLAY */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_1555xgb_setup guix display setup funciton. */
|
||||
/* win32_1555xrgb_bitmap_header_create Create bitmap header info */
|
||||
/* gx_win32_get_free_data_instance Get display data instance */
|
||||
/* GX_WIN32_EVENT_THREAD_CREATE Create event thread */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT win32_graphics_driver_setup_1555xrgb(GX_DISPLAY *display)
|
||||
{
|
||||
GX_WIN32_DISPLAY_DRIVER_DATA *data;
|
||||
|
||||
/* Initialize the low-level drawing function pointers.
|
||||
|
||||
For windows, these are always just the generic funcions,
|
||||
but for some hardware, these will be customized,
|
||||
optimized functions specific to that hardware. */
|
||||
|
||||
data = gx_win32_get_free_data_instance();
|
||||
if (!data)
|
||||
{
|
||||
/* We don't have any free display data instance. */
|
||||
return(GX_FAILURE);
|
||||
}
|
||||
|
||||
/* Save off the format display driver.*/
|
||||
data -> win32_driver_type = GX_COLOR_FORMAT_1555XRGB;
|
||||
|
||||
_gx_display_driver_1555xrgb_setup(display, data, gx_win32_display_buffer_toggle);
|
||||
|
||||
/* Create the GUIX / Windows event thread
|
||||
This thread is a substitute for a touch display
|
||||
or keyboard driver thread that would be running
|
||||
on embedded hardware. */
|
||||
GX_WIN32_EVENT_THREAD_CREATE(data, "GUI-WIN32-565rgb");
|
||||
|
||||
win32_1555xrgb_bitmap_header_create(display);
|
||||
|
||||
return(GX_SUCCESS);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
164
ports/win32/src/gx_win32_display_driver_24xrgb.c
Normal file
164
ports/win32/src/gx_win32_display_driver_24xrgb.c
Normal file
@ -0,0 +1,164 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** GUIX Component */
|
||||
/** */
|
||||
/** Win32 Display Management (Display) */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
#ifdef WIN32
|
||||
#include "tx_api.h"
|
||||
#include "gx_api.h"
|
||||
#include "gx_system.h"
|
||||
#include "gx_display.h"
|
||||
#include "windows.h"
|
||||
#include "gx_win32_display_driver.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* win32_24xrgb_bitmap_header_create PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function creates bitmap header for 24xrgb driver. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* display Pointer to GX_DISPLAY */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* win32_graphics_driver_setup_24xrgb */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
static void win32_24xrgb_bitmap_header_create(GX_DISPLAY *display)
|
||||
{
|
||||
GX_WIN32_DISPLAY_DRIVER_DATA *instance;
|
||||
DWORD *putmask;
|
||||
|
||||
instance = (GX_WIN32_DISPLAY_DRIVER_DATA *)display -> gx_display_driver_data;
|
||||
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biWidth = display -> gx_display_width;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biHeight = display -> gx_display_height;
|
||||
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biPlanes = 1;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biBitCount = 32;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biSizeImage = display -> gx_display_width * display -> gx_display_height * 4;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biClrUsed = 16777215;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biClrImportant = 16777215;
|
||||
instance -> win32_driver_bmpinfo.gx_bmp_header.biCompression = BI_BITFIELDS;
|
||||
|
||||
putmask = (DWORD *)&(instance -> win32_driver_bmpinfo.gx_bmp_colors[0]);
|
||||
|
||||
*putmask++ = 0x00ff0000;
|
||||
*putmask++ = 0x0000ff00;
|
||||
*putmask = 0x000000ff;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* win32_graphics_driver_setup_24xrgb PORTABLE C */
|
||||
/* 6.1.3 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Kenneth Maxwell, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function creates a Windows specific 24xrgb display driver. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* display Pointer to GX_DISPLAY */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _gx_display_driver_24xrgb_setup guix display setup funciton. */
|
||||
/* win32_24xrgb_bitmap_header_create Create bitmap header info */
|
||||
/* gx_win32_get_free_data_instance Get display data instance */
|
||||
/* GX_WIN32_EVENT_THREAD_CREATE Create event thread */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *display)
|
||||
{
|
||||
GX_WIN32_DISPLAY_DRIVER_DATA *data;
|
||||
|
||||
/* Initialize the low-level drawing function pointers.
|
||||
For windows, these are always just the generic funcions,
|
||||
but for some hardware, these will be customized,
|
||||
optimized functions specific to that hardware. */
|
||||
data = gx_win32_get_free_data_instance();
|
||||
|
||||
if (!data)
|
||||
{
|
||||
/* We don't have any free display data instance. */
|
||||
return(GX_FAILURE);
|
||||
}
|
||||
|
||||
/* Save off the format of display driver. */
|
||||
data -> win32_driver_type = GX_COLOR_FORMAT_24XRGB;
|
||||
|
||||
_gx_display_driver_24xrgb_setup(display, data, gx_win32_display_buffer_toggle);
|
||||
|
||||
/* Create the GUIX / Windows event thread
|
||||
This thread is a substitute for a touch screen
|
||||
or keyboard driver thread that would be running
|
||||
on embedded hardware. */
|
||||
GX_WIN32_EVENT_THREAD_CREATE(data, "GUI-WIN32-24xrgb");
|
||||
|
||||
/* Create bitmap header for 24xrgb display driver. */
|
||||
win32_24xrgb_bitmap_header_create(display);
|
||||
|
||||
return(GX_SUCCESS);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user