mirror of
https://github.com/azure-rtos/guix.git
synced 2025-01-14 06:43:20 +08:00
Release 6.1.4
This commit is contained in:
parent
6381fa5859
commit
09b3b1509f
@ -162,11 +162,18 @@ target_sources(${PROJECT_NAME}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_pixelmap_blend.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_pixelmap_blend.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_png_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_png_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_setup.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_setup.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_rotated_canvas_blend.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_rotated_jpeg_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_rotated_pixel_blend.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_rotated_png_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_24xrgb_rotated_setup.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_native_color_get.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_native_color_get.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_pixel_blend.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_pixel_blend.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_pixelmap_blend.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_pixelmap_blend.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_pixelmap_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_pixelmap_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_setup.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_setup.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_rotated_pixel_blend.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32argb_rotated_setup.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_block_move.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_block_move.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_canvas_copy.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_canvas_copy.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_glyph_1bit_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_glyph_1bit_draw.c
|
||||||
@ -180,6 +187,19 @@ target_sources(${PROJECT_NAME}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_simple_line_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_simple_line_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_vertical_line_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_vertical_line_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_vertical_pattern_line_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_vertical_pattern_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_block_move.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_canvas_copy.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_glyph_1bit_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_horizontal_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_horizontal_pattern_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_pixel_write.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_pixelmap_blend.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_pixelmap_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_pixelmap_rotate.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_simple_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_vertical_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_32bpp_rotated_vertical_pattern_line_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_332rgb_native_color_get.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_332rgb_native_color_get.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_332rgb_pixel_blend.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_332rgb_pixel_blend.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_332rgb_pixelmap_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_332rgb_pixelmap_draw.c
|
||||||
@ -226,6 +246,7 @@ target_sources(${PROJECT_NAME}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_565rgb_rotated_png_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_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_native_color_get.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bit_palette_rotated_setup.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bit_palette_setup.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
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_block_move.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_canvas_copy.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_canvas_copy.c
|
||||||
@ -245,6 +266,20 @@ target_sources(${PROJECT_NAME}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_simple_line_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_simple_line_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_vertical_line_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_vertical_line_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_vertical_pattern_line_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_vertical_pattern_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_block_move.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_canvas_copy.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_glyph_1bit_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_glyph_3bit_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_glyph_4bit_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_horizontal_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_pixel_write.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_pixelmap_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_pixelmap_rotate.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_simple_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_vertical_line_draw.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_8bpp_rotated_vertical_pattern_line_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_arc_clipping_get.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_arc_clipping_get.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_aliased_arc_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_aliased_arc_draw.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_aliased_circle_draw.c
|
${CMAKE_CURRENT_LIST_DIR}/src/gx_display_driver_generic_aliased_circle_draw.c
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* gx_api.h PORTABLE C */
|
/* gx_api.h PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -53,6 +53,13 @@
|
|||||||
/* declare new APIs, */
|
/* declare new APIs, */
|
||||||
/* defined new status, */
|
/* defined new status, */
|
||||||
/* resulting in version 6.1.3 */
|
/* resulting in version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* change scroll_wheel style */
|
||||||
|
/* flag to status flag, */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STATUS_TRACKING_START to */
|
||||||
|
/* GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
@ -76,7 +83,7 @@ extern "C" {
|
|||||||
#define AZURE_RTOS_GUIX
|
#define AZURE_RTOS_GUIX
|
||||||
#define GUIX_MAJOR_VERSION 6
|
#define GUIX_MAJOR_VERSION 6
|
||||||
#define GUIX_MINOR_VERSION 1
|
#define GUIX_MINOR_VERSION 1
|
||||||
#define GUIX_PATCH_VERSION 3
|
#define GUIX_PATCH_VERSION 4
|
||||||
|
|
||||||
/* The following symbols are defined for backward compatibility reasons.*/
|
/* The following symbols are defined for backward compatibility reasons.*/
|
||||||
#define __PRODUCT_GUIX__
|
#define __PRODUCT_GUIX__
|
||||||
@ -690,7 +697,7 @@ typedef struct GX_STRING_STRUCT
|
|||||||
|
|
||||||
/* Define radial slider status flags */
|
/* Define radial slider status flags */
|
||||||
#define GX_STATUS_ANIMATION_NONE 0x00010000UL
|
#define GX_STATUS_ANIMATION_NONE 0x00010000UL
|
||||||
#define GX_STATUS_TRACKING_START 0x00020000UL
|
#define GX_STATUS_TRACKING_PEN 0x00020000UL
|
||||||
|
|
||||||
#define GX_STATUS_MODAL 0x00100000UL
|
#define GX_STATUS_MODAL 0x00100000UL
|
||||||
|
|
||||||
@ -813,10 +820,6 @@ typedef struct GX_STRING_STRUCT
|
|||||||
#define GX_SCROLLBAR_VERTICAL 0x01000000UL
|
#define GX_SCROLLBAR_VERTICAL 0x01000000UL
|
||||||
#define GX_SCROLLBAR_HORIZONTAL 0x02000000UL
|
#define GX_SCROLLBAR_HORIZONTAL 0x02000000UL
|
||||||
|
|
||||||
/* Define Animation Styles. */
|
|
||||||
|
|
||||||
/* Define generic scroll wheel styles*/
|
|
||||||
#define GX_STYLE_SCROLL_WHEEL_DRAG 0x00000200UL
|
|
||||||
|
|
||||||
/* Define text scroll wheel styles*/
|
/* Define text scroll wheel styles*/
|
||||||
#define GX_STYLE_TEXT_SCROLL_WHEEL_ROUND 0x00000100UL
|
#define GX_STYLE_TEXT_SCROLL_WHEEL_ROUND 0x00000100UL
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
/* COMPONENT DEFINITION RELEASE */
|
/* COMPONENT DEFINITION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* gx_display.h PORTABLE C */
|
/* gx_display.h PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -48,6 +48,10 @@
|
|||||||
/* added rotated display */
|
/* added rotated display */
|
||||||
/* driver declarations, */
|
/* driver declarations, */
|
||||||
/* resulting in version 6.1.3 */
|
/* resulting in version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* added 8bpp/32bpp rotated */
|
||||||
|
/* display driver declarations,*/
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
@ -208,6 +212,21 @@ VOID _gx_display_driver_8bpp_glyph_1bit_draw(GX_DRAW_CONTEXT *context, GX_RE
|
|||||||
VOID _gx_display_driver_8bpp_glyph_3bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
VOID _gx_display_driver_8bpp_glyph_3bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
||||||
VOID _gx_display_driver_8bpp_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
VOID _gx_display_driver_8bpp_glyph_4bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
||||||
|
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
|
||||||
|
VOID _gx_display_driver_8bpp_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_8bpp_rotated_glyph_3bit_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph);
|
||||||
|
VOID _gx_display_driver_8bpp_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_8bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, INT angle, INT cx, INT cy);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
|
||||||
|
|
||||||
VOID _gx_display_driver_565rgb_canvas_blend(GX_CANVAS *source, GX_CANVAS *dest);
|
VOID _gx_display_driver_565rgb_canvas_blend(GX_CANVAS *source, GX_CANVAS *dest);
|
||||||
VOID _gx_display_driver_16bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
|
VOID _gx_display_driver_16bpp_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
|
||||||
VOID _gx_display_driver_16bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
|
VOID _gx_display_driver_16bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
|
||||||
@ -263,9 +282,16 @@ VOID _gx_display_driver_24xrgb_pixel_blend(GX_DRAW_CONTEXT *context, INT xco
|
|||||||
VOID _gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
VOID _gx_display_driver_24xrgb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
||||||
VOID _gx_display_driver_24xrgb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
VOID _gx_display_driver_24xrgb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
||||||
|
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_canvas_blend(GX_CANVAS *source, GX_CANVAS *dest);
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
|
||||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
|
UINT _gx_display_driver_24xrgb_YCbCr2RGB(INT y, INT cb, INT cr);
|
||||||
VOID _gx_display_driver_24xrgb_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
VOID _gx_display_driver_24xrgb_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
||||||
VOID _gx_display_driver_24xrgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
VOID _gx_display_driver_24xrgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_jpeg_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap);
|
||||||
#endif
|
#endif
|
||||||
GX_COLOR _gx_display_driver_24xrgb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
|
GX_COLOR _gx_display_driver_24xrgb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
|
||||||
|
|
||||||
@ -279,13 +305,30 @@ VOID _gx_display_driver_32bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *co
|
|||||||
VOID _gx_display_driver_32bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
|
VOID _gx_display_driver_32bpp_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
|
||||||
USHORT _gx_display_driver_32bpp_row_pitch_get(USHORT width);
|
USHORT _gx_display_driver_32bpp_row_pitch_get(USHORT width);
|
||||||
VOID _gx_display_driver_32bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
|
VOID _gx_display_driver_32bpp_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
|
||||||
|
VOID _gx_display_driver_32bpp_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_32bpp_rotated_canvas_copy(GX_CANVAS *source, GX_CANVAS *dest);
|
||||||
|
VOID _gx_display_driver_32bpp_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_32bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR color);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_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_32bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_block_move(GX_DRAW_CONTEXT *context, GX_RECTANGLE *src, INT xshift, INT yshift);
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_simple_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, INT xend, INT yend);
|
||||||
|
|
||||||
VOID _gx_display_driver_32argb_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
|
VOID _gx_display_driver_32argb_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
VOID _gx_display_driver_32argb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
VOID _gx_display_driver_32argb_pixelmap_blend(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp, GX_UBYTE alpha);
|
||||||
VOID _gx_display_driver_32argb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
VOID _gx_display_driver_32argb_pixelmap_draw(GX_DRAW_CONTEXT *context, INT xstart, INT ystart, GX_PIXELMAP *pmp);
|
||||||
GX_COLOR _gx_display_driver_32argb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
|
GX_COLOR _gx_display_driver_32argb_native_color_get(GX_DISPLAY *, GX_COLOR rawcolor);
|
||||||
VOID _gx_display_driver_32bpp_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_32argb_rotated_pixel_blend(GX_DRAW_CONTEXT *context, INT xcoord, INT ycoord, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
VOID _gx_display_driver_4444argb_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite);
|
VOID _gx_display_driver_4444argb_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite);
|
||||||
VOID _gx_display_driver_4444argb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
VOID _gx_display_driver_4444argb_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
VOID _gx_display_driver_4444argb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
|
VOID _gx_display_driver_4444argb_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, GX_FILL_PIXELMAP_INFO *info);
|
||||||
@ -361,9 +404,18 @@ VOID _gx_display_driver_32argb_setup(GX_DISPLAY *display, VOID *aux_data,
|
|||||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
GX_RECTANGLE *dirty_area));
|
GX_RECTANGLE *dirty_area));
|
||||||
|
|
||||||
|
VOID _gx_display_driver_32argb_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_setup(GX_DISPLAY *display, VOID *aux_data,
|
VOID _gx_display_driver_24xrgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
GX_RECTANGLE *dirty_area));
|
GX_RECTANGLE *dirty_area));
|
||||||
|
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
|
GX_RECTANGLE *dirty_area));
|
||||||
|
|
||||||
VOID _gx_display_driver_4444argb_setup(GX_DISPLAY *display, VOID *aux_data,
|
VOID _gx_display_driver_4444argb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
GX_RECTANGLE *dirty_area));
|
GX_RECTANGLE *dirty_area));
|
||||||
@ -380,6 +432,10 @@ VOID _gx_display_driver_8bit_palette_setup(GX_DISPLAY *display, VOID *aux_data,
|
|||||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
GX_RECTANGLE *dirty_area));
|
GX_RECTANGLE *dirty_area));
|
||||||
|
|
||||||
|
VOID _gx_display_driver_8bit_palette_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
|
GX_RECTANGLE *dirty_area));
|
||||||
|
|
||||||
VOID _gx_display_driver_332rgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
VOID _gx_display_driver_332rgb_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
GX_RECTANGLE *dirty_area));
|
GX_RECTANGLE *dirty_area));
|
||||||
@ -402,7 +458,6 @@ VOID *_win32_canvas_memory_prepare(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
|
|||||||
#define GREENVAL_16BPP(_c) (GX_UBYTE)(((_c) >> 5) & 0x3f)
|
#define GREENVAL_16BPP(_c) (GX_UBYTE)(((_c) >> 5) & 0x3f)
|
||||||
#define BLUEVAL_16BPP(_c) (GX_UBYTE)(((_c)) & 0x1f)
|
#define BLUEVAL_16BPP(_c) (GX_UBYTE)(((_c)) & 0x1f)
|
||||||
|
|
||||||
|
|
||||||
/* Define macros for assembling a 16-bit r:g:b value from 3 components. */
|
/* Define macros for assembling a 16-bit r:g:b value from 3 components. */
|
||||||
|
|
||||||
#define ASSEMBLECOLOR_16BPP(_r, _g, _b) \
|
#define ASSEMBLECOLOR_16BPP(_r, _g, _b) \
|
||||||
@ -422,27 +477,41 @@ VOID *_win32_canvas_memory_prepare(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
|
|||||||
(_b))
|
(_b))
|
||||||
|
|
||||||
|
|
||||||
|
#define ALPHAVAL_32BPP(_c) (GX_UBYTE)((_c) >> 24)
|
||||||
#define REDVAL_32BPP(_c) (GX_UBYTE)((_c) >> 16)
|
#define REDVAL_32BPP(_c) (GX_UBYTE)((_c) >> 16)
|
||||||
#define GREENVAL_32BPP(_c) (GX_UBYTE)((_c) >> 8)
|
#define GREENVAL_32BPP(_c) (GX_UBYTE)((_c) >> 8)
|
||||||
#define BLUEVAL_32BPP(_c) (GX_UBYTE)(_c)
|
#define BLUEVAL_32BPP(_c) (GX_UBYTE)(_c)
|
||||||
|
|
||||||
|
|
||||||
/* Define macros for assembling a 32-bit r:g:b value from 3 components. */
|
/* Define macros for assembling a 32-bit r:g:b value from 3 components. */
|
||||||
|
|
||||||
#define ASSEMBLECOLOR_32BPP(_r, _g, _b) \
|
#define ASSEMBLECOLOR_32BPP(_r, _g, _b) \
|
||||||
(((_r) << 16) | \
|
(((_r) << 16) | \
|
||||||
((_g) << 8) | \
|
((_g) << 8) | \
|
||||||
(_b))
|
(_b))
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#define ASSEMBLECOLOR_32ARGB(_a, _r, _g, _b) \
|
||||||
|
(((_a) << 24) | \
|
||||||
|
((_r) << 16) | \
|
||||||
|
((_g) << 8) | \
|
||||||
|
(_b))
|
||||||
|
|
||||||
#define GX_SET_BLEND_FUNCTION(blend_func, color_format) \
|
#define GX_SET_BLEND_FUNCTION(blend_func, color_format) \
|
||||||
switch (color_format) \
|
switch (color_format) \
|
||||||
{ \
|
{ \
|
||||||
case GX_COLOR_FORMAT_565RGB: \
|
case GX_COLOR_FORMAT_565RGB: \
|
||||||
blend_func = _gx_display_driver_565rgb_pixel_blend; \
|
blend_func = _gx_display_driver_565rgb_pixel_blend; \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
case GX_COLOR_FORMAT_24XRGB: \
|
||||||
|
blend_func = _gx_display_driver_24xrgb_pixel_blend; \
|
||||||
|
break; \
|
||||||
|
case GX_COLOR_FORMAT_32ARGB: \
|
||||||
|
blend_func = _gx_display_driver_32argb_pixel_blend; \
|
||||||
|
break; \
|
||||||
|
default: \
|
||||||
/* Not supported. */ \
|
/* Not supported. */ \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_display_driver_24xrgb_YCbCr2RGB PORTABLE C */
|
/* _gx_display_driver_24xrgb_YCbCr2RGB PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -69,10 +69,13 @@
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* made function public, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
static UINT _gx_display_driver_24xrgb_YCbCr2RGB(INT y, INT cb, INT cr)
|
UINT _gx_display_driver_24xrgb_YCbCr2RGB(INT y, INT cb, INT cr)
|
||||||
{
|
{
|
||||||
INT red;
|
INT red;
|
||||||
INT green;
|
INT green;
|
||||||
|
167
common/src/gx_display_driver_24xrgb_rotated_canvas_blend.c
Normal file
167
common/src/gx_display_driver_24xrgb_rotated_canvas_blend.c
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_rotated_canvas_blend PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Rotated canvas blend function for 24xrgb 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_24BPP Extrace Red from canvas */
|
||||||
|
/* GREENVAL_24BPP Extrace Green from canvas */
|
||||||
|
/* BLUEVAL_24BPP Extrace Blue from canvas */
|
||||||
|
/* ASSEMBLECOLOR_24BPP Compose the RGB color */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_canvas_blend(GX_CANVAS *canvas, GX_CANVAS *composite)
|
||||||
|
{
|
||||||
|
GX_RECTANGLE dirty;
|
||||||
|
GX_RECTANGLE overlap;
|
||||||
|
ULONG *read;
|
||||||
|
ULONG *read_start;
|
||||||
|
ULONG *write;
|
||||||
|
ULONG *write_start;
|
||||||
|
ULONG fcolor;
|
||||||
|
GX_UBYTE fred, fgreen, fblue;
|
||||||
|
GX_UBYTE bred, bgreen, bblue;
|
||||||
|
GX_UBYTE alpha, balpha;
|
||||||
|
|
||||||
|
ULONG 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 = (ULONG *)canvas -> gx_canvas_memory;
|
||||||
|
write_start = (ULONG *)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_24BPP(fcolor);
|
||||||
|
fgreen = GREENVAL_24BPP(fcolor);
|
||||||
|
fblue = BLUEVAL_24BPP(fcolor);
|
||||||
|
|
||||||
|
/* Read background color. */
|
||||||
|
bcolor = *write;
|
||||||
|
|
||||||
|
/* Split background color into red, green, and blue components. */
|
||||||
|
bred = REDVAL_24BPP(bcolor);
|
||||||
|
bgreen = GREENVAL_24BPP(bcolor);
|
||||||
|
bblue = BLUEVAL_24BPP(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++ = ASSEMBLECOLOR_32ARGB((ULONG)0xff, (ULONG)fred, (ULONG)fgreen, (ULONG)fblue);
|
||||||
|
}
|
||||||
|
|
||||||
|
write_start += composite -> gx_canvas_y_resolution;
|
||||||
|
read_start += canvas -> gx_canvas_y_resolution;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
191
common/src/gx_display_driver_24xrgb_rotated_jpeg_draw.c
Normal file
191
common/src/gx_display_driver_24xrgb_rotated_jpeg_draw.c
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_rotated_mcu_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function to draw one MCU of decoded JPEG data to */
|
||||||
|
/* rotated canvas. */
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_YCbCr2RGB */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_24xrgb_rotated_jpeg_decode */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
|
static UINT _gx_display_driver_24xrgb_rotated_mcu_draw(GX_JPEG_INFO *jpeg_info, INT xpos, INT ypos)
|
||||||
|
{
|
||||||
|
GX_COLOR *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 = context -> gx_draw_context_memory;
|
||||||
|
put += rotated_ypos * context -> gx_draw_context_pitch;
|
||||||
|
put += rotated_xpos;
|
||||||
|
|
||||||
|
|
||||||
|
for (x = 0; x < 8 * w; x++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < 8 * h; 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_24xrgb_YCbCr2RGB(Y, Cb, Cr) | 0xff000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
put -= context -> gx_draw_context_pitch * sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GX_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_dislay_driver_24xrgb_rotated_jpeg_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 24xrgb rotated 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_24xrgb_rotated_mcu_draw] */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* Application Code */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
|
VOID _gx_display_driver_24xrgb_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_24xrgb_rotated_mcu_draw);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
131
common/src/gx_display_driver_24xrgb_rotated_pixel_blend.c
Normal file
131
common/src/gx_display_driver_24xrgb_rotated_pixel_blend.c
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_rotated_pixel_blend PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Rotated pixel blend function for 24xrgb 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_24BPP Extract the red component */
|
||||||
|
/* GREENVAL_24BPP Extract the green component */
|
||||||
|
/* BLUEVAL_24BPP Extract the blue component */
|
||||||
|
/* ASSEMBLECOLOR_24BPP Assemble color components */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_24xrgb_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;
|
||||||
|
ULONG bcolor;
|
||||||
|
ULONG *put;
|
||||||
|
|
||||||
|
|
||||||
|
/* Is the pixel non-transparent? */
|
||||||
|
if (alpha > 0)
|
||||||
|
{
|
||||||
|
/* Calculate address of pixel. */
|
||||||
|
put = (ULONG *)context -> gx_draw_context_memory;
|
||||||
|
|
||||||
|
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 = (ULONG)(fcolor | 0xff000000);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Split foreground into red, green, and blue components. */
|
||||||
|
fred = REDVAL_24BPP(fcolor);
|
||||||
|
fgreen = GREENVAL_24BPP(fcolor);
|
||||||
|
fblue = BLUEVAL_24BPP(fcolor);
|
||||||
|
|
||||||
|
/* Read background color. */
|
||||||
|
bcolor = *put;
|
||||||
|
|
||||||
|
/* Split background color into red, green, and blue components. */
|
||||||
|
bred = REDVAL_24BPP(bcolor);
|
||||||
|
bgreen = GREENVAL_24BPP(bcolor);
|
||||||
|
bblue = BLUEVAL_24BPP(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 32-bit color and write it out. */
|
||||||
|
*put = (ULONG)(ASSEMBLECOLOR_32ARGB(0xff, fred, fgreen, fblue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
107
common/src/gx_display_driver_24xrgb_rotated_png_draw.c
Normal file
107
common/src/gx_display_driver_24xrgb_rotated_png_draw.c
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_rotated_png_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Rotated 24xrgb format screen 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_24xrgb_rotated_pixelmap_draw */
|
||||||
|
/* _gx_system_memory_free */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* Application Code */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
|
VOID _gx_display_driver_24xrgb_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_24XRGB, mode);
|
||||||
|
|
||||||
|
if (_gx_image_reader_start(&image_reader, &pic_outmap) == GX_SUCCESS)
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_pixelmap_draw(context, xpos, ypos, &pic_outmap);
|
||||||
|
|
||||||
|
_gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
129
common/src/gx_display_driver_24xrgb_rotated_setup.c
Normal file
129
common/src/gx_display_driver_24xrgb_rotated_setup.c
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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 "gx_api.h"
|
||||||
|
#include "gx_display.h"
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_24xrgb_rotated_setup PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32-bit XRGB color format display driver setup */
|
||||||
|
/* routine. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_24xrgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
|
GX_RECTANGLE *dirty_area))
|
||||||
|
{
|
||||||
|
_gx_display_driver_24xrgb_setup(display, aux_data, toggle_function);
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW;
|
||||||
|
display -> gx_display_driver_canvas_copy = _gx_display_driver_32bpp_rotated_canvas_copy;
|
||||||
|
display -> gx_display_driver_simple_line_draw = _gx_display_driver_32bpp_rotated_simple_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_line_draw = _gx_display_driver_32bpp_rotated_horizontal_line_draw;
|
||||||
|
display -> gx_display_driver_vertical_line_draw = _gx_display_driver_32bpp_rotated_vertical_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_pattern_line_draw = _gx_display_driver_32bpp_rotated_horizontal_pattern_line_draw;
|
||||||
|
display -> gx_display_driver_vertical_pattern_line_draw = _gx_display_driver_32bpp_rotated_vertical_pattern_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw;
|
||||||
|
display -> gx_display_driver_pixel_write = _gx_display_driver_32bpp_rotated_pixel_write;
|
||||||
|
display -> gx_display_driver_block_move = _gx_display_driver_32bpp_rotated_block_move;
|
||||||
|
|
||||||
|
display -> gx_display_driver_pixelmap_draw = _gx_display_driver_32bpp_rotated_pixelmap_draw;
|
||||||
|
display -> gx_display_driver_pixelmap_rotate = _gx_display_driver_32bpp_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_palette_set = GX_NULL;
|
||||||
|
display -> gx_display_driver_buffer_toggle = toggle_function;
|
||||||
|
|
||||||
|
display -> gx_display_driver_canvas_blend = _gx_display_driver_24xrgb_rotated_canvas_blend;
|
||||||
|
display -> gx_display_driver_pixel_blend = _gx_display_driver_24xrgb_rotated_pixel_blend;
|
||||||
|
display -> gx_display_driver_pixelmap_blend = _gx_display_driver_32bpp_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_32bpp_rotated_glyph_1bit_draw;
|
||||||
|
|
||||||
|
display -> gx_display_driver_8bit_compressed_glyph_draw = GX_NULL;
|
||||||
|
display -> gx_display_driver_4bit_compressed_glyph_draw = GX_NULL;
|
||||||
|
display -> gx_display_driver_1bit_compressed_glyph_draw = GX_NULL;
|
||||||
|
|
||||||
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
|
display -> gx_display_driver_jpeg_draw = _gx_display_driver_24xrgb_rotated_jpeg_draw;
|
||||||
|
display -> gx_display_driver_png_draw = _gx_display_driver_24xrgb_rotated_png_draw;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
135
common/src/gx_display_driver_32argb_rotated_pixel_blend.c
Normal file
135
common/src/gx_display_driver_32argb_rotated_pixel_blend.c
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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 "gx_api.h"
|
||||||
|
#include "gx_display.h"
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32argb_rotated_pixel_blend PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Rotated Pixel blend function for 32argb color format. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* context Drawing context */
|
||||||
|
/* x X coordinate */
|
||||||
|
/* y Y coordinate */
|
||||||
|
/* color Color of line to write */
|
||||||
|
/* alpha blending value 0 to 255 */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32argb_rotated_pixel_blend(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
GX_UBYTE falpha, fred, fgreen, fblue;
|
||||||
|
GX_UBYTE balpha, bred, bgreen, bblue;
|
||||||
|
GX_UBYTE oalpha;
|
||||||
|
ULONG bcolor;
|
||||||
|
ULONG *put;
|
||||||
|
INT combined_alpha;
|
||||||
|
|
||||||
|
|
||||||
|
falpha = ALPHAVAL_32BPP(fcolor);
|
||||||
|
falpha = (GX_UBYTE)((falpha * alpha) / 255);
|
||||||
|
|
||||||
|
/* Is the pixel non-transparent? */
|
||||||
|
if (falpha > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Calculate address of pixel. */
|
||||||
|
put = (ULONG *)context -> gx_draw_context_memory;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(x, y);
|
||||||
|
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
y = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - y - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - x - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
put += context -> gx_draw_context_pitch * y;
|
||||||
|
put += x;
|
||||||
|
|
||||||
|
/* No need to blend if alpha value is 255. */
|
||||||
|
if (falpha == 255)
|
||||||
|
{
|
||||||
|
*put = (ULONG)fcolor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Split foreground into alpha, red, green, and blue components. */
|
||||||
|
fred = REDVAL_32BPP(fcolor);
|
||||||
|
fgreen = GREENVAL_32BPP(fcolor);
|
||||||
|
fblue = BLUEVAL_32BPP(fcolor);
|
||||||
|
|
||||||
|
/* Read background color. */
|
||||||
|
bcolor = *put;
|
||||||
|
|
||||||
|
/* Split background color into red, green, and blue components. */
|
||||||
|
balpha = ALPHAVAL_32BPP(bcolor);
|
||||||
|
bred = REDVAL_32BPP(bcolor);
|
||||||
|
bgreen = GREENVAL_32BPP(bcolor);
|
||||||
|
bblue = BLUEVAL_32BPP(bcolor);
|
||||||
|
|
||||||
|
/* Background alpha is inverse of foreground alpha. */
|
||||||
|
combined_alpha = (falpha * balpha) / 0xff;
|
||||||
|
|
||||||
|
/* Blend foreground and background, each color channel. */
|
||||||
|
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_32ARGB(oalpha, fred, fgreen, fblue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
121
common/src/gx_display_driver_32argb_rotated_setup.c
Normal file
121
common/src/gx_display_driver_32argb_rotated_setup.c
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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 "gx_api.h"
|
||||||
|
#include "gx_display.h"
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32argb_rotated_setup PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32-bit ARGB color format display driver setup */
|
||||||
|
/* routine. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32argb_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
|
GX_RECTANGLE *dirty_area))
|
||||||
|
{
|
||||||
|
_gx_display_driver_32argb_setup(display, aux_data, toggle_function);
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW;
|
||||||
|
display -> gx_display_driver_canvas_copy = _gx_display_driver_32bpp_rotated_canvas_copy;
|
||||||
|
display -> gx_display_driver_simple_line_draw = _gx_display_driver_32bpp_rotated_simple_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_line_draw = _gx_display_driver_32bpp_rotated_horizontal_line_draw;
|
||||||
|
display -> gx_display_driver_vertical_line_draw = _gx_display_driver_32bpp_rotated_vertical_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_pattern_line_draw = _gx_display_driver_32bpp_rotated_horizontal_pattern_line_draw;
|
||||||
|
display -> gx_display_driver_vertical_pattern_line_draw = _gx_display_driver_32bpp_rotated_vertical_pattern_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw;
|
||||||
|
display -> gx_display_driver_pixel_write = _gx_display_driver_32bpp_rotated_pixel_write;
|
||||||
|
display -> gx_display_driver_block_move = _gx_display_driver_32bpp_rotated_block_move;
|
||||||
|
display -> gx_display_driver_pixelmap_draw = _gx_display_driver_32bpp_rotated_pixelmap_draw;
|
||||||
|
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;
|
||||||
|
display -> gx_display_driver_anti_aliased_wide_ellipse_draw = _gx_display_driver_generic_aliased_wide_ellipse_draw;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
display -> gx_display_driver_canvas_blend = _gx_display_driver_24xrgb_rotated_canvas_blend;
|
||||||
|
display -> gx_display_driver_pixel_blend = _gx_display_driver_32argb_rotated_pixel_blend;
|
||||||
|
display -> gx_display_driver_pixelmap_blend = _gx_display_driver_32bpp_rotated_pixelmap_blend;
|
||||||
|
display -> gx_display_driver_pixelmap_rotate = _gx_display_driver_32bpp_rotated_pixelmap_rotate;
|
||||||
|
|
||||||
|
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_32bpp_rotated_glyph_1bit_draw;
|
||||||
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
|
||||||
|
display -> gx_display_driver_jpeg_draw = _gx_display_driver_24xrgb_rotated_jpeg_draw;
|
||||||
|
display -> gx_display_driver_png_draw = _gx_display_driver_24xrgb_rotated_png_draw;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
210
common/src/gx_display_driver_32bpp_rotated_block_move.c
Normal file
210
common/src/gx_display_driver_32bpp_rotated_block_move.c
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_rotated_block_move PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32bpp color format display driver 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 memory content */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_block_move(GX_DRAW_CONTEXT *context,
|
||||||
|
GX_RECTANGLE *block, INT xshift, INT yshift)
|
||||||
|
{
|
||||||
|
GX_COLOR *pGet;
|
||||||
|
GX_COLOR *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 = context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left + xshift;
|
||||||
|
|
||||||
|
pGet = 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(GX_COLOR);
|
||||||
|
|
||||||
|
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 = context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left;
|
||||||
|
|
||||||
|
pGet = 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(GX_COLOR);
|
||||||
|
|
||||||
|
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(GX_COLOR);
|
||||||
|
|
||||||
|
if (yshift > 0)
|
||||||
|
{
|
||||||
|
/* Have to copy from top to bottom. */
|
||||||
|
pPut = context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_bottom * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left;
|
||||||
|
|
||||||
|
pGet = 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 = context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left;
|
||||||
|
|
||||||
|
pGet = 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
129
common/src/gx_display_driver_32bpp_rotated_canvas_copy.c
Normal file
129
common/src/gx_display_driver_32bpp_rotated_canvas_copy.c
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_rotated_canvas_copy PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32bpp 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_canvas_copy(GX_CANVAS *canvas, GX_CANVAS *composite)
|
||||||
|
{
|
||||||
|
GX_RECTANGLE dirty;
|
||||||
|
GX_RECTANGLE overlap;
|
||||||
|
ULONG *read;
|
||||||
|
ULONG *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 - 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))
|
||||||
|
{
|
||||||
|
width = overlap.gx_rectangle_bottom - overlap.gx_rectangle_top + 1;
|
||||||
|
read = (ULONG *)canvas -> gx_canvas_memory;
|
||||||
|
write = (ULONG *)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 * 4); /* Use case of memcpy is verified. */
|
||||||
|
|
||||||
|
write += composite -> gx_canvas_y_resolution;
|
||||||
|
read += canvas -> gx_canvas_y_resolution;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
313
common/src/gx_display_driver_32bpp_rotated_glyph_1bit_draw.c
Normal file
313
common/src/gx_display_driver_32bpp_rotated_glyph_1bit_draw.c
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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) \
|
||||||
|
{ \
|
||||||
|
_gx_display_driver_24xrgb_pixel_blend(context, xval, yval, text_color, brush_alpha); \
|
||||||
|
} \
|
||||||
|
xval++; \
|
||||||
|
mask = mask >> 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_glyph_1bit_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This functions draw monochrome font on 32bpp rotated 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_24xrgb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_glyph_1bit_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 pixel_per_row;
|
||||||
|
UINT pixel_in_first_byte;
|
||||||
|
UINT pixel_in_last_byte = 0;
|
||||||
|
GX_COLOR text_color;
|
||||||
|
UINT y_height;
|
||||||
|
GX_UBYTE alpha;
|
||||||
|
UINT glyph_width;
|
||||||
|
UINT *put;
|
||||||
|
UINT num_bytes;
|
||||||
|
UINT num_bits;
|
||||||
|
UINT *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 * context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
brush_alpha = context -> gx_draw_context_brush.gx_brush_alpha;
|
||||||
|
if (brush_alpha == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context->gx_draw_context_display->gx_display_color_format);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
text_color = 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)(((UINT)rotated_map_offset_x + 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 = 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 = 8 - (UINT)(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 = glyph_row + ((INT)glyph_width * (INT)rotated_map_offset_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
glyph_row += (rotated_map_offset_x >> 3);
|
||||||
|
|
||||||
|
#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
|
||||||
|
line_start = (UINT *)context -> gx_draw_context_memory;
|
||||||
|
line_start += context -> gx_draw_context_pitch * (rotated_draw_top);
|
||||||
|
line_start += rotated_draw_left;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,129 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_rotated_horizontal_line_draw */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 32bpp color format 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 */
|
||||||
|
/* Basic horizontal line alpha */
|
||||||
|
/* draw function */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
|
||||||
|
{
|
||||||
|
INT row;
|
||||||
|
INT column;
|
||||||
|
ULONG *put;
|
||||||
|
ULONG *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 = (ULONG *)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 1-pixel vertical lines to fill width. */
|
||||||
|
for (row = 0; row < width; row++)
|
||||||
|
{
|
||||||
|
*put++ = (ULONG)color;
|
||||||
|
}
|
||||||
|
|
||||||
|
rowstart -= context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,132 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_roizontal_horizontal_pattern_line_draw */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 32bpp color format 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos)
|
||||||
|
{
|
||||||
|
INT column;
|
||||||
|
ULONG *put;
|
||||||
|
ULONG *rowstart;
|
||||||
|
ULONG pattern;
|
||||||
|
ULONG mask;
|
||||||
|
ULONG on_color;
|
||||||
|
ULONG off_color;
|
||||||
|
INT len = xend - xstart + 1;
|
||||||
|
|
||||||
|
/* Pick up start address of canvas memory. */
|
||||||
|
rowstart = (ULONG *)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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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 = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||||
|
|
||||||
|
put = rowstart;
|
||||||
|
|
||||||
|
/* Draw one line, left to right. */
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
mask = 0x80000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save current masks value back to brush. */
|
||||||
|
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
93
common/src/gx_display_driver_32bpp_rotated_pixel_write.c
Normal file
93
common/src/gx_display_driver_32bpp_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_32bpp_rotated_pixel_write PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32bpp 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color)
|
||||||
|
{
|
||||||
|
ULONG *put = (ULONG *)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 = (ULONG)color;
|
||||||
|
}
|
||||||
|
|
863
common/src/gx_display_driver_32bpp_rotated_pixelmap_blend.c
Normal file
863
common/src/gx_display_driver_32bpp_rotated_pixelmap_blend.c
Normal file
@ -0,0 +1,863 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_rotated_pixelmap_raw_blend */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles blending of rotated */
|
||||||
|
/* uncompressed pixlemap data 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_24xrgb_pixel_blend */
|
||||||
|
/* _gx_display_driver_32argb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
INT yval;
|
||||||
|
INT xval;
|
||||||
|
ULONG *get;
|
||||||
|
ULONG *getrow;
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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_COLOR *)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++)
|
||||||
|
{
|
||||||
|
blend_func(context, xval, yval, (*get++), alpha);
|
||||||
|
}
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_alpha_blend */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles blending of rotated */
|
||||||
|
/* uncompressed pixlemap data 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_24xrgb_pixel_blend */
|
||||||
|
/* _gx_display_driver_32argb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
int xval;
|
||||||
|
int yval;
|
||||||
|
ULONG *get;
|
||||||
|
ULONG *getrow;
|
||||||
|
UCHAR alpha_value;
|
||||||
|
ULONG combined_alpha;
|
||||||
|
ULONG color;
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
xval = clip -> gx_rectangle_left;
|
||||||
|
yval = clip -> gx_rectangle_top;
|
||||||
|
|
||||||
|
getrow = (GX_COLOR *)(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++)
|
||||||
|
{
|
||||||
|
color = (*get);
|
||||||
|
alpha_value = ALPHAVAL_32BPP(color);
|
||||||
|
|
||||||
|
if (alpha_value)
|
||||||
|
{
|
||||||
|
combined_alpha = alpha_value;
|
||||||
|
combined_alpha *= alpha;
|
||||||
|
combined_alpha /= 255;
|
||||||
|
|
||||||
|
if (combined_alpha)
|
||||||
|
{
|
||||||
|
color |= 0xff000000;
|
||||||
|
blend_func(context, xval, yval, color, (GX_UBYTE)combined_alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_palette_pixelmap_blend */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of rotated */
|
||||||
|
/* uncompressed palette pixlemap data without transparent. */
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_pixel_blend */
|
||||||
|
/* _gx_display_driver_32argb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_palette_pixelmap_blend(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT yval;
|
||||||
|
GX_UBYTE *getrow;
|
||||||
|
GX_UBYTE *get;
|
||||||
|
GX_COLOR *palette;
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
blend_func(context, xval, yval, palette[*get++], alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_palette_pixelmap_transparent_blend */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of rotated */
|
||||||
|
/* uncompressed palette pixlemap data with transparent. */
|
||||||
|
/* */
|
||||||
|
/* 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_24xrgb_pixel_blend */
|
||||||
|
/* _gx_display_driver_32argb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_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_UBYTE *get;
|
||||||
|
GX_COLOR *palette;
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
blend_func(context, xval, yval, palette[*get], alpha);
|
||||||
|
}
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_4444argb_pixelmap_alpha_blend */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of rotated */
|
||||||
|
/* uncompressed 4444argb format pixlemap data 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_24xrgb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_4444argb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT yval;
|
||||||
|
USHORT *getrow;
|
||||||
|
GX_CONST USHORT *get;
|
||||||
|
UCHAR falpha;
|
||||||
|
GX_UBYTE combined_alpha;
|
||||||
|
ULONG pixel;
|
||||||
|
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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. */
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Pick alpha value from 4444argb color. */
|
||||||
|
falpha = (UCHAR)(((*get) & 0xf000) >> 8);
|
||||||
|
|
||||||
|
if (falpha)
|
||||||
|
{
|
||||||
|
/* Extend alpha value to improve accuracy. */
|
||||||
|
falpha = (GX_UBYTE)(falpha | (falpha >> 4));
|
||||||
|
|
||||||
|
/* Convert 4444argb color to 24xrgb color. */
|
||||||
|
pixel = (GX_COLOR)((((*get) & 0x0f00) << 12) | (((*get) & 0x00f0) << 8) | (((*get) & 0x000f) << 4));
|
||||||
|
pixel |= 0xff000000;
|
||||||
|
|
||||||
|
/* Calulate combined alpha. */
|
||||||
|
combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
|
||||||
|
|
||||||
|
/* Blend color to background. */
|
||||||
|
blend_func(context, xval, yval, pixel, combined_alpha);
|
||||||
|
}
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_565rgb_pixelmap_alpha_blend */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of rotated */
|
||||||
|
/* uncompressed 565rgb format pixelmap data 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_24xrgb_pixel_blend */
|
||||||
|
/* _gx_display_driver_32argb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_565rgb_pixelmap_alpha_blend(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
INT skipcount;
|
||||||
|
INT xval;
|
||||||
|
INT yval;
|
||||||
|
GX_CONST GX_UBYTE *getalpha;
|
||||||
|
GX_CONST USHORT *get;
|
||||||
|
USHORT *getrow;
|
||||||
|
GX_UBYTE *getrowalpha;
|
||||||
|
GX_COLOR pixel;
|
||||||
|
GX_UBYTE falpha;
|
||||||
|
GX_UBYTE combined_alpha;
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
falpha = *getalpha++;
|
||||||
|
if (falpha)
|
||||||
|
{
|
||||||
|
combined_alpha = (GX_UBYTE)(falpha * alpha / 255);
|
||||||
|
pixel = *get;
|
||||||
|
|
||||||
|
/* Convert 565rgb color to 24xrgb color. */
|
||||||
|
pixel = (GX_COLOR)ASSEMBLECOLOR_32ARGB(0xff,
|
||||||
|
REDVAL_16BPP(*get) << 3,
|
||||||
|
GREENVAL_16BPP(*get) << 2,
|
||||||
|
BLUEVAL_16BPP(*get) << 3);
|
||||||
|
|
||||||
|
/* Blend 24xrgb color to background. */
|
||||||
|
blend_func(context, xval, yval, pixel, combined_alpha);
|
||||||
|
}
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
getrowalpha += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_565rgb_pixelmap_raw_blend */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of rotated */
|
||||||
|
/* uncompressed 565rgb format pixlemap data 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_24xrgb_pixel_blend */
|
||||||
|
/* _gx_display_driver_32argb_pixel_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_565rgb_pixelmap_raw_blend(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap, GX_UBYTE alpha)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT yval;
|
||||||
|
USHORT *getrow;
|
||||||
|
GX_CONST USHORT *get;
|
||||||
|
GX_COLOR pixel;
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
/* Convert 565rgb color to 24xrgb color. */
|
||||||
|
pixel = (GX_COLOR)ASSEMBLECOLOR_32ARGB(0xff,
|
||||||
|
REDVAL_16BPP(*get) << 3,
|
||||||
|
GREENVAL_16BPP(*get) << 2,
|
||||||
|
BLUEVAL_16BPP(*get) << 3);
|
||||||
|
|
||||||
|
blend_func(context, xval, yval, pixel, alpha);
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_blend PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 24xrgb format screen driver pixelmap blending function that */
|
||||||
|
/* handles uncompressed pixelmap blend, 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_32bpp_rotated_palette_pixelmap_transparent_blend */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_palette_pixelmap_blend */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_4444argb_pixelmap_alpha_blend */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_565rgb_pixelmap_alpha_blend */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_565rgb_pixelmap_raw_blend */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_alpha_blend */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_raw_blend */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_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)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (pixelmap -> gx_pixelmap_format)
|
||||||
|
{
|
||||||
|
case GX_COLOR_FORMAT_8BIT_PALETTE:
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_palette_pixelmap_transparent_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_palette_pixelmap_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GX_COLOR_FORMAT_4444ARGB:
|
||||||
|
_gx_display_driver_32bpp_rotated_4444argb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GX_COLOR_FORMAT_565RGB:
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_565rgb_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_565rgb_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GX_COLOR_FORMAT_24XRGB:
|
||||||
|
case GX_COLOR_FORMAT_32ARGB:
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_pixelmap_alpha_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_gx_display_driver_32bpp_rotated_pixelmap_raw_blend(context, xpos, ypos, pixelmap, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
2490
common/src/gx_display_driver_32bpp_rotated_pixelmap_draw.c
Normal file
2490
common/src/gx_display_driver_32bpp_rotated_pixelmap_draw.c
Normal file
File diff suppressed because it is too large
Load Diff
875
common/src/gx_display_driver_32bpp_rotated_pixelmap_rotate.c
Normal file
875
common/src/gx_display_driver_32bpp_rotated_pixelmap_rotate.c
Normal file
@ -0,0 +1,875 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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 BYTE_RANGE(_c) _c > 255 ? 255 : _c
|
||||||
|
|
||||||
|
#define GX_SOURCE_CODE
|
||||||
|
|
||||||
|
|
||||||
|
/* Include necessary system files. */
|
||||||
|
|
||||||
|
#include "gx_api.h"
|
||||||
|
#include "gx_display.h"
|
||||||
|
#include "gx_context.h"
|
||||||
|
#include "gx_utility.h"
|
||||||
|
#include "gx_system.h"
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_raw_rotate */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that rotate an rotated uncompressed */
|
||||||
|
/* pixelmap without alpha. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* status Completion status */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_utility_math_cos Compute the cosine value */
|
||||||
|
/* _gx_utility_math_sin Compute the sine value */
|
||||||
|
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||||
|
/* blend function */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_rotate */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_pixelmap_raw_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_COLOR *get;
|
||||||
|
INT srcxres;
|
||||||
|
INT srcyres;
|
||||||
|
INT cosv;
|
||||||
|
INT sinv;
|
||||||
|
INT alpha;
|
||||||
|
GX_COLOR red;
|
||||||
|
GX_COLOR green;
|
||||||
|
GX_COLOR blue;
|
||||||
|
INT idxminx;
|
||||||
|
INT idxmaxx;
|
||||||
|
INT idxmaxy;
|
||||||
|
INT *mx;
|
||||||
|
INT *my;
|
||||||
|
INT xres;
|
||||||
|
INT yres;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
INT xx;
|
||||||
|
INT yy;
|
||||||
|
GX_COLOR a;
|
||||||
|
GX_COLOR b;
|
||||||
|
GX_COLOR c;
|
||||||
|
GX_COLOR d;
|
||||||
|
INT xdiff;
|
||||||
|
INT ydiff;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
clip = context -> gx_draw_context_clip;
|
||||||
|
|
||||||
|
if (!blend_func)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mx = _gx_system_scratchpad;
|
||||||
|
my = mx + 4;
|
||||||
|
|
||||||
|
mx[0] = mx[3] = -1;
|
||||||
|
mx[1] = mx[2] = 1;
|
||||||
|
|
||||||
|
my[0] = my[1] = 1;
|
||||||
|
my[2] = my[3] = -1;
|
||||||
|
|
||||||
|
idxminx = (angle / 90) & 0x3;
|
||||||
|
idxmaxx = (idxminx + 2) & 0x3;
|
||||||
|
idxmaxy = (idxminx + 1) & 0x3;
|
||||||
|
|
||||||
|
/* Calculate the source x and y center. */
|
||||||
|
srcxres = pixelmap -> gx_pixelmap_height >> 1;
|
||||||
|
srcyres = pixelmap -> gx_pixelmap_width >> 1;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
srcyres = pixelmap -> gx_pixelmap_width - 1 - srcyres;
|
||||||
|
|
||||||
|
ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width;
|
||||||
|
cy = pixelmap -> gx_pixelmap_width - cy - 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 - 1 - clip -> gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - 1 - clip -> gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
srcxres = pixelmap -> gx_pixelmap_height - 1 - srcxres;
|
||||||
|
|
||||||
|
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height;
|
||||||
|
cx = pixelmap -> gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - 1 - clip -> gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - 1 - clip -> gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
cosv = _gx_utility_math_cos(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
sinv = _gx_utility_math_sin(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
|
||||||
|
xres = mx[idxmaxx] * (srcxres + 2) * cosv - my[idxmaxx] * (srcyres + 2) * sinv;
|
||||||
|
yres = my[idxmaxy] * (srcyres + 2) * cosv + mx[idxmaxy] * (srcxres + 2) * sinv;
|
||||||
|
|
||||||
|
xres = GX_FIXED_VAL_TO_INT(xres);
|
||||||
|
yres = GX_FIXED_VAL_TO_INT(yres);
|
||||||
|
|
||||||
|
/* Calculate the new rotation axis. */
|
||||||
|
|
||||||
|
x = (cx - srcxres) * cosv - (cy - srcyres) * sinv;
|
||||||
|
y = (cy - srcyres) * cosv + (cx - srcxres) * sinv;
|
||||||
|
|
||||||
|
x = GX_FIXED_VAL_TO_INT(x) + xres;
|
||||||
|
y = GX_FIXED_VAL_TO_INT(y) + yres;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - x;
|
||||||
|
newypos = ypos + cy - y;
|
||||||
|
|
||||||
|
/* Loop through the destination's pixels. */
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
xx = (x - xres) * cosv + (y - yres) * sinv;
|
||||||
|
yy = (y - yres) * cosv - (x - xres) * sinv;
|
||||||
|
|
||||||
|
xdiff = GX_FIXED_VAL_TO_INT(xx << 8) & 0xff;
|
||||||
|
ydiff = GX_FIXED_VAL_TO_INT(yy << 8) & 0xff;
|
||||||
|
|
||||||
|
xx = GX_FIXED_VAL_TO_INT(xx) + srcxres;
|
||||||
|
yy = GX_FIXED_VAL_TO_INT(yy) + srcyres;
|
||||||
|
|
||||||
|
if ((xx >= -1) && (xx < pixelmap -> gx_pixelmap_height) &&
|
||||||
|
(yy >= -1) && (yy < pixelmap -> gx_pixelmap_width))
|
||||||
|
{
|
||||||
|
if ((xx >= 0) && (xx < pixelmap -> gx_pixelmap_height - 1) &&
|
||||||
|
(yy >= 0) && (yy < pixelmap -> gx_pixelmap_width - 1))
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += yy * pixelmap -> gx_pixelmap_height;
|
||||||
|
get += xx;
|
||||||
|
|
||||||
|
a = *get;
|
||||||
|
b = *(get + 1);
|
||||||
|
c = *(get + pixelmap -> gx_pixelmap_height);
|
||||||
|
d = *(get + pixelmap -> gx_pixelmap_height + 1);
|
||||||
|
|
||||||
|
alpha = 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
|
||||||
|
a = 0;
|
||||||
|
b = 0;
|
||||||
|
c = 0;
|
||||||
|
d = 0;
|
||||||
|
alpha = 0;
|
||||||
|
|
||||||
|
if (xx == -1)
|
||||||
|
{
|
||||||
|
/* Handle left edge. */
|
||||||
|
if (yy >= 0)
|
||||||
|
{
|
||||||
|
b = *(get + yy * pixelmap -> gx_pixelmap_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yy < pixelmap -> gx_pixelmap_width - 1)
|
||||||
|
{
|
||||||
|
d = *(get + (yy + 1) * pixelmap -> gx_pixelmap_height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (yy == -1)
|
||||||
|
{
|
||||||
|
/* Handle top edge. */
|
||||||
|
c = *(get + xx);
|
||||||
|
|
||||||
|
if (xx < pixelmap -> gx_pixelmap_height - 1)
|
||||||
|
{
|
||||||
|
d = *(get + xx + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (xx == pixelmap -> gx_pixelmap_height - 1)
|
||||||
|
{
|
||||||
|
/* Handle right edget. */
|
||||||
|
a = *(get + yy * pixelmap -> gx_pixelmap_height + xx);
|
||||||
|
|
||||||
|
if (yy < pixelmap -> gx_pixelmap_width - 1)
|
||||||
|
{
|
||||||
|
c = *(get + (yy + 1) * pixelmap -> gx_pixelmap_height + xx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Handle bottom edge. */
|
||||||
|
a = *(get + yy * pixelmap -> gx_pixelmap_height + xx);
|
||||||
|
b = *(get + yy * pixelmap -> gx_pixelmap_height + xx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a)
|
||||||
|
{
|
||||||
|
alpha += (256 - xdiff) * (256 - ydiff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
alpha += xdiff * (256 - ydiff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c)
|
||||||
|
{
|
||||||
|
alpha += ydiff * (256 - xdiff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d)
|
||||||
|
{
|
||||||
|
alpha += xdiff * ydiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpha >>= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
red = (GX_COLOR)(REDVAL_24BPP(a) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
REDVAL_24BPP(b) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
REDVAL_24BPP(c) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
REDVAL_24BPP(d) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16;
|
||||||
|
|
||||||
|
green = (GX_COLOR)(GREENVAL_24BPP(a) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
GREENVAL_24BPP(b) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
GREENVAL_24BPP(c) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
GREENVAL_24BPP(d) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16;
|
||||||
|
|
||||||
|
blue = (GX_COLOR)(BLUEVAL_24BPP(a) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
BLUEVAL_24BPP(b) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
BLUEVAL_24BPP(c) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
BLUEVAL_24BPP(d) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16;
|
||||||
|
|
||||||
|
if ((alpha > 0) && (alpha < 0xff))
|
||||||
|
{
|
||||||
|
red = (red << 8) / (GX_COLOR)alpha;
|
||||||
|
green = (green << 8) / (GX_COLOR)alpha;
|
||||||
|
blue = (blue << 8) / (GX_COLOR)alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
red = BYTE_RANGE(red);
|
||||||
|
green = BYTE_RANGE(green);
|
||||||
|
blue = BYTE_RANGE(blue);
|
||||||
|
alpha = BYTE_RANGE(alpha);
|
||||||
|
|
||||||
|
blend_func(context, x + newxpos, y + newypos, ASSEMBLECOLOR_32ARGB((ULONG)0xff, red, green, blue), (GX_UBYTE)alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_utility_32bppted_pixelmap_alpha_rotate PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that rotate an rotated uncompressed */
|
||||||
|
/* pixelmap with alpha. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_utility_math_cos Compute the cosine value */
|
||||||
|
/* _gx_utility_math_sin Compute the sine value */
|
||||||
|
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||||
|
/* blend function */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_rotate */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_pixelmap_alpha_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_COLOR *get;
|
||||||
|
INT srcxres;
|
||||||
|
INT srcyres;
|
||||||
|
INT cosv;
|
||||||
|
INT sinv;
|
||||||
|
INT alpha;
|
||||||
|
GX_COLOR red;
|
||||||
|
GX_COLOR green;
|
||||||
|
GX_COLOR blue;
|
||||||
|
INT idxminx;
|
||||||
|
INT idxmaxx;
|
||||||
|
INT idxmaxy;
|
||||||
|
INT *mx;
|
||||||
|
INT *my;
|
||||||
|
INT xres;
|
||||||
|
INT yres;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
INT xx;
|
||||||
|
INT yy;
|
||||||
|
GX_COLOR a;
|
||||||
|
GX_COLOR b;
|
||||||
|
GX_COLOR c;
|
||||||
|
GX_COLOR d;
|
||||||
|
INT xdiff;
|
||||||
|
INT ydiff;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
clip = context -> gx_draw_context_clip;
|
||||||
|
|
||||||
|
if (!blend_func)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mx = _gx_system_scratchpad;
|
||||||
|
my = mx + 4;
|
||||||
|
|
||||||
|
mx[0] = mx[3] = -1;
|
||||||
|
mx[1] = mx[2] = 1;
|
||||||
|
|
||||||
|
my[0] = my[1] = 1;
|
||||||
|
my[2] = my[3] = -1;
|
||||||
|
|
||||||
|
idxminx = (angle / 90) & 0x3;
|
||||||
|
idxmaxx = (idxminx + 2) & 0x3;
|
||||||
|
idxmaxy = (idxminx + 1) & 0x3;
|
||||||
|
|
||||||
|
/* Calculate the source x and y center. */
|
||||||
|
srcxres = pixelmap -> gx_pixelmap_height >> 1;
|
||||||
|
srcyres = pixelmap -> gx_pixelmap_width >> 1;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
srcyres = pixelmap -> gx_pixelmap_width - 1 - srcyres;
|
||||||
|
|
||||||
|
ypos = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - ypos - pixelmap -> gx_pixelmap_width;
|
||||||
|
cy = pixelmap -> gx_pixelmap_width - cy - 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 - 1 - clip -> gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - 1 - clip -> gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
srcxres = pixelmap -> gx_pixelmap_height - 1 - srcxres;
|
||||||
|
|
||||||
|
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height;
|
||||||
|
cx = pixelmap -> gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - 1 - clip -> gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - 1 - clip -> gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
cosv = _gx_utility_math_cos(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
sinv = _gx_utility_math_sin(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
|
||||||
|
xres = mx[idxmaxx] * (srcxres + 2) * cosv - my[idxmaxx] * (srcyres + 2) * sinv;
|
||||||
|
yres = my[idxmaxy] * (srcyres + 2) * cosv + mx[idxmaxy] * (srcxres + 2) * sinv;
|
||||||
|
|
||||||
|
xres = GX_FIXED_VAL_TO_INT(xres);
|
||||||
|
yres = GX_FIXED_VAL_TO_INT(yres);
|
||||||
|
|
||||||
|
x = GX_FIXED_VAL_TO_INT(xres) + xres;
|
||||||
|
y = GX_FIXED_VAL_TO_INT(yres) + yres;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - x;
|
||||||
|
newypos = ypos + cy - y;
|
||||||
|
|
||||||
|
/* Loop through the source's pixels. */
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
xx = (x - xres) * cosv + (y - yres) * sinv;
|
||||||
|
yy = (y - yres) * cosv - (x - xres) * sinv;
|
||||||
|
|
||||||
|
xdiff = GX_FIXED_VAL_TO_INT(xx << 8) & 0xff;
|
||||||
|
ydiff = GX_FIXED_VAL_TO_INT(yy << 8) & 0xff;
|
||||||
|
|
||||||
|
xx = GX_FIXED_VAL_TO_INT(xx);
|
||||||
|
yy = GX_FIXED_VAL_TO_INT(yy);
|
||||||
|
|
||||||
|
xx += srcxres;
|
||||||
|
yy += srcyres;
|
||||||
|
|
||||||
|
if ((xx >= -1) && (xx < pixelmap -> gx_pixelmap_height) &&
|
||||||
|
(yy >= -1) && (yy < pixelmap -> gx_pixelmap_width))
|
||||||
|
{
|
||||||
|
if ((xx >= 0) && (xx < pixelmap -> gx_pixelmap_height - 1) && \
|
||||||
|
(yy >= 0) && (yy < pixelmap -> gx_pixelmap_width - 1))
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += yy * pixelmap -> gx_pixelmap_height;
|
||||||
|
get += xx;
|
||||||
|
|
||||||
|
a = *get;
|
||||||
|
b = *(get + 1);
|
||||||
|
c = *(get + pixelmap -> gx_pixelmap_height);
|
||||||
|
d = *(get + pixelmap -> gx_pixelmap_height + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
|
||||||
|
a = 0;
|
||||||
|
b = a;
|
||||||
|
c = a;
|
||||||
|
d = a;
|
||||||
|
|
||||||
|
if (xx == -1)
|
||||||
|
{
|
||||||
|
/* Handle left edge. */
|
||||||
|
if (yy >= 0)
|
||||||
|
{
|
||||||
|
b = *(get + yy * pixelmap -> gx_pixelmap_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yy < pixelmap -> gx_pixelmap_width - 1)
|
||||||
|
{
|
||||||
|
d = *(get + (yy + 1) * pixelmap -> gx_pixelmap_height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (yy == -1)
|
||||||
|
{
|
||||||
|
/* Handle top edge. */
|
||||||
|
c = *(get + xx);
|
||||||
|
|
||||||
|
if (xx < pixelmap -> gx_pixelmap_height - 1)
|
||||||
|
{
|
||||||
|
d = *(get + xx + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (xx == pixelmap -> gx_pixelmap_height - 1)
|
||||||
|
{
|
||||||
|
/* Handle right edget. */
|
||||||
|
a = *(get + yy * pixelmap -> gx_pixelmap_height + xx);
|
||||||
|
|
||||||
|
if (yy < pixelmap -> gx_pixelmap_width - 1)
|
||||||
|
{
|
||||||
|
c = *(get + (yy + 1) * pixelmap -> gx_pixelmap_height + xx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Handle bottom edge. */
|
||||||
|
a = *(get + yy * pixelmap -> gx_pixelmap_height + xx);
|
||||||
|
b = *(get + yy * pixelmap -> gx_pixelmap_height + xx + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
red = (REDVAL_24BPP(a) * (a >> 24) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
REDVAL_24BPP(b) * (b >> 24) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
REDVAL_24BPP(c) * (c >> 24) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
REDVAL_24BPP(d) * (d >> 24) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16;
|
||||||
|
|
||||||
|
green = (GREENVAL_24BPP(a) * (a >> 24) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
GREENVAL_24BPP(b) * (b >> 24) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
GREENVAL_24BPP(c) * (c >> 24) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
GREENVAL_24BPP(d) * (d >> 24) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16;
|
||||||
|
|
||||||
|
blue = (BLUEVAL_24BPP(a) * (a >> 24) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
BLUEVAL_24BPP(b) * (b >> 24) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
BLUEVAL_24BPP(c) * (c >> 24) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
BLUEVAL_24BPP(d) * (d >> 24) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16;
|
||||||
|
|
||||||
|
alpha = (INT)(((a >> 24) * (256 - (GX_COLOR)xdiff) * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
(b >> 24) * (GX_COLOR)xdiff * (256 - (GX_COLOR)ydiff) + \
|
||||||
|
(c >> 24) * (GX_COLOR)ydiff * (256 - (GX_COLOR)xdiff) + \
|
||||||
|
(d >> 24) * (GX_COLOR)xdiff * (GX_COLOR)ydiff) >> 16);
|
||||||
|
|
||||||
|
if (alpha)
|
||||||
|
{
|
||||||
|
red /= (UINT)alpha;
|
||||||
|
green /= (UINT)alpha;
|
||||||
|
blue /= (UINT)alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
red = BYTE_RANGE(red);
|
||||||
|
green = BYTE_RANGE(green);
|
||||||
|
blue = BYTE_RANGE(blue);
|
||||||
|
alpha = BYTE_RANGE(alpha);
|
||||||
|
|
||||||
|
blend_func(context, x + newxpos, y + newypos, (GX_COLOR)ASSEMBLECOLOR_32ARGB((ULONG)0xff, red, green, blue), (GX_UBYTE)alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_simple_rotate */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal help function that hangles 90, 180 and 270 degree rotated */
|
||||||
|
/* pixelmap rotation. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* [gx_display_driver_pixel_blend] Basic display driver pixel */
|
||||||
|
/* blend function */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_32bpp_rotated_pixelmap_simple_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_COLOR *putrow;
|
||||||
|
GX_COLOR *put;
|
||||||
|
GX_COLOR *get;
|
||||||
|
INT width;
|
||||||
|
INT height;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
VOID (*blend_func)(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR fcolor, GX_UBYTE alpha);
|
||||||
|
|
||||||
|
GX_SET_BLEND_FUNCTION(blend_func, context -> gx_draw_context_display -> gx_display_color_format);
|
||||||
|
|
||||||
|
clip = context -> gx_draw_context_clip;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
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 - pixelmap -> gx_pixelmap_width;
|
||||||
|
cy = pixelmap -> gx_pixelmap_width - cy - 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 - 1 - clip -> gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_x_resolution - 1 - clip -> gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xpos = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - xpos - pixelmap -> gx_pixelmap_height;
|
||||||
|
cx = pixelmap -> gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - 1 - clip -> gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context -> gx_draw_context_canvas -> gx_canvas_y_resolution - 1 - clip -> gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip -> gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip -> gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (angle == 90)
|
||||||
|
{
|
||||||
|
width = pixelmap -> gx_pixelmap_width;
|
||||||
|
height = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - (width - 1 - cy);
|
||||||
|
newypos = ypos + cy - cx;
|
||||||
|
|
||||||
|
putrow = context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += (width - 1 - x) * height;
|
||||||
|
get += y;
|
||||||
|
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||||
|
{
|
||||||
|
blend_func(context, rotated_clip.gx_rectangle_left + x, rotated_clip.gx_rectangle_top + y, (*get) | 0xff000000, (GX_UBYTE)((*get) >> 24));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*put++ = *get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (angle == 180)
|
||||||
|
{
|
||||||
|
|
||||||
|
width = pixelmap -> gx_pixelmap_height;
|
||||||
|
height = pixelmap -> gx_pixelmap_width;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - (width - 1 - cx);
|
||||||
|
newypos = ypos + cy - (height - 1 - cy);
|
||||||
|
|
||||||
|
putrow = context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += (height - 1 - y) * width;
|
||||||
|
get += width - 1 - x;
|
||||||
|
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||||
|
{
|
||||||
|
blend_func(context, rotated_clip.gx_rectangle_left + x, rotated_clip.gx_rectangle_top + y, (*get) | 0xff000000, (GX_UBYTE)((*get) >> 24));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*put++ = *get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
width = pixelmap -> gx_pixelmap_width;
|
||||||
|
height = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - cy;
|
||||||
|
newypos = ypos + cx - (height - 1 - cy);
|
||||||
|
|
||||||
|
putrow = context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_COLOR *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += x * height;
|
||||||
|
get += height - 1 - y;
|
||||||
|
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||||
|
{
|
||||||
|
blend_func(context, rotated_clip.gx_rectangle_left + x, rotated_clip.gx_rectangle_top + y, (*get) | 0xff000000, (GX_UBYTE)((*get) >> 24));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*put++ = *get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_rotate PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This service rotate a rotated pixelmap directly to canvas memory. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* rot_cx x-coord of rotating center. */
|
||||||
|
/* rot_cy y-coord of rotationg center. */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_simple_rotate */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_alpha_rotate */
|
||||||
|
/* _gx_display_driver_32bpp_rotated_pixelmap_rotate */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT rot_cx, INT rot_cy)
|
||||||
|
{
|
||||||
|
switch (pixelmap -> gx_pixelmap_format)
|
||||||
|
{
|
||||||
|
case GX_COLOR_FORMAT_24XRGB:
|
||||||
|
case GX_COLOR_FORMAT_32ARGB:
|
||||||
|
if (angle % 90 == 0)
|
||||||
|
{
|
||||||
|
/* Simple angle rotate: 90 degree, 180 degree and 270 degree. */
|
||||||
|
_gx_display_driver_32bpp_rotated_pixelmap_simple_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA)
|
||||||
|
{
|
||||||
|
/* With alpha. */
|
||||||
|
_gx_display_driver_32bpp_rotated_pixelmap_alpha_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Without alpha. */
|
||||||
|
_gx_display_driver_32bpp_rotated_pixelmap_raw_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
490
common/src/gx_display_driver_32bpp_rotated_simple_line_draw.c
Normal file
490
common/src/gx_display_driver_32bpp_rotated_simple_line_draw.c
Normal file
@ -0,0 +1,490 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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) = (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_32bpp_rotated_simple_line_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32bpp 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 */
|
||||||
|
/* Basic display driver line */
|
||||||
|
/* alpha draw function */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_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;
|
||||||
|
ULONG *put;
|
||||||
|
ULONG *next_put;
|
||||||
|
GX_BOOL clipped = GX_TRUE;
|
||||||
|
INT dx;
|
||||||
|
INT dy;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
GX_COLOR linecolor = context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
|
||||||
|
#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);
|
||||||
|
|
||||||
|
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 = (ULONG *)(context -> gx_draw_context_memory) + ystart * context -> gx_draw_context_pitch + xstart;
|
||||||
|
next_put = (ULONG *)(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 = (ULONG *)(context -> gx_draw_context_memory) + ystart * context -> gx_draw_context_pitch + xstart;
|
||||||
|
next_put = (ULONG *)(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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
131
common/src/gx_display_driver_32bpp_rotated_vertical_line_draw.c
Normal file
131
common/src/gx_display_driver_32bpp_rotated_vertical_line_draw.c
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_rotated_vertical_line_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 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 */
|
||||||
|
/* Basic display driver vertical */
|
||||||
|
/* line alpha draw function */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
|
||||||
|
{
|
||||||
|
INT row;
|
||||||
|
INT column;
|
||||||
|
ULONG *put;
|
||||||
|
ULONG *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 = (ULONG *)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++ = (ULONG)color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Advance to the next scaneline. */
|
||||||
|
rowstart -= context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_32bpp_rotated_vertical_pattern_line_draw */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic rotated 32bpp color format 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_32bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
|
||||||
|
{
|
||||||
|
INT row;
|
||||||
|
ULONG *put;
|
||||||
|
ULONG *rowstart;
|
||||||
|
ULONG pattern;
|
||||||
|
ULONG mask;
|
||||||
|
ULONG on_color;
|
||||||
|
ULONG off_color;
|
||||||
|
INT len = yend - ystart + 1;
|
||||||
|
|
||||||
|
/* Pick up starting address of canvas memory. */
|
||||||
|
rowstart = (ULONG *)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 = (ULONG)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
off_color = (ULONG)context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||||
|
|
||||||
|
put = rowstart;
|
||||||
|
|
||||||
|
/* Draw line from top to bottom. */
|
||||||
|
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 next scaneline. */
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
/* Save current masks value back to brush. */
|
||||||
|
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
|
||||||
|
}
|
||||||
|
|
120
common/src/gx_display_driver_8bit_palette_rotated_setup.c
Normal file
120
common/src/gx_display_driver_8bit_palette_rotated_setup.c
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bit_palette_rotated_setup PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 8-bit palettte color format display driver rotated setup routine. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bit_palette_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
|
||||||
|
VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
|
||||||
|
GX_RECTANGLE *dirty_area))
|
||||||
|
{
|
||||||
|
_gx_display_driver_8bit_palette_setup(display, aux_data, toggle_function);
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
display -> gx_display_rotation_angle = GX_SCREEN_ROTATION_CW;
|
||||||
|
|
||||||
|
display -> gx_display_driver_canvas_copy = _gx_display_driver_8bpp_rotated_canvas_copy;
|
||||||
|
display -> gx_display_driver_simple_line_draw = _gx_display_driver_8bpp_rotated_simple_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_line_draw = _gx_display_driver_8bpp_rotated_horizontal_line_draw;
|
||||||
|
display -> gx_display_driver_vertical_line_draw = _gx_display_driver_8bpp_rotated_vertical_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_pattern_line_draw = _gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw;
|
||||||
|
display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_draw;
|
||||||
|
display -> gx_display_driver_vertical_pattern_line_draw = _gx_display_driver_8bpp_rotated_vertical_pattern_line_draw;
|
||||||
|
display -> gx_display_driver_pixel_write = _gx_display_driver_8bpp_rotated_pixel_write;
|
||||||
|
display -> gx_display_driver_block_move = _gx_display_driver_8bpp_rotated_block_move;
|
||||||
|
|
||||||
|
display -> gx_display_driver_pixelmap_draw = _gx_display_driver_8bpp_rotated_pixelmap_draw;
|
||||||
|
display -> gx_display_driver_pixelmap_rotate = _gx_display_driver_8bpp_rotated_pixelmap_rotate;
|
||||||
|
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
|
||||||
|
|
||||||
|
#if (GX_PALETTE_MODE_AA_TEXT_COLORS == 8)
|
||||||
|
display -> gx_display_driver_4bit_glyph_draw = _gx_display_driver_8bpp_rotated_glyph_3bit_draw;
|
||||||
|
#else
|
||||||
|
display -> gx_display_driver_4bit_glyph_draw = _gx_display_driver_8bpp_rotated_glyph_4bit_draw;
|
||||||
|
#endif
|
||||||
|
display -> gx_display_driver_1bit_glyph_draw = _gx_display_driver_8bpp_rotated_glyph_1bit_draw;
|
||||||
|
}
|
||||||
|
|
193
common/src/gx_display_driver_8bpp_rotated_block_move.c
Normal file
193
common/src/gx_display_driver_8bpp_rotated_block_move.c
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_block_move PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 8-bit 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_block_move(GX_DRAW_CONTEXT *context,
|
||||||
|
GX_RECTANGLE *block, INT xshift, INT yshift)
|
||||||
|
{
|
||||||
|
GX_UBYTE *pGet;
|
||||||
|
GX_UBYTE *pPut;
|
||||||
|
int width;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
pPut = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left + xshift;
|
||||||
|
|
||||||
|
pGet = (GX_UBYTE *)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;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Have to copy from right to left. */
|
||||||
|
pPut = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left;
|
||||||
|
|
||||||
|
pGet = (GX_UBYTE *)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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (width <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y = rotated_block.gx_rectangle_top; y <= rotated_block.gx_rectangle_bottom; y++)
|
||||||
|
{
|
||||||
|
memmove(pPut, pGet, (size_t)width);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (yshift > 0)
|
||||||
|
{
|
||||||
|
/* Have to copy from top to bottom. */
|
||||||
|
pPut = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_bottom * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left;
|
||||||
|
|
||||||
|
pGet = (GX_UBYTE *)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);
|
||||||
|
|
||||||
|
pPut -= context -> gx_draw_context_pitch;
|
||||||
|
pGet -= context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Have to copy from bottom to top. */
|
||||||
|
pPut = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
pPut += rotated_block.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
pPut += rotated_block.gx_rectangle_left;
|
||||||
|
|
||||||
|
pGet = (GX_UBYTE *)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);
|
||||||
|
|
||||||
|
pPut += context -> gx_draw_context_pitch;
|
||||||
|
pGet += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
130
common/src/gx_display_driver_8bpp_rotated_canvas_copy.c
Normal file
130
common/src/gx_display_driver_8bpp_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_8bpp_rotated_canvas_copy PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_canvas_copy(GX_CANVAS *canvas, GX_CANVAS *composite)
|
||||||
|
{
|
||||||
|
GX_RECTANGLE dirty;
|
||||||
|
GX_RECTANGLE overlap;
|
||||||
|
GX_UBYTE *read;
|
||||||
|
GX_UBYTE *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 - 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))
|
||||||
|
{
|
||||||
|
width = overlap.gx_rectangle_bottom - overlap.gx_rectangle_top + 1;
|
||||||
|
|
||||||
|
read = (GX_UBYTE *)canvas -> gx_canvas_memory;
|
||||||
|
write = (GX_UBYTE *)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); /* Use case of memcpy is verified. */
|
||||||
|
|
||||||
|
write += composite -> gx_canvas_y_resolution;
|
||||||
|
read += canvas -> gx_canvas_y_resolution;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
241
common/src/gx_display_driver_8bpp_rotated_glyph_1bit_draw.c
Normal file
241
common/src/gx_display_driver_8bpp_rotated_glyph_1bit_draw.c
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_glyph_1bit_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function draws monochrome font to the 8bpp canvas, clipped */
|
||||||
|
/* to one viweport. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_glyph_1bit_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 pixel_per_row;
|
||||||
|
UINT pixel_in_first_byte;
|
||||||
|
UINT pixel_in_last_byte = 0;
|
||||||
|
GX_UBYTE text_color;
|
||||||
|
UINT y_height;
|
||||||
|
GX_UBYTE alpha;
|
||||||
|
UINT glyph_width;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
UINT num_bytes;
|
||||||
|
UINT num_bits;
|
||||||
|
GX_UBYTE *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;
|
||||||
|
|
||||||
|
text_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
pixel_per_row = (UINT)draw_area -> gx_rectangle_bottom - (UINT)draw_area -> gx_rectangle_top + (UINT)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)rotated_map_offset_x + 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 = (rotated_map_offset_x + (INT)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 = glyph_row + ((INT)glyph_width * rotated_map_offset_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
glyph_row += (rotated_map_offset_x >> 3);
|
||||||
|
|
||||||
|
line_start = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
line_start += context -> gx_draw_context_pitch * rotated_draw_top;
|
||||||
|
line_start += rotated_draw_left;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
198
common/src/gx_display_driver_8bpp_rotated_glyph_3bit_draw.c
Normal file
198
common/src/gx_display_driver_8bpp_rotated_glyph_3bit_draw.c
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_glyph_3bit_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This draws the specified 3bit glyph 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 */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_canvas_text_draw */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_glyph_3bit_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 pixel_width = 0;
|
||||||
|
UINT leading_pixel;
|
||||||
|
UINT trailing_pixel;
|
||||||
|
GX_UBYTE text_color;
|
||||||
|
UINT y_height;
|
||||||
|
GX_UBYTE alpha;
|
||||||
|
UINT pitch;
|
||||||
|
UINT index;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *draw_start;
|
||||||
|
GX_VALUE rotated_map_offset_x;
|
||||||
|
GX_VALUE rotated_map_offset_y;
|
||||||
|
GX_VALUE rotated_left;
|
||||||
|
GX_VALUE rotated_top;
|
||||||
|
|
||||||
|
text_color = (GX_UBYTE)(context -> gx_draw_context_brush.gx_brush_line_color + 7);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
leading_pixel = (rotated_map_offset_x & 1);
|
||||||
|
|
||||||
|
pixel_width -= leading_pixel;
|
||||||
|
|
||||||
|
trailing_pixel = pixel_width & 1;
|
||||||
|
|
||||||
|
pixel_width = pixel_width >> 1;
|
||||||
|
|
||||||
|
/* Find the width of the glyph. */
|
||||||
|
pitch = glyph -> gx_glyph_height;
|
||||||
|
|
||||||
|
/* Make it byte-aligned. */
|
||||||
|
pitch = (pitch + 1) >> 1;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
draw_start = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
draw_start += context -> gx_draw_context_pitch * rotated_top;
|
||||||
|
draw_start += rotated_left;
|
||||||
|
|
||||||
|
for (row = 0; row < y_height; row++)
|
||||||
|
{
|
||||||
|
glyph_data = glyph_row;
|
||||||
|
|
||||||
|
put = draw_start;
|
||||||
|
|
||||||
|
if (leading_pixel)
|
||||||
|
{
|
||||||
|
alpha = (*glyph_data) & 0x0f;
|
||||||
|
|
||||||
|
/* use 3bit color gradient instead of 4 bit */
|
||||||
|
alpha >>= 1;
|
||||||
|
|
||||||
|
*put = (GX_UBYTE)(text_color - alpha);
|
||||||
|
put++;
|
||||||
|
|
||||||
|
glyph_data++;
|
||||||
|
}
|
||||||
|
for (index = 0; index < pixel_width; index++)
|
||||||
|
{
|
||||||
|
alpha = (*glyph_data) & 0xf0;
|
||||||
|
|
||||||
|
/* use 3bit color gradient instead of 4 bit */
|
||||||
|
alpha >>= 1;
|
||||||
|
|
||||||
|
*put = (GX_UBYTE)(text_color - (alpha >> 4));
|
||||||
|
put++;
|
||||||
|
|
||||||
|
alpha = (*glyph_data) & 0x0f;
|
||||||
|
|
||||||
|
/* use 3bit color gradient instead of 4 bit */
|
||||||
|
alpha >>= 1;
|
||||||
|
|
||||||
|
*put = (GX_UBYTE)(text_color - alpha);
|
||||||
|
put++;
|
||||||
|
glyph_data++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trailing_pixel)
|
||||||
|
{
|
||||||
|
alpha = (*glyph_data) & 0xf0;
|
||||||
|
|
||||||
|
/* use 3bit color gradient instead of 4 bit */
|
||||||
|
alpha >>= 1;
|
||||||
|
|
||||||
|
*put = (GX_UBYTE)(text_color - (alpha >> 4));
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
|
||||||
|
glyph_row += pitch;
|
||||||
|
draw_start += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
184
common/src/gx_display_driver_8bpp_rotated_glyph_4bit_draw.c
Normal file
184
common/src/gx_display_driver_8bpp_rotated_glyph_4bit_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_8bpp_rotated_glyph_4bit_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This 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 */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_canvas_text_draw */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_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 pixel_width = 0;
|
||||||
|
UINT leading_pixel;
|
||||||
|
UINT trailing_pixel;
|
||||||
|
GX_UBYTE text_color;
|
||||||
|
UINT y_height;
|
||||||
|
GX_UBYTE alpha;
|
||||||
|
UINT pitch;
|
||||||
|
UINT index;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *draw_start;
|
||||||
|
GX_VALUE rotated_map_offset_x;
|
||||||
|
GX_VALUE rotated_map_offset_y;
|
||||||
|
GX_VALUE rotated_left;
|
||||||
|
GX_VALUE rotated_top;
|
||||||
|
|
||||||
|
text_color = (GX_UBYTE)(context -> gx_draw_context_brush.gx_brush_line_color + 15);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
leading_pixel = (rotated_map_offset_x & 1);
|
||||||
|
|
||||||
|
pixel_width -= leading_pixel;
|
||||||
|
|
||||||
|
trailing_pixel = pixel_width & 1;
|
||||||
|
|
||||||
|
pixel_width = pixel_width >> 1;
|
||||||
|
|
||||||
|
/* Find the width of the glyph. */
|
||||||
|
pitch = glyph -> gx_glyph_height;
|
||||||
|
|
||||||
|
/* Make it byte-aligned. */
|
||||||
|
pitch = (pitch + 1) >> 1;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
draw_start = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
draw_start += context -> gx_draw_context_pitch * rotated_top;
|
||||||
|
draw_start += rotated_left;
|
||||||
|
|
||||||
|
for (row = 0; row < y_height; row++)
|
||||||
|
{
|
||||||
|
glyph_data = glyph_row;
|
||||||
|
|
||||||
|
put = draw_start;
|
||||||
|
|
||||||
|
if (leading_pixel)
|
||||||
|
{
|
||||||
|
alpha = (*glyph_data) & 0x0f;
|
||||||
|
|
||||||
|
*put = (GX_UBYTE)(text_color - alpha);
|
||||||
|
put++;
|
||||||
|
|
||||||
|
glyph_data++;
|
||||||
|
}
|
||||||
|
for (index = 0; index < pixel_width; index++)
|
||||||
|
{
|
||||||
|
alpha = (*glyph_data) & 0xf0;
|
||||||
|
|
||||||
|
*put = (GX_UBYTE)(text_color - (alpha >> 4));
|
||||||
|
put++;
|
||||||
|
|
||||||
|
alpha = (*glyph_data) & 0x0f;
|
||||||
|
*put = (GX_UBYTE)(text_color - alpha);
|
||||||
|
put++;
|
||||||
|
glyph_data++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trailing_pixel)
|
||||||
|
{
|
||||||
|
alpha = (*glyph_data) & 0xf0;
|
||||||
|
*put = (GX_UBYTE)(text_color - (alpha >> 4));
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
|
||||||
|
glyph_row += pitch;
|
||||||
|
draw_start += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
106
common/src/gx_display_driver_8bpp_rotated_horizontal_line_draw.c
Normal file
106
common/src/gx_display_driver_8bpp_rotated_horizontal_line_draw.c
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_horizontal_line_draw */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp color format rotated 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 */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
|
||||||
|
{
|
||||||
|
INT row;
|
||||||
|
INT column;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *rowstart;
|
||||||
|
INT len = xend - xstart + 1;
|
||||||
|
|
||||||
|
/* Pick up start address of canvas memory. */
|
||||||
|
rowstart = (GX_UBYTE *)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 pixel to fill width. */
|
||||||
|
for (row = 0; row < width; row++)
|
||||||
|
{
|
||||||
|
*put++ = (GX_UBYTE)color;
|
||||||
|
}
|
||||||
|
rowstart -= context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,131 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_horizontal_pattern_line_draw */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos)
|
||||||
|
{
|
||||||
|
INT column;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *rowstart;
|
||||||
|
ULONG pattern;
|
||||||
|
ULONG mask;
|
||||||
|
GX_UBYTE on_color;
|
||||||
|
GX_UBYTE off_color;
|
||||||
|
|
||||||
|
INT len = xend - xstart + 1;
|
||||||
|
|
||||||
|
/* Pick up start address of canvas memory. */
|
||||||
|
rowstart = (GX_UBYTE *)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 - 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 = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||||
|
|
||||||
|
put = rowstart;
|
||||||
|
|
||||||
|
/* Draw one line, left to right. */
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
mask = 0x80000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save current masks value back to brush. */
|
||||||
|
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,602 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_horizontal_pixelmap_line_raw_write */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of uncompressed */
|
||||||
|
/* pixlemap file without alpha channel. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* context Drawing context */
|
||||||
|
/* xstart x-coord of line left */
|
||||||
|
/* xend x-coord of line right */
|
||||||
|
/* y y-coord of line top */
|
||||||
|
/* info GX_FILL_PIXELMAP_INFO struct */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_horizontal_pixelmap_line_draw */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_raw_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT offset;
|
||||||
|
INT pic_width;
|
||||||
|
GX_CONST GX_UBYTE *get;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_PIXELMAP *pixelmap;
|
||||||
|
|
||||||
|
pixelmap = info -> pixelmap;
|
||||||
|
|
||||||
|
pic_width = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
if ((info -> draw) && (xstart <= xend))
|
||||||
|
{
|
||||||
|
get = info -> current_pixel_ptr;
|
||||||
|
put = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
put += y * context -> gx_draw_context_pitch + xstart;
|
||||||
|
|
||||||
|
/* Calculate the map offset in x-axis. */
|
||||||
|
offset = (info -> x_offset % pic_width);
|
||||||
|
|
||||||
|
for (xval = xstart; xval <= xend; xval++)
|
||||||
|
{
|
||||||
|
/* get points to the start postion of this row. So we need to calculate its position. */
|
||||||
|
*put++ = *(get + offset);
|
||||||
|
offset++;
|
||||||
|
if (offset >= pic_width)
|
||||||
|
{
|
||||||
|
offset -= pic_width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This line is drawn. Update the pointer position for next row. */
|
||||||
|
info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_ */
|
||||||
|
/* compressed_write */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of compressed */
|
||||||
|
/* pixlemap file. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* context Drawing context */
|
||||||
|
/* xstart x-coord of line left */
|
||||||
|
/* xend x-coord of line right */
|
||||||
|
/* y y-coord of line top */
|
||||||
|
/* info GX_FILL_PIXELMAP_INFO struct */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_horizontal_pixelmap_line_draw */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_compressed_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
|
||||||
|
{
|
||||||
|
INT start_pos;
|
||||||
|
INT xval;
|
||||||
|
GX_UBYTE count;
|
||||||
|
GX_CONST GX_UBYTE *get = GX_NULL;
|
||||||
|
GX_UBYTE pixel;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_PIXELMAP *pixelmap;
|
||||||
|
|
||||||
|
pixelmap = info -> pixelmap;
|
||||||
|
|
||||||
|
if ((info -> draw) && (xstart <= xend))
|
||||||
|
{
|
||||||
|
/* Calculate draw start position. */
|
||||||
|
start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_height);
|
||||||
|
|
||||||
|
put = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
put += y * context -> gx_draw_context_pitch + start_pos;
|
||||||
|
|
||||||
|
/*Repeat the draw operation to fill the whole dirty area.*/
|
||||||
|
while (start_pos <= xend)
|
||||||
|
{
|
||||||
|
xval = start_pos;
|
||||||
|
|
||||||
|
/*Start from where we need to repeat.*/
|
||||||
|
get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
|
||||||
|
|
||||||
|
while (xval < start_pos + pixelmap -> gx_pixelmap_width)
|
||||||
|
{
|
||||||
|
count = *get++;
|
||||||
|
if (count & 0x80)
|
||||||
|
{
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
pixel = *get++;
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
if (xval >= xstart && xval <= xend)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
xval++;
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
pixel = *get++;
|
||||||
|
if (xval >= xstart && xval <= xend)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
xval++;
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
start_pos += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xval = 0;
|
||||||
|
get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
|
||||||
|
while (xval < pixelmap -> gx_pixelmap_height)
|
||||||
|
{
|
||||||
|
count = *get++;
|
||||||
|
if (count & 0x80)
|
||||||
|
{
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
get += count;
|
||||||
|
}
|
||||||
|
xval += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*This line is drawn. cache the pointer for next line draw.*/
|
||||||
|
info -> current_pixel_ptr = (GX_UBYTE *)get;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_horizontal_line_pixelmap_ */
|
||||||
|
/* transparent_write */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of uncompressed */
|
||||||
|
/* pixlemap file with alpha channel. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* context Drawing context */
|
||||||
|
/* xstart x-coord of line left */
|
||||||
|
/* xend x-coord of line right */
|
||||||
|
/* y y-coord of line top */
|
||||||
|
/* info GX_FILL_PIXELMAP_INFO struct */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_horizontal_pixelmap_line_draw */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_transparent_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT offset;
|
||||||
|
INT pic_width;
|
||||||
|
GX_CONST GX_UBYTE *get;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_PIXELMAP *pixelmap;
|
||||||
|
GX_UBYTE pixel;
|
||||||
|
|
||||||
|
pixelmap = info -> pixelmap;
|
||||||
|
pic_width = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
if ((info -> draw) && (xstart <= xend))
|
||||||
|
{
|
||||||
|
get = info -> current_pixel_ptr;
|
||||||
|
put = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
put += y * context -> gx_draw_context_pitch + xstart;
|
||||||
|
|
||||||
|
/* Calculate the map offset in x-axis. */
|
||||||
|
offset = (info -> x_offset % pic_width);
|
||||||
|
|
||||||
|
for (xval = xstart; xval <= xend; xval++)
|
||||||
|
{
|
||||||
|
/* get points to the start postion of this row. So we need to calculate its position. */
|
||||||
|
pixel = *(get + offset);
|
||||||
|
offset++;
|
||||||
|
if (offset >= pic_width)
|
||||||
|
{
|
||||||
|
offset -= pic_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pixel != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This line is drawn. Update the pointer position for next row. */
|
||||||
|
info -> current_pixel_ptr += (UINT)pic_width * sizeof(GX_UBYTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_ */
|
||||||
|
/* compressed_transparent_write */
|
||||||
|
/* */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of compressed */
|
||||||
|
/* pixlemap file with alpha channel. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* context Drawing context */
|
||||||
|
/* xstart x-coord of line left */
|
||||||
|
/* xend x-coord of line right */
|
||||||
|
/* y y-coord of line top */
|
||||||
|
/* info GX_FILL_PIXELMAP_INFO struct */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_horizontal_pixelmap_line_draw */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_compressed_transparent_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xstart, INT xend, INT y, GX_FILL_PIXELMAP_INFO *info)
|
||||||
|
{
|
||||||
|
INT start_pos;
|
||||||
|
INT xval;
|
||||||
|
GX_UBYTE count;
|
||||||
|
GX_CONST GX_UBYTE *get = GX_NULL;
|
||||||
|
GX_UBYTE pixel;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_PIXELMAP *pixelmap;
|
||||||
|
|
||||||
|
pixelmap = info -> pixelmap;
|
||||||
|
|
||||||
|
if ((info -> draw) && (xstart <= xend))
|
||||||
|
{
|
||||||
|
/* Calcualte draw start position. */
|
||||||
|
start_pos = xstart - (info -> x_offset % pixelmap -> gx_pixelmap_height);
|
||||||
|
|
||||||
|
put = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
put += y * context -> gx_draw_context_pitch + start_pos;
|
||||||
|
|
||||||
|
|
||||||
|
/*Repeat the draw operation to fill the whole dirty area.*/
|
||||||
|
while (start_pos <= xend)
|
||||||
|
{
|
||||||
|
xval = start_pos;
|
||||||
|
|
||||||
|
/*Start from where we need to repeat.*/
|
||||||
|
get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
|
||||||
|
|
||||||
|
while (xval < start_pos + pixelmap -> gx_pixelmap_height)
|
||||||
|
{
|
||||||
|
count = *get++;
|
||||||
|
if (count & 0x80)
|
||||||
|
{
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
pixel = *get++;
|
||||||
|
if (pixel != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
if (xval >= xstart && xval <= xend)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
xval++;
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xval += count;
|
||||||
|
put += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
pixel = *get++;
|
||||||
|
|
||||||
|
if (xval >= xstart && xval <= xend)
|
||||||
|
{
|
||||||
|
if (pixel != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xval++;
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
start_pos += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xval = 0;
|
||||||
|
get = (GX_CONST GX_UBYTE *)info -> current_pixel_ptr;
|
||||||
|
while (xval < pixelmap -> gx_pixelmap_height)
|
||||||
|
{
|
||||||
|
count = *get++;
|
||||||
|
if (count & 0x80)
|
||||||
|
{
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
get += count;
|
||||||
|
}
|
||||||
|
xval += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This line is drawn. cache the pointer for next line draw.*/
|
||||||
|
info -> current_pixel_ptr = (GX_UBYTE *)get;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 8bit screen driver pixelmap drawing function that handles */
|
||||||
|
/* compressed or uncompress, with or without alpha channel. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* context Drawing context */
|
||||||
|
/* xstart x-coord of line left */
|
||||||
|
/* xend x-coord of line end */
|
||||||
|
/* y y-coord of line top */
|
||||||
|
/* info GX_FILL_PIXELMAP_INFO struct */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bit_rotated_horizontal_pixelmap_line_raw_write */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_ */
|
||||||
|
/* compressed_write */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_ */
|
||||||
|
/* transparent_write */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_ */
|
||||||
|
/* compressed_transparent_write */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_draw(GX_DRAW_CONTEXT *context,
|
||||||
|
INT ystart, INT yend, INT x, GX_FILL_PIXELMAP_INFO *info)
|
||||||
|
{
|
||||||
|
INT xstart;
|
||||||
|
INT xend;
|
||||||
|
INT y;
|
||||||
|
|
||||||
|
if (info -> pixelmap == GX_NULL)
|
||||||
|
{
|
||||||
|
/* Nothing to drawn. Just return. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
xstart = ystart;
|
||||||
|
xend = yend;
|
||||||
|
y = context -> gx_draw_context_canvas -> gx_canvas_x_resolution - x - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xstart = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1;
|
||||||
|
xend = context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ystart - 1;
|
||||||
|
y = x;
|
||||||
|
info -> x_offset = (yend - ystart + 1 + info -> x_offset) % info -> pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
if (info -> x_offset)
|
||||||
|
{
|
||||||
|
info -> x_offset = info -> pixelmap -> gx_pixelmap_height - info -> x_offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info -> pixelmap == GX_NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
|
||||||
|
{
|
||||||
|
if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||||
|
{
|
||||||
|
/* has both compression and transparent */
|
||||||
|
_gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_compressed_transparent_write(context, xstart, xend, y, info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* transparent, no compression */
|
||||||
|
_gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_transparent_write(context, xstart, xend, y, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (info -> pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||||
|
{
|
||||||
|
/* compressed with no transparency */
|
||||||
|
_gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_compressed_write(context, xstart, xend, y, info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* no compression or transaprency */
|
||||||
|
_gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_raw_write(context, xstart, xend, y, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*Current pixelmap has gone over, so the offset pointer should be reset.*/
|
||||||
|
if (info -> current_pixel_ptr >= info -> pixelmap -> gx_pixelmap_data + info -> pixelmap -> gx_pixelmap_data_size)
|
||||||
|
{
|
||||||
|
info -> current_pixel_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_data;
|
||||||
|
info -> current_aux_ptr = (GX_UBYTE *)info -> pixelmap -> gx_pixelmap_aux_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
92
common/src/gx_display_driver_8bpp_rotated_pixel_write.c
Normal file
92
common/src/gx_display_driver_8bpp_rotated_pixel_write.c
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_pixel_write PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp color format rotated 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_pixel_write(GX_DRAW_CONTEXT *context, INT x, INT y, GX_COLOR color)
|
||||||
|
{
|
||||||
|
GX_UBYTE *put = (GX_UBYTE *)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 = (GX_UBYTE)color;
|
||||||
|
}
|
||||||
|
|
646
common/src/gx_display_driver_8bpp_rotated_pixelmap_draw.c
Normal file
646
common/src/gx_display_driver_8bpp_rotated_pixelmap_draw.c
Normal file
@ -0,0 +1,646 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_pixelmap_raw_write PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of uncompressed */
|
||||||
|
/* pixlemap file 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 */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_raw_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT yval;
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE *getrow;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_CONST GX_UBYTE *get;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
get = getrow;
|
||||||
|
|
||||||
|
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||||
|
{
|
||||||
|
*put++ = *get++;
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_compressed_write */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing 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 */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_compressed_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||||
|
{
|
||||||
|
INT yval;
|
||||||
|
INT xval;
|
||||||
|
GX_CONST GX_UBYTE *get;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE count;
|
||||||
|
GX_UBYTE pixel = 0;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
get = (GX_CONST GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
|
||||||
|
/* 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 & 0x80)
|
||||||
|
{
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
|
||||||
|
/* Skip repeated pixel value. */
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
|
||||||
|
/* Skip raw pixel values. */
|
||||||
|
get += count;
|
||||||
|
}
|
||||||
|
xval += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we are on the first visible row, copy pixels until we get
|
||||||
|
to the end of the last visible row. */
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += yval * context -> gx_draw_context_pitch;
|
||||||
|
putrow += xpos;
|
||||||
|
|
||||||
|
while (yval <= rotated_clip.gx_rectangle_bottom)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
xval = xpos;
|
||||||
|
|
||||||
|
while (xval < (xpos + pixelmap -> 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)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
xval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
/* String of non-repeated values. */
|
||||||
|
count++;
|
||||||
|
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||||
|
xval <= rotated_clip.gx_rectangle_right)
|
||||||
|
{
|
||||||
|
*put = *get;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
get++;
|
||||||
|
xval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
yval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_transparent_write */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of uncompressed */
|
||||||
|
/* pixlemap 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 */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_transparent_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||||
|
{
|
||||||
|
INT xval;
|
||||||
|
INT yval;
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE *getrow;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE inval;
|
||||||
|
GX_CONST GX_UBYTE *get;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
for (yval = rotated_clip.gx_rectangle_top; yval <= rotated_clip.gx_rectangle_bottom; yval++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
get = getrow;
|
||||||
|
|
||||||
|
for (xval = rotated_clip.gx_rectangle_left; xval <= rotated_clip.gx_rectangle_right; xval++)
|
||||||
|
{
|
||||||
|
inval = *get++;
|
||||||
|
if (inval == pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*put++ = inval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
getrow += pixelmap -> gx_pixelmap_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_compressed_transparent_ */
|
||||||
|
/* write */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that handles writing of compressed */
|
||||||
|
/* pixlemap 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 */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_compressed_transparent_write(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||||
|
{
|
||||||
|
INT yval;
|
||||||
|
INT xval;
|
||||||
|
GX_CONST GX_UBYTE *get;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE count;
|
||||||
|
GX_UBYTE pixel = 0;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
get = (GX_CONST GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
|
||||||
|
/* 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 & 0x80)
|
||||||
|
{
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
|
||||||
|
/* Skip repeated pixel value. */
|
||||||
|
get++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
|
||||||
|
/* Skip raw pixel values. */
|
||||||
|
get += count;
|
||||||
|
}
|
||||||
|
xval += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we are on the first visible row, copy pixels until we get
|
||||||
|
to the end of the last visible row. */
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += yval * context -> gx_draw_context_pitch;
|
||||||
|
putrow += xpos;
|
||||||
|
|
||||||
|
while (yval <= rotated_clip.gx_rectangle_bottom)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
xval = xpos;
|
||||||
|
while (xval < (xpos + pixelmap -> gx_pixelmap_height))
|
||||||
|
{
|
||||||
|
count = *get++;
|
||||||
|
|
||||||
|
if (count & 0x80)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Repeated value. */
|
||||||
|
count = (GX_UBYTE)((count & 0x7f) + 1);
|
||||||
|
pixel = *get++;
|
||||||
|
|
||||||
|
if (pixel == pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
put += count;
|
||||||
|
xval += count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||||
|
xval <= rotated_clip.gx_rectangle_right)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
xval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
/* String of non-repeated values. */
|
||||||
|
count++;
|
||||||
|
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
pixel = *get++;
|
||||||
|
|
||||||
|
if (xval >= rotated_clip.gx_rectangle_left &&
|
||||||
|
xval <= rotated_clip.gx_rectangle_right &&
|
||||||
|
pixel != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = pixel;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
xval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
yval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 8bit screen driver pixelmap drawing 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 */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bit_rotated_pixelmap_compressed_write */
|
||||||
|
/* _gx_display_driver_8bit_rotated_pixelmap_compressed_transparent_ */
|
||||||
|
/* write */
|
||||||
|
/* _gx_display_driver_8bit_rotated_pixelmap_transparent_write */
|
||||||
|
/* _gx_display_driver_8bit_rotated_pixelmap_raw_write */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_pixelmap_draw(GX_DRAW_CONTEXT *context,
|
||||||
|
INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (pixelmap -> gx_pixelmap_format != GX_COLOR_FORMAT_8BIT_PALETTE ||
|
||||||
|
(pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA))
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Wrong color format for this driver. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
|
||||||
|
{
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Has both compression and transparent. */
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_compressed_transparent_write(context, xpos, ypos, pixelmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Transparent, no compression. */
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_transparent_write(context, xpos, ypos, pixelmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Compressed with no transparency. */
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_compressed_write(context, xpos, ypos, pixelmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
/* No compression or transaprency. */
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_raw_write(context, xpos, ypos, pixelmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
789
common/src/gx_display_driver_8bpp_rotated_pixelmap_rotate.c
Normal file
789
common/src/gx_display_driver_8bpp_rotated_pixelmap_rotate.c
Normal file
@ -0,0 +1,789 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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"
|
||||||
|
#include "gx_utility.h"
|
||||||
|
#include "gx_system.h"
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_raw_rotate PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that rotate an uncompressed pixelmap */
|
||||||
|
/* without alpha. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_utility_math_cos Compute the cosine value */
|
||||||
|
/* _gx_utility_math_sin Compute the sine value */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_pixelmap_rotate */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_raw_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *get;
|
||||||
|
INT srcxres;
|
||||||
|
INT srcyres;
|
||||||
|
INT cosv;
|
||||||
|
INT sinv;
|
||||||
|
INT idxminx;
|
||||||
|
INT idxmaxx;
|
||||||
|
INT idxmaxy;
|
||||||
|
INT mx[] = {-1, 1, 1, -1};
|
||||||
|
INT my[] = {1, 1, -1, -1};
|
||||||
|
INT xres;
|
||||||
|
INT yres;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
INT xx;
|
||||||
|
INT yy;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
|
||||||
|
clip = context -> gx_draw_context_clip;
|
||||||
|
|
||||||
|
/* Set transparent color. */
|
||||||
|
idxminx = (angle / 90) & 0x3;
|
||||||
|
idxmaxx = (idxminx + 2) & 0x3;
|
||||||
|
idxmaxy = (idxminx + 1) & 0x3;
|
||||||
|
|
||||||
|
/* Calculate the source x and y center. */
|
||||||
|
srcxres = pixelmap -> gx_pixelmap_height >> 1;
|
||||||
|
srcyres = pixelmap -> gx_pixelmap_width >> 1;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
if (context->gx_draw_context_display->gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
srcyres = pixelmap->gx_pixelmap_width - 1 - srcyres;
|
||||||
|
|
||||||
|
ypos = context->gx_draw_context_canvas->gx_canvas_x_resolution - ypos - pixelmap->gx_pixelmap_width;
|
||||||
|
cy = pixelmap->gx_pixelmap_width - cy - 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 - 1 - clip->gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_x_resolution - 1 - clip->gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
srcxres = pixelmap->gx_pixelmap_height - 1 - srcxres;
|
||||||
|
|
||||||
|
xpos = context->gx_draw_context_canvas->gx_canvas_y_resolution - xpos - pixelmap->gx_pixelmap_height;
|
||||||
|
cx = pixelmap->gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip->gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip->gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
cosv = _gx_utility_math_cos(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
sinv = _gx_utility_math_sin(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
|
||||||
|
xres = GX_FIXED_VAL_TO_INT((mx[idxmaxx] * (srcxres + 2) * cosv - my[idxmaxx] * (srcyres + 2) * sinv));
|
||||||
|
yres = GX_FIXED_VAL_TO_INT((my[idxmaxy] * (srcyres + 2) * cosv + mx[idxmaxy] * (srcxres + 2) * sinv));
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
/* Calculate the new rotation axis. */
|
||||||
|
x = GX_FIXED_VAL_TO_INT((cx - srcxres) * cosv - (cy - srcyres) * sinv);
|
||||||
|
y = GX_FIXED_VAL_TO_INT((cy - srcyres) * cosv + (cx - srcxres) * sinv);
|
||||||
|
|
||||||
|
x += xres;
|
||||||
|
y += yres;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - x;
|
||||||
|
newypos = ypos + cy - y;
|
||||||
|
|
||||||
|
/* For every pixel in destination bitmap, find its position in source bitmap,
|
||||||
|
and set the pixel with the value in source bitmap. */
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
xx = GX_FIXED_VAL_TO_INT((x - xres) * cosv + (y - yres) * sinv);
|
||||||
|
yy = GX_FIXED_VAL_TO_INT((y - yres) * cosv - (x - xres) * sinv);
|
||||||
|
|
||||||
|
xx += srcxres;
|
||||||
|
yy += srcyres;
|
||||||
|
|
||||||
|
if ((xx >= 0) && (xx < pixelmap -> gx_pixelmap_height) &&
|
||||||
|
(yy >= 0) && (yy < pixelmap -> gx_pixelmap_width))
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += yy * pixelmap -> gx_pixelmap_height;
|
||||||
|
get += xx;
|
||||||
|
|
||||||
|
*put = *get;
|
||||||
|
}
|
||||||
|
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_transparent_rotate */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal helper function that rotate an uncompressed pixelmap */
|
||||||
|
/* without alpha. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_utility_math_cos Compute the cosine value */
|
||||||
|
/* _gx_utility_math_sin Compute the sine value */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_transparent_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *get;
|
||||||
|
INT srcxres;
|
||||||
|
INT srcyres;
|
||||||
|
INT cosv;
|
||||||
|
INT sinv;
|
||||||
|
INT idxminx;
|
||||||
|
INT idxmaxx;
|
||||||
|
INT idxmaxy;
|
||||||
|
INT mx[] = {-1, 1, 1, -1};
|
||||||
|
INT my[] = {1, 1, -1, -1};
|
||||||
|
INT xres;
|
||||||
|
INT yres;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
INT xx;
|
||||||
|
INT yy;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
|
||||||
|
clip = context -> gx_draw_context_clip;
|
||||||
|
|
||||||
|
/* Set transparent color. */
|
||||||
|
idxminx = (angle / 90) & 0x3;
|
||||||
|
idxmaxx = (idxminx + 2) & 0x3;
|
||||||
|
idxmaxy = (idxminx + 1) & 0x3;
|
||||||
|
|
||||||
|
/* Calculate the source x and y center. */
|
||||||
|
srcxres = pixelmap -> gx_pixelmap_height >> 1;
|
||||||
|
srcyres = pixelmap -> gx_pixelmap_width >> 1;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
if (context->gx_draw_context_display->gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
srcyres = pixelmap->gx_pixelmap_width - 1 - srcyres;
|
||||||
|
|
||||||
|
ypos = context->gx_draw_context_canvas->gx_canvas_x_resolution - ypos - pixelmap->gx_pixelmap_width;
|
||||||
|
cy = pixelmap->gx_pixelmap_width - cy - 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 - 1 - clip->gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_x_resolution - 1 - clip->gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
srcxres = pixelmap->gx_pixelmap_height - 1 - srcxres;
|
||||||
|
|
||||||
|
xpos = context->gx_draw_context_canvas->gx_canvas_y_resolution - xpos - pixelmap->gx_pixelmap_height;
|
||||||
|
cx = pixelmap->gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip->gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip->gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
cosv = _gx_utility_math_cos(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
sinv = _gx_utility_math_sin(GX_FIXED_VAL_MAKE(angle));
|
||||||
|
|
||||||
|
xres = GX_FIXED_VAL_TO_INT((mx[idxmaxx] * (srcxres + 2) * cosv - my[idxmaxx] * (srcyres + 2) * sinv));
|
||||||
|
yres = GX_FIXED_VAL_TO_INT((my[idxmaxy] * (srcyres + 2) * cosv + mx[idxmaxy] * (srcxres + 2) * sinv));
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
/* Calculate the new rotation axis. */
|
||||||
|
x = (cx - srcxres) * cosv - (cy - srcyres) * sinv;
|
||||||
|
y = (cy - srcyres) * cosv + (cx - srcxres) * sinv;
|
||||||
|
|
||||||
|
x = GX_FIXED_VAL_TO_INT(x) + xres;
|
||||||
|
y = GX_FIXED_VAL_TO_INT(y) + yres;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - x;
|
||||||
|
newypos = ypos + cy - y;
|
||||||
|
|
||||||
|
/* For every pixel in destination bitmap, find its position in source bitmap,
|
||||||
|
and set the pixel with the value in source bitmap. */
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
xx = GX_FIXED_VAL_TO_INT((x - xres) * cosv + (y - yres) * sinv);
|
||||||
|
yy = GX_FIXED_VAL_TO_INT((y - yres) * cosv - (x - xres) * sinv);
|
||||||
|
|
||||||
|
xx += srcxres;
|
||||||
|
yy += srcyres;
|
||||||
|
|
||||||
|
if ((xx >= 0) && (xx < pixelmap -> gx_pixelmap_height) &&
|
||||||
|
(yy >= 0) && (yy < pixelmap -> gx_pixelmap_width))
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += yy * pixelmap -> gx_pixelmap_height;
|
||||||
|
get += xx;
|
||||||
|
|
||||||
|
if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = *get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_simple_rotate */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal help function that hangles 90, 180 and 270 degree pixelmap */
|
||||||
|
/* rotation. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_pixelmap_rotate */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_simple_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *get;
|
||||||
|
INT width;
|
||||||
|
INT height;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
|
||||||
|
clip = context->gx_draw_context_clip;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
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 - pixelmap->gx_pixelmap_width;
|
||||||
|
cy = pixelmap->gx_pixelmap_width - cy - 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 - 1 - clip->gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_x_resolution - 1 - clip->gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xpos = context->gx_draw_context_canvas->gx_canvas_y_resolution - xpos - pixelmap->gx_pixelmap_height;
|
||||||
|
cx = pixelmap->gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip->gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip->gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (angle == 90)
|
||||||
|
{
|
||||||
|
width = pixelmap -> gx_pixelmap_width;
|
||||||
|
height = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - (width - 1 - cy);
|
||||||
|
newypos = ypos + cy - cx;
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += (width - 1 - x) * height;
|
||||||
|
get += y;
|
||||||
|
|
||||||
|
*put++ = *get;
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (angle == 180)
|
||||||
|
{
|
||||||
|
|
||||||
|
width = pixelmap -> gx_pixelmap_height;
|
||||||
|
height = pixelmap -> gx_pixelmap_width;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - (width - 1 - cx);
|
||||||
|
newypos = ypos + cy - (height - 1 - cy);
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += (height - 1 - y) * width;
|
||||||
|
get += width - 1 - x;
|
||||||
|
|
||||||
|
*put++ = *get;
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
width = pixelmap -> gx_pixelmap_width;
|
||||||
|
height = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - cy;
|
||||||
|
newypos = ypos + cx - (height - 1 - cy);
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += x * height;
|
||||||
|
get += height - 1 - y;
|
||||||
|
|
||||||
|
*put++ = *get;
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_simple_transparent_rotate */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Internal help function that hangles 90, 180 and 270 degree pixelmap */
|
||||||
|
/* rotation. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* cx x-coord of rotate center */
|
||||||
|
/* cy y-coord of rotate center */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_pixelmap_rotate */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static VOID _gx_display_driver_8bpp_rotated_pixelmap_simple_transparent_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT cx, INT cy)
|
||||||
|
{
|
||||||
|
GX_UBYTE *putrow;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *get;
|
||||||
|
INT width;
|
||||||
|
INT height;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
GX_RECTANGLE *clip;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
INT newxpos;
|
||||||
|
INT newypos;
|
||||||
|
|
||||||
|
clip = context -> gx_draw_context_clip;
|
||||||
|
|
||||||
|
GX_SWAP_VALS(xpos, ypos);
|
||||||
|
GX_SWAP_VALS(cx, cy);
|
||||||
|
|
||||||
|
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 - pixelmap->gx_pixelmap_width;
|
||||||
|
cy = pixelmap->gx_pixelmap_width - cy - 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 - 1 - clip->gx_rectangle_right);
|
||||||
|
rotated_clip.gx_rectangle_bottom = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_x_resolution - 1 - clip->gx_rectangle_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xpos = context->gx_draw_context_canvas->gx_canvas_y_resolution - xpos - pixelmap->gx_pixelmap_height;
|
||||||
|
cx = pixelmap->gx_pixelmap_height - cx - 1;
|
||||||
|
|
||||||
|
rotated_clip.gx_rectangle_left = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_bottom);
|
||||||
|
rotated_clip.gx_rectangle_right = (GX_VALUE)(context->gx_draw_context_canvas->gx_canvas_y_resolution - 1 - clip->gx_rectangle_top);
|
||||||
|
rotated_clip.gx_rectangle_top = clip->gx_rectangle_left;
|
||||||
|
rotated_clip.gx_rectangle_bottom = clip->gx_rectangle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (angle == 90)
|
||||||
|
{
|
||||||
|
width = pixelmap -> gx_pixelmap_width;
|
||||||
|
height = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - (width - 1 - cy);
|
||||||
|
newypos = ypos + cy - cx;
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += (width - 1 - x) * height;
|
||||||
|
get += y;
|
||||||
|
|
||||||
|
if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = *get;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (angle == 180)
|
||||||
|
{
|
||||||
|
|
||||||
|
width = pixelmap -> gx_pixelmap_height;
|
||||||
|
height = pixelmap -> gx_pixelmap_width;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - (width - 1 - cx);
|
||||||
|
newypos = ypos + cy - (height - 1 - cy);
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += (height - 1 - y) * width;
|
||||||
|
get += width - 1 - x;
|
||||||
|
|
||||||
|
if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = *get;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
width = pixelmap -> gx_pixelmap_width;
|
||||||
|
height = pixelmap -> gx_pixelmap_height;
|
||||||
|
|
||||||
|
newxpos = xpos + cx - cy;
|
||||||
|
newypos = ypos + cx - (height - 1 - cy);
|
||||||
|
|
||||||
|
putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
|
||||||
|
putrow += rotated_clip.gx_rectangle_top * context -> gx_draw_context_pitch;
|
||||||
|
putrow += rotated_clip.gx_rectangle_left;
|
||||||
|
|
||||||
|
for (y = rotated_clip.gx_rectangle_top - newypos; y <= rotated_clip.gx_rectangle_bottom - newypos; y++)
|
||||||
|
{
|
||||||
|
put = putrow;
|
||||||
|
|
||||||
|
for (x = rotated_clip.gx_rectangle_left - newxpos; x <= rotated_clip.gx_rectangle_right - newxpos; x++)
|
||||||
|
{
|
||||||
|
get = (GX_UBYTE *)pixelmap -> gx_pixelmap_data;
|
||||||
|
get += x * height;
|
||||||
|
get += height - 1 - y;
|
||||||
|
|
||||||
|
if ((*get) != pixelmap -> gx_pixelmap_transparent_color)
|
||||||
|
{
|
||||||
|
*put = *get;
|
||||||
|
}
|
||||||
|
put++;
|
||||||
|
}
|
||||||
|
|
||||||
|
putrow += context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_rotate PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This service rotate a pixelmap directly to canvas memory. */
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/* angle The angle to rotate */
|
||||||
|
/* rot_cx x-coord of rotating center. */
|
||||||
|
/* rot_cy y-coord of rotationg center. */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* status Completion status */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_simple_transparent_rotate */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_simple_rotate */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_transparent_rotate */
|
||||||
|
/* _gx_display_driver_8bpp_rotated_pixelmap_raw_rotate */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* Application Code */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_pixelmap_rotate(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap,
|
||||||
|
INT angle, INT rot_cx, INT rot_cy)
|
||||||
|
{
|
||||||
|
if (angle % 90 == 0)
|
||||||
|
{
|
||||||
|
/* Simple angle rotate: 90 degree, 180 degree and 270 degree. */
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
|
||||||
|
{
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_simple_transparent_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_simple_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pixelmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT)
|
||||||
|
{
|
||||||
|
/* no compression or alpha */
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_transparent_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* no compression or alpha */
|
||||||
|
_gx_display_driver_8bpp_rotated_pixelmap_raw_rotate(context, xpos, ypos, pixelmap, angle, rot_cx, rot_cy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
476
common/src/gx_display_driver_8bpp_rotated_simple_line_draw.c
Normal file
476
common/src/gx_display_driver_8bpp_rotated_simple_line_draw.c
Normal file
@ -0,0 +1,476 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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) = ((GX_UBYTE)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_8bpp_rotated_simple_line_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp color format rotated 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_ABS Compute the absolute value */
|
||||||
|
/* GX_SWAP_VALUE Swap two values */
|
||||||
|
/* [PIXEL_WRITE] Driver level pixel write */
|
||||||
|
/* routine */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_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;
|
||||||
|
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *next_put;
|
||||||
|
|
||||||
|
GX_BOOL clipped = GX_TRUE;
|
||||||
|
INT dx;
|
||||||
|
INT dy;
|
||||||
|
|
||||||
|
GX_RECTANGLE *clip = context -> gx_draw_context_clip;
|
||||||
|
GX_COLOR linecolor = context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
GX_RECTANGLE rotated_clip;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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 = (GX_UBYTE *)(context -> gx_draw_context_memory) + ystart * context -> gx_draw_context_pitch + xstart;
|
||||||
|
next_put = (GX_UBYTE *)(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 &rotated_clip in which side. */
|
||||||
|
if (_gx_utility_rectangle_point_detect(&rotated_clip, mid_point))
|
||||||
|
{
|
||||||
|
|
||||||
|
/* the &rotated_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 &rotated_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 = (GX_UBYTE *)(context -> gx_draw_context_memory) + ystart * context -> gx_draw_context_pitch + xstart;
|
||||||
|
next_put = (GX_UBYTE *)(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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
110
common/src/gx_display_driver_8bpp_rotated_vertical_line_draw.c
Normal file
110
common/src/gx_display_driver_8bpp_rotated_vertical_line_draw.c
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_vertical_line_draw PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp color format rotated vertical 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 */
|
||||||
|
/* width width of the line */
|
||||||
|
/* color Color of line to draw */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* GUIX Internal Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
|
||||||
|
{
|
||||||
|
INT row;
|
||||||
|
INT column;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *rowstart;
|
||||||
|
INT len = yend - ystart + 1;
|
||||||
|
|
||||||
|
/* Pick up starting address of canvas memory. */
|
||||||
|
rowstart = (GX_UBYTE *)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++ = (GX_UBYTE)color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ddvance to the next scaneline. */
|
||||||
|
rowstart -= context -> gx_draw_context_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_8bpp_rotated_vertical_pattern_line_draw */
|
||||||
|
/* PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* Generic 8bpp color format rotated vertical 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
VOID _gx_display_driver_8bpp_rotated_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos)
|
||||||
|
{
|
||||||
|
INT row;
|
||||||
|
GX_UBYTE *put;
|
||||||
|
GX_UBYTE *rowstart;
|
||||||
|
ULONG pattern;
|
||||||
|
ULONG mask;
|
||||||
|
GX_UBYTE on_color;
|
||||||
|
GX_UBYTE off_color;
|
||||||
|
|
||||||
|
INT len = yend - ystart + 1;
|
||||||
|
|
||||||
|
/* Pick up starting address of canvas memory. */
|
||||||
|
rowstart = (GX_UBYTE *)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 = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color;
|
||||||
|
off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color;
|
||||||
|
|
||||||
|
/* Draw line from top to bottom. */
|
||||||
|
for (row = 0; row < len; row++)
|
||||||
|
{
|
||||||
|
put = rowstart;
|
||||||
|
|
||||||
|
if (pattern & mask)
|
||||||
|
{
|
||||||
|
*put = on_color;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*put = off_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
mask >>= 1;
|
||||||
|
if (!mask)
|
||||||
|
{
|
||||||
|
mask = 0x80000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* advance to the next scaneline */
|
||||||
|
rowstart++;
|
||||||
|
}
|
||||||
|
/* save current masks value back to brush */
|
||||||
|
context -> gx_draw_context_brush.gx_brush_pattern_mask = mask;
|
||||||
|
}
|
||||||
|
|
@ -778,7 +778,7 @@ GX_POLYGON_EDGE temp;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_display_driver_generic_rotated_polygon_fill PORTABLE C */
|
/* _gx_display_driver_generic_rotated_polygon_fill PORTABLE C */
|
||||||
/* x.x */
|
/* 6.1.3 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
@ -215,6 +215,71 @@ GX_COLOR *pLine;
|
|||||||
return GX_SUCCESS;
|
return GX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* _gx_image_reader_24xrgb_rotated_pixel_write PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function writes a pixel to output rotated pixelmap 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static UINT _gx_image_reader_24xrgb_rotated_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel)
|
||||||
|
{
|
||||||
|
GX_COLOR *pLine;
|
||||||
|
|
||||||
|
if (!image_reader -> gx_image_reader_size_testing)
|
||||||
|
{
|
||||||
|
pLine = (GX_COLOR *)image_reader -> gx_image_reader_putdata;
|
||||||
|
|
||||||
|
(*pLine) = (GX_COLOR)((pixel -> gx_pixel_red << 16));
|
||||||
|
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_green) << 8));
|
||||||
|
(*pLine) = (GX_COLOR)((*pLine) | pixel -> gx_pixel_blue);
|
||||||
|
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_alpha) << 24));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW)
|
||||||
|
{
|
||||||
|
image_reader -> gx_image_reader_putdata -= (image_reader -> gx_image_reader_image_height << 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image_reader -> gx_image_reader_putdata += (image_reader -> gx_image_reader_image_height << 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GX_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
@ -1207,7 +1272,7 @@ GX_UBYTE color;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_image_reader_pixel_rotated_write_callback_set PORTABLE C */
|
/* _gx_image_reader_pixel_rotated_write_callback_set PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -1229,8 +1294,11 @@ GX_UBYTE color;
|
|||||||
/* CALLS */
|
/* CALLS */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_image_reader_565rgb_rotated_pixel_write */
|
/* _gx_image_reader_565rgb_rotated_pixel_write */
|
||||||
/* Write 565 rgb format pixel */
|
/* Write 565rgb format pixel in */
|
||||||
/* in rotation mode */
|
/* rotation mode */
|
||||||
|
/* _gx_image_reader_24xrgb_rotated_pixel_write */
|
||||||
|
/* Write 24xrgn format pixel in */
|
||||||
|
/* rotation mode */
|
||||||
/* */
|
/* */
|
||||||
/* CALLED BY */
|
/* CALLED BY */
|
||||||
/* */
|
/* */
|
||||||
@ -1241,6 +1309,9 @@ GX_UBYTE color;
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* added 24xrgb format support,*/
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static UINT _gx_image_reader_pixel_rotated_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap)
|
static UINT _gx_image_reader_pixel_rotated_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap)
|
||||||
@ -1284,6 +1355,29 @@ static UINT _gx_image_reader_pixel_rotated_write_callback_set(GX_IMAGE_READER *i
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GX_COLOR_FORMAT_24XRGB:
|
||||||
|
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_24xrgb_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 << 2);
|
||||||
|
|
||||||
|
image_reader -> gx_image_reader_putdatarow_stride = 4;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
|
||||||
|
image_reader -> gx_image_reader_putdatarow_stride = -4;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return GX_NOT_SUPPORTED;
|
return GX_NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_radial_slider_pen_down_event_process PORTABLE C */
|
/* _gx_radial_slider_pen_down_event_process PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -75,6 +75,11 @@
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STATUS_TRACKING_START to */
|
||||||
|
/* GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static UINT _gx_radial_slider_pen_down_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr)
|
static UINT _gx_radial_slider_pen_down_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr)
|
||||||
@ -100,7 +105,7 @@ GX_RECTANGLE rectangle;
|
|||||||
/* Check if click point is inside needle area. */
|
/* Check if click point is inside needle area. */
|
||||||
if (_gx_utility_rectangle_point_detect(&rectangle, *point))
|
if (_gx_utility_rectangle_point_detect(&rectangle, *point))
|
||||||
{
|
{
|
||||||
slider -> gx_widget_status |= GX_STATUS_TRACKING_START;
|
slider -> gx_widget_status |= GX_STATUS_TRACKING_PEN;
|
||||||
|
|
||||||
_gx_system_input_capture((GX_WIDGET *)slider);
|
_gx_system_input_capture((GX_WIDGET *)slider);
|
||||||
}
|
}
|
||||||
@ -136,7 +141,7 @@ GX_RECTANGLE rectangle;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_radial_slider_pen_drag_event_process PORTABLE C */
|
/* _gx_radial_slider_pen_drag_event_process PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -171,6 +176,11 @@ GX_RECTANGLE rectangle;
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STATUS_TRACKING_START to */
|
||||||
|
/* GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static UINT _gx_radial_slider_pen_drag_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr)
|
static UINT _gx_radial_slider_pen_drag_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr)
|
||||||
@ -181,7 +191,7 @@ GX_RADIAL_SLIDER_INFO *info = &slider -> gx_radial_slider_info;
|
|||||||
GX_BOOL update = GX_FALSE;
|
GX_BOOL update = GX_FALSE;
|
||||||
|
|
||||||
/* move my needle */
|
/* move my needle */
|
||||||
if (slider -> gx_widget_status & GX_STATUS_TRACKING_START)
|
if (slider -> gx_widget_status & GX_STATUS_TRACKING_PEN)
|
||||||
{
|
{
|
||||||
/* Calcualte new slider value. */
|
/* Calcualte new slider value. */
|
||||||
_gx_radial_slider_angle_calculate(slider, event_ptr -> gx_event_payload.gx_event_pointdata, &new_value);
|
_gx_radial_slider_angle_calculate(slider, event_ptr -> gx_event_payload.gx_event_pointdata, &new_value);
|
||||||
@ -231,7 +241,7 @@ GX_BOOL update = GX_FALSE;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_radial_slider_pen_up_event_process PORTABLE C */
|
/* _gx_radial_slider_pen_up_event_process PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -271,6 +281,11 @@ GX_BOOL update = GX_FALSE;
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STATUS_TRACKING_START to */
|
||||||
|
/* GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static UINT _gx_radial_slider_pen_up_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr)
|
static UINT _gx_radial_slider_pen_up_event_process(GX_RADIAL_SLIDER *slider, GX_EVENT *event_ptr)
|
||||||
@ -285,11 +300,11 @@ GX_POINT *point;
|
|||||||
|
|
||||||
point = &event_ptr -> gx_event_payload.gx_event_pointdata;
|
point = &event_ptr -> gx_event_payload.gx_event_pointdata;
|
||||||
|
|
||||||
if (slider -> gx_widget_status & GX_STATUS_TRACKING_START ||
|
if (slider -> gx_widget_status & GX_STATUS_TRACKING_PEN ||
|
||||||
((GX_ABS(point -> gx_point_x - slider -> gx_radial_slider_pendown_point.gx_point_x) < 5) &&
|
((GX_ABS(point -> gx_point_x - slider -> gx_radial_slider_pendown_point.gx_point_x) < 5) &&
|
||||||
(GX_ABS(point -> gx_point_y - slider -> gx_radial_slider_pendown_point.gx_point_y) < 5)))
|
(GX_ABS(point -> gx_point_y - slider -> gx_radial_slider_pendown_point.gx_point_y) < 5)))
|
||||||
{
|
{
|
||||||
if (slider -> gx_widget_status & GX_STATUS_TRACKING_START)
|
if (slider -> gx_widget_status & GX_STATUS_TRACKING_PEN)
|
||||||
{
|
{
|
||||||
new_value = info -> gx_radial_slider_info_current_angle;
|
new_value = info -> gx_radial_slider_info_current_angle;
|
||||||
}
|
}
|
||||||
@ -304,7 +319,7 @@ GX_POINT *point;
|
|||||||
}
|
}
|
||||||
|
|
||||||
slider -> gx_widget_status |= GX_STATUS_ANIMATION_NONE;
|
slider -> gx_widget_status |= GX_STATUS_ANIMATION_NONE;
|
||||||
slider -> gx_widget_status &= ~GX_STATUS_TRACKING_START;
|
slider -> gx_widget_status &= ~GX_STATUS_TRACKING_PEN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -335,7 +335,7 @@ INT speed;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_scroll_wheel_pen_up_event_handler PORTABLE C */
|
/* _gx_scroll_wheel_pen_up_event_handler PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -372,13 +372,18 @@ INT speed;
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STYLE_SCROLL_WHEEL_DRAG */
|
||||||
|
/* to GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static UINT _gx_scroll_wheel_pen_up_event_handler(GX_SCROLL_WHEEL *wheel)
|
static UINT _gx_scroll_wheel_pen_up_event_handler(GX_SCROLL_WHEEL *wheel)
|
||||||
{
|
{
|
||||||
GX_RECTANGLE dirty;
|
GX_RECTANGLE dirty;
|
||||||
|
|
||||||
wheel -> gx_widget_style &= (ULONG)(~GX_STYLE_SCROLL_WHEEL_DRAG);
|
wheel -> gx_widget_status &= (ULONG)(~GX_STATUS_TRACKING_PEN);
|
||||||
|
|
||||||
if (wheel -> gx_scroll_wheel_selected_yshift)
|
if (wheel -> gx_scroll_wheel_selected_yshift)
|
||||||
{
|
{
|
||||||
@ -409,7 +414,7 @@ GX_RECTANGLE dirty;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_scroll_wheel_event_process PORTABLE C */
|
/* _gx_scroll_wheel_event_process PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -454,6 +459,11 @@ GX_RECTANGLE dirty;
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STYLE_SCROLL_WHEEL_DRAG */
|
||||||
|
/* to GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
UINT _gx_scroll_wheel_event_process(GX_SCROLL_WHEEL *wheel, GX_EVENT *event_ptr)
|
UINT _gx_scroll_wheel_event_process(GX_SCROLL_WHEEL *wheel, GX_EVENT *event_ptr)
|
||||||
@ -474,7 +484,7 @@ GX_VALUE shift;
|
|||||||
case GX_EVENT_PEN_DRAG:
|
case GX_EVENT_PEN_DRAG:
|
||||||
if (wheel -> gx_widget_status & GX_STATUS_OWNS_INPUT)
|
if (wheel -> gx_widget_status & GX_STATUS_OWNS_INPUT)
|
||||||
{
|
{
|
||||||
wheel -> gx_widget_style |= GX_STYLE_SCROLL_WHEEL_DRAG;
|
wheel -> gx_widget_status |= GX_STATUS_TRACKING_PEN;
|
||||||
shift = (GX_VALUE)(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y - wheel -> gx_window_move_start.gx_point_y);
|
shift = (GX_VALUE)(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y - wheel -> gx_window_move_start.gx_point_y);
|
||||||
if (shift)
|
if (shift)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ GX_BRUSH *brush;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_text_scroll_wheel_row_draw PORTABLE C */
|
/* _gx_text_scroll_wheel_row_draw PORTABLE C */
|
||||||
/* 6.1 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -312,6 +312,11 @@ GX_BRUSH *brush;
|
|||||||
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
|
||||||
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
|
||||||
/* resulting in version 6.1 */
|
/* resulting in version 6.1 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* renamed */
|
||||||
|
/* GX_STYLE_SCROLL_WHEEL_DRAG */
|
||||||
|
/* to GX_STATUS_TRACKING_PEN, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static UINT _gx_text_scroll_wheel_row_draw(GX_TEXT_SCROLL_WHEEL *wheel, GX_RECTANGLE *selected_area, GX_RECTANGLE *draw_area, GX_CONST GX_STRING *string)
|
static UINT _gx_text_scroll_wheel_row_draw(GX_TEXT_SCROLL_WHEEL *wheel, GX_RECTANGLE *selected_area, GX_RECTANGLE *draw_area, GX_CONST GX_STRING *string)
|
||||||
@ -342,7 +347,7 @@ UINT (*text_draw)(GX_TEXT_SCROLL_WHEEL *wheel, GX_RESOURCE_ID tColor,
|
|||||||
text_draw = _gx_text_scroll_wheel_flat_text_draw;
|
text_draw = _gx_text_scroll_wheel_flat_text_draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((wheel -> gx_widget_style & GX_STYLE_SCROLL_WHEEL_DRAG) ||
|
if ((wheel -> gx_widget_status & GX_STATUS_TRACKING_PEN) ||
|
||||||
(wheel -> gx_scroll_wheel_animation_steps != 0) ||
|
(wheel -> gx_scroll_wheel_animation_steps != 0) ||
|
||||||
(!_gx_utility_rectangle_compare(selected_area, draw_area)))
|
(!_gx_utility_rectangle_compare(selected_area, draw_area)))
|
||||||
{
|
{
|
||||||
|
154
ports/generic/inc/gx_port.h
Normal file
154
ports/generic/inc/gx_port.h
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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 */
|
||||||
|
/** */
|
||||||
|
/** Port Specific */
|
||||||
|
/** */
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* gx_api.h Generic */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This file contains data type definitions and constants that work */
|
||||||
|
/* generically on most compiler and processor architectures. */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef GX_PORT_H
|
||||||
|
#define GX_PORT_H
|
||||||
|
|
||||||
|
/* Determine if the optional GUIX user define file should be used. */
|
||||||
|
|
||||||
|
#ifdef GX_INCLUDE_USER_DEFINE_FILE
|
||||||
|
|
||||||
|
/* Include the user defines in gx_user.h. The defines in this file may
|
||||||
|
alternately be defined on the command line. */
|
||||||
|
|
||||||
|
#include "gx_user.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef INT GX_BOOL;
|
||||||
|
typedef SHORT GX_VALUE;
|
||||||
|
|
||||||
|
#define GX_VALUE_MAX 0x7FFF
|
||||||
|
|
||||||
|
|
||||||
|
/* Define the basic system parameters. */
|
||||||
|
|
||||||
|
#ifndef GX_THREAD_STACK_SIZE
|
||||||
|
#define GX_THREAD_STACK_SIZE 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GX_TICKS_SECOND
|
||||||
|
#define GX_TICKS_SECOND 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GX_CONST const
|
||||||
|
|
||||||
|
#define GX_INCLUDE_DEFAULT_COLORS
|
||||||
|
|
||||||
|
#define GX_MAX_ACTIVE_TIMERS 32
|
||||||
|
|
||||||
|
#define GX_SYSTEM_TIMER_TICKS 2 /* 20 ms */
|
||||||
|
|
||||||
|
#define GX_MAX_VIEWS 32
|
||||||
|
|
||||||
|
#define GX_MAX_DISPLAY_HEIGHT 800
|
||||||
|
|
||||||
|
|
||||||
|
/* Define several macros for the error checking shell in GUIX. */
|
||||||
|
|
||||||
|
#ifdef GX_DISABLE_THREADX_BINDING
|
||||||
|
|
||||||
|
/* Here if not running with ThreadX RTOS */
|
||||||
|
#define GX_CALLER_CHECKING_EXTERNS
|
||||||
|
#define GX_THREADS_ONLY_CALLER_CHECKING
|
||||||
|
#define GX_INIT_AND_THREADS_CALLER_CHECKING
|
||||||
|
#define GX_NOT_ISR_CALLER_CHECKING
|
||||||
|
#define GX_THREAD_WAIT_CALLER_CHECKING
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifdef TX_TIMER_PROCESS_IN_ISR
|
||||||
|
#define GX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
|
||||||
|
extern volatile ULONG _tx_thread_system_state;
|
||||||
|
|
||||||
|
#define GX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
|
||||||
|
(_tx_thread_current_ptr == TX_NULL)) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#define GX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0)))) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#define GX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0))) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#define GX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
|
||||||
|
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define GX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
|
||||||
|
extern TX_THREAD _tx_timer_thread; \
|
||||||
|
extern volatile ULONG _tx_thread_system_state;
|
||||||
|
|
||||||
|
#define GX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
|
||||||
|
(_tx_thread_current_ptr == TX_NULL) || \
|
||||||
|
(_tx_thread_current_ptr == &_tx_timer_thread)) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#define GX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0))) || \
|
||||||
|
(_tx_thread_current_ptr == &_tx_timer_thread)) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
|
||||||
|
#define GX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0))) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#define GX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
|
||||||
|
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
|
||||||
|
return(GX_CALLER_ERROR);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define the version ID of GUIX. This may be utilized by the application. */
|
||||||
|
|
||||||
|
#ifdef GX_SYSTEM_INIT
|
||||||
|
CHAR _gx_version_id[] =
|
||||||
|
"Copyright (c) Microsoft Corporation. All rights reserved. * GUIX Version 6.x *";
|
||||||
|
#else
|
||||||
|
extern CHAR _gx_version_id[];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -53,6 +53,26 @@
|
|||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_16bpp_rotated_simple_line_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_16bpp_rotated_simple_line_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_16bpp_rotated_vertical_line_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_16bpp_rotated_vertical_line_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_16bpp_rotated_vertical_pattern_line_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_16bpp_rotated_vertical_pattern_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_24xrgb_rotated_canvas_blend.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_24xrgb_rotated_jpeg_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_24xrgb_rotated_pixel_blend.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_24xrgb_rotated_png_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_24xrgb_rotated_setup.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32argb_rotated_pixel_blend.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32argb_rotated_setup.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_block_move.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_canvas_copy.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_glyph_1bit_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_horizontal_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_horizontal_pattern_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_horizontal_pixelmap_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_pixelmap_blend.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_pixelmap_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_pixelmap_rotate.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_pixel_write.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_simple_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_vertical_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_32bpp_rotated_vertical_pattern_line_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_canvas_blend.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_canvas_blend.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_glyph_1bit_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_glyph_1bit_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_horizontal_pixelmap_line_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_horizontal_pixelmap_line_draw.c" />
|
||||||
@ -60,6 +80,21 @@
|
|||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_pixel_blend.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_pixel_blend.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_png_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_png_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_setup.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_565rgb_rotated_setup.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bit_palette_rotated_setup.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_block_move.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_canvas_copy.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_glyph_1bit_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_glyph_3bit_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_glyph_4bit_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_horizontal_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_horizontal_pattern_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_horizontal_pixelmap_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_pixelmap_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_pixelmap_rotate.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_pixel_write.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_simple_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_vertical_line_draw.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_8bpp_rotated_vertical_pattern_line_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_generic_rotated_alphamap_draw.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_generic_rotated_alphamap_draw.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_generic_rotated_arc_fill.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_generic_rotated_arc_fill.c" />
|
||||||
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_generic_rotated_circle_fill.c" />
|
<ClCompile Include="..\..\..\..\common\src\gx_display_driver_generic_rotated_circle_fill.c" />
|
||||||
@ -1295,7 +1330,9 @@
|
|||||||
<ClCompile Include="..\..\src\gx_win32_display_driver.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_1555xrgb.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_1555xrgb.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_24xrgb.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_24xrgb.c" />
|
||||||
|
<ClCompile Include="..\..\src\gx_win32_display_driver_24xrgb_rotated.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_32argb.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_32argb.c" />
|
||||||
|
<ClCompile Include="..\..\src\gx_win32_display_driver_32argb_rotated.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_332rgb.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_332rgb.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_4444argb.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_4444argb.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_4bpp_grayscale.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_4bpp_grayscale.c" />
|
||||||
@ -1303,6 +1340,7 @@
|
|||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_565rgb.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_565rgb.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_565rgb_rotated.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_565rgb_rotated.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_8bit_palette.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_8bit_palette.c" />
|
||||||
|
<ClCompile Include="..\..\src\gx_win32_display_driver_8bit_palette_rotated.c" />
|
||||||
<ClCompile Include="..\..\src\gx_win32_display_driver_monochrome.c" />
|
<ClCompile Include="..\..\src\gx_win32_display_driver_monochrome.c" />
|
||||||
<ClCompile Include="..\..\src\st\gx_chromart_simulation_display_driver_565rgb_pixelmap_draw.c" />
|
<ClCompile Include="..\..\src\st\gx_chromart_simulation_display_driver_565rgb_pixelmap_draw.c" />
|
||||||
<ClCompile Include="..\..\src\st\gx_chromart_simulation_display_driver_565rgb_setup.c" />
|
<ClCompile Include="..\..\src\st\gx_chromart_simulation_display_driver_565rgb_setup.c" />
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
/* COMPONENT DEFINITION RELEASE */
|
/* COMPONENT DEFINITION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* gx_win32_driver.h PORTABLE C */
|
/* gx_win32_driver.h PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -40,6 +40,10 @@
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* added 8bpp/24bpp rotated */
|
||||||
|
/* display driver declarations,*/
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
@ -85,20 +89,22 @@ typedef struct GX_WIN32_DISPLAY_DRIVER_STRUCT
|
|||||||
UINT win32_graphics_driver_setup_monochrome(GX_DISPLAY *display);
|
UINT win32_graphics_driver_setup_monochrome(GX_DISPLAY *display);
|
||||||
UINT win32_graphics_driver_setup_4bpp_grayscale(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_8bit_palette(GX_DISPLAY *display);
|
||||||
|
UINT win32_graphics_driver_setup_8bit_palette_rotated(GX_DISPLAY* display);
|
||||||
UINT win32_graphics_driver_setup_565rgb(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_565rgb_rotated(GX_DISPLAY *display);
|
||||||
UINT win32_graphics_driver_setup_565bgr(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_1555xrgb(GX_DISPLAY *display);
|
||||||
UINT win32_graphics_driver_setup_4444argb(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_24xrgb(GX_DISPLAY *display);
|
||||||
|
UINT win32_graphics_driver_setup_24xrgb_rotated(GX_DISPLAY *display);
|
||||||
UINT win32_graphics_driver_setup_32argb(GX_DISPLAY *display);
|
UINT win32_graphics_driver_setup_32argb(GX_DISPLAY *display);
|
||||||
|
UINT win32_graphics_driver_setup_32argb_rotated(GX_DISPLAY *display);
|
||||||
|
|
||||||
UINT win32_chromeart_graphics_driver_setup_565rgb(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 win32_32bpp_bitmap_header_create(GX_DISPLAY *display);
|
||||||
|
VOID win32_display_driver_8bit_palette_set(GX_DISPLAY *display, GX_COLOR *palette, INT count);
|
||||||
|
VOID win32_8bit_palette_bitmap_header_create(GX_DISPLAY *display);
|
||||||
void gx_win32_display_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
|
void gx_win32_display_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
|
||||||
void gx_win32_driver_thread_entry(ULONG thread_input);
|
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);
|
HWND gx_win32_window_create(GX_WIN32_DISPLAY_DRIVER_DATA *gx_driver_ptr, WNDPROC gx_win32_event_process, INT xpos, INT ypos);
|
||||||
|
@ -615,6 +615,95 @@ int index;
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* gx_win32_rotate_canvas_to_bmp_32bpp PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function prepare canvas memory at which do draw operation. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* winHandle Win32 handle */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* win32_canvas_memory_prepare */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static void gx_win32_rotate_canvas_to_bmp_32bpp(GX_CANVAS *canvas)
|
||||||
|
{
|
||||||
|
/* First pass, just copy the entire canvas, ignoring the dirty
|
||||||
|
rectangle. Come back and apply dirty rectangle to improve
|
||||||
|
efficiency. */
|
||||||
|
|
||||||
|
ULONG *pReadStart;
|
||||||
|
ULONG *pWriteStart;
|
||||||
|
ULONG *pRead;
|
||||||
|
ULONG *pWrite;
|
||||||
|
INT copy_width;
|
||||||
|
INT copy_height;
|
||||||
|
INT row;
|
||||||
|
INT column;
|
||||||
|
INT write_sign;
|
||||||
|
|
||||||
|
/* Copy left-to-right from source canvas
|
||||||
|
and top-to-bottom in destination bitmap (90 degree rotation)
|
||||||
|
and bottom-to-top in destination bitmap (270 degree rotation). */
|
||||||
|
|
||||||
|
pReadStart = (ULONG *)canvas -> gx_canvas_memory;
|
||||||
|
pWriteStart = (ULONG *)canvas -> gx_canvas_padded_memory;
|
||||||
|
copy_width = canvas -> gx_canvas_y_resolution;
|
||||||
|
copy_height = canvas -> gx_canvas_x_resolution;
|
||||||
|
|
||||||
|
if (canvas -> gx_canvas_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
pWriteStart += copy_height - 1;
|
||||||
|
write_sign = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Here for 270 degree rotation. */
|
||||||
|
pWriteStart += (copy_width - 1) * copy_height;
|
||||||
|
write_sign = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (row = 0; row < copy_height; row++)
|
||||||
|
{
|
||||||
|
pRead = pReadStart;
|
||||||
|
pWrite = pWriteStart;
|
||||||
|
|
||||||
|
for (column = 0; column < copy_width; column++)
|
||||||
|
{
|
||||||
|
*pWrite = *pRead++;
|
||||||
|
pWrite -= copy_height * write_sign;
|
||||||
|
}
|
||||||
|
pReadStart += copy_width;
|
||||||
|
pWriteStart += write_sign;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
@ -649,7 +738,8 @@ int index;
|
|||||||
/* */
|
/* */
|
||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial version x.x */
|
/* 12-31-2020 Kenneth Maxwell Initial version 6.1.3 */
|
||||||
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static void gx_win32_rotate_canvas_to_bmp_16bpp(GX_CANVAS *canvas)
|
static void gx_win32_rotate_canvas_to_bmp_16bpp(GX_CANVAS *canvas)
|
||||||
{
|
{
|
||||||
@ -708,12 +798,107 @@ INT write_stride;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* gx_win32_rotate_canvas_to_bmp_8bpp PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function prepare canvas memory at which do draw operation. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* winHandle Win32 handle */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* None */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* win32_canvas_memory_prepare */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
static void gx_win32_rotate_canvas_to_bmp_8bpp(GX_CANVAS *canvas)
|
||||||
|
{
|
||||||
|
/* first pass, just copy the entire canvas, ignoring the dirty
|
||||||
|
rectangle. Come back and apply dirty rectangle to improve
|
||||||
|
efficiency.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GX_UBYTE *pReadStart;
|
||||||
|
GX_UBYTE *pWriteStart;
|
||||||
|
GX_UBYTE *pRead;
|
||||||
|
GX_UBYTE *pWrite;
|
||||||
|
INT copy_width;
|
||||||
|
INT copy_height;
|
||||||
|
INT row;
|
||||||
|
INT column;
|
||||||
|
INT write_sign;
|
||||||
|
INT write_stride;
|
||||||
|
|
||||||
|
/* copy left-to-right from source canvas
|
||||||
|
and top-to-bottom in destination bitmap (90 degree rotation)
|
||||||
|
and bottom-to-top in destination bitmap (270 degree rotation)
|
||||||
|
*/
|
||||||
|
|
||||||
|
pReadStart = (GX_UBYTE *)canvas -> gx_canvas_memory;
|
||||||
|
pWriteStart = (GX_UBYTE *)canvas -> gx_canvas_padded_memory;
|
||||||
|
copy_width = canvas -> gx_canvas_y_resolution;
|
||||||
|
copy_height = canvas -> gx_canvas_x_resolution;
|
||||||
|
|
||||||
|
write_stride = (copy_height + 1) & 0xfffc;
|
||||||
|
|
||||||
|
if (canvas -> gx_canvas_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
|
||||||
|
{
|
||||||
|
pWriteStart += copy_height - 1;
|
||||||
|
write_sign = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Here for 270 degree rotation. */
|
||||||
|
pWriteStart += (copy_width - 1) * write_stride;
|
||||||
|
write_sign = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (row = 0; row < copy_height; row++)
|
||||||
|
{
|
||||||
|
pRead = pReadStart;
|
||||||
|
pWrite = pWriteStart;
|
||||||
|
|
||||||
|
for (column = 0; column < copy_width; column++)
|
||||||
|
{
|
||||||
|
*pWrite = *pRead++;
|
||||||
|
pWrite -= write_stride * write_sign;
|
||||||
|
}
|
||||||
|
pReadStart += copy_width;
|
||||||
|
pWriteStart += write_sign;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* _win32_canvas_memory_prepare PORTABLE C */
|
/* _win32_canvas_memory_prepare PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -743,6 +928,10 @@ INT write_stride;
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* added 8bpp and 32bpp canvas */
|
||||||
|
/* rotate logic, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
VOID *_win32_canvas_memory_prepare(GX_CANVAS *canvas, GX_RECTANGLE *dirty)
|
VOID *_win32_canvas_memory_prepare(GX_CANVAS *canvas, GX_RECTANGLE *dirty)
|
||||||
@ -797,11 +986,22 @@ INT row;
|
|||||||
{
|
{
|
||||||
switch (display -> gx_display_color_format)
|
switch (display -> gx_display_color_format)
|
||||||
{
|
{
|
||||||
|
case GX_COLOR_FORMAT_24XRGB:
|
||||||
|
case GX_COLOR_FORMAT_32ARGB:
|
||||||
|
gx_win32_rotate_canvas_to_bmp_32bpp(canvas);
|
||||||
|
memptr = canvas -> gx_canvas_padded_memory;
|
||||||
|
break;
|
||||||
|
|
||||||
case GX_COLOR_FORMAT_565RGB:
|
case GX_COLOR_FORMAT_565RGB:
|
||||||
gx_win32_rotate_canvas_to_bmp_16bpp(canvas);
|
gx_win32_rotate_canvas_to_bmp_16bpp(canvas);
|
||||||
memptr = canvas -> gx_canvas_padded_memory;
|
memptr = canvas -> gx_canvas_padded_memory;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GX_COLOR_FORMAT_8BIT_PALETTE:
|
||||||
|
gx_win32_rotate_canvas_to_bmp_8bpp(canvas);
|
||||||
|
memptr = canvas -> gx_canvas_padded_memory;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return canvas -> gx_canvas_memory;
|
return canvas -> gx_canvas_memory;
|
||||||
}
|
}
|
||||||
@ -815,7 +1015,7 @@ INT row;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* gx_win32_display_buffer_toggle PORTABLE C */
|
/* gx_win32_display_buffer_toggle PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -851,6 +1051,9 @@ INT row;
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* fixed logic, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
VOID gx_win32_display_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty)
|
VOID gx_win32_display_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty)
|
||||||
@ -894,6 +1097,9 @@ VOID *memptr;
|
|||||||
{
|
{
|
||||||
memptr = _win32_canvas_memory_prepare(canvas, &Copy);
|
memptr = _win32_canvas_memory_prepare(canvas, &Copy);
|
||||||
|
|
||||||
|
INT xsrc = Copy.gx_rectangle_left;
|
||||||
|
INT ysrc = Copy.gx_rectangle_top;
|
||||||
|
|
||||||
gx_utility_rectangle_shift(&Copy, canvas -> gx_canvas_display_offset_x, canvas -> gx_canvas_display_offset_y);
|
gx_utility_rectangle_shift(&Copy, canvas -> gx_canvas_display_offset_x, canvas -> gx_canvas_display_offset_y);
|
||||||
|
|
||||||
win_device = GetDC(driver_instance -> win32_driver_winhandle);
|
win_device = GetDC(driver_instance -> win32_driver_winhandle);
|
||||||
@ -908,8 +1114,8 @@ VOID *memptr;
|
|||||||
Height = Copy.gx_rectangle_bottom - Copy.gx_rectangle_top + 1;
|
Height = Copy.gx_rectangle_bottom - Copy.gx_rectangle_top + 1;
|
||||||
|
|
||||||
StretchDIBits(win_device, Left, Top, Width, Height,
|
StretchDIBits(win_device, Left, Top, Width, Height,
|
||||||
Copy.gx_rectangle_left,
|
xsrc,
|
||||||
Copy.gx_rectangle_top + Height + 1,
|
ysrc + Height + 1,
|
||||||
Width, -Height, memptr,
|
Width, -Height, memptr,
|
||||||
(BITMAPINFO *)&(driver_instance -> win32_driver_bmpinfo),
|
(BITMAPINFO *)&(driver_instance -> win32_driver_bmpinfo),
|
||||||
DIB_RGB_COLORS,
|
DIB_RGB_COLORS,
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* win32_24xrgb_bitmap_header_create PORTABLE C */
|
/* win32_24xrgb_bitmap_header_create PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -61,9 +61,12 @@
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* Renamed function, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static void win32_24xrgb_bitmap_header_create(GX_DISPLAY *display)
|
VOID win32_32bpp_bitmap_header_create(GX_DISPLAY *display)
|
||||||
{
|
{
|
||||||
GX_WIN32_DISPLAY_DRIVER_DATA *instance;
|
GX_WIN32_DISPLAY_DRIVER_DATA *instance;
|
||||||
DWORD *putmask;
|
DWORD *putmask;
|
||||||
@ -93,7 +96,7 @@ DWORD *putmask;
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* win32_graphics_driver_setup_24xrgb PORTABLE C */
|
/* win32_graphics_driver_setup_24xrgb PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -126,6 +129,9 @@ DWORD *putmask;
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* Updated function name, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *display)
|
UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *display)
|
||||||
@ -156,7 +162,7 @@ GX_WIN32_DISPLAY_DRIVER_DATA *data;
|
|||||||
GX_WIN32_EVENT_THREAD_CREATE(data, "GUI-WIN32-24xrgb");
|
GX_WIN32_EVENT_THREAD_CREATE(data, "GUI-WIN32-24xrgb");
|
||||||
|
|
||||||
/* Create bitmap header for 24xrgb display driver. */
|
/* Create bitmap header for 24xrgb display driver. */
|
||||||
win32_24xrgb_bitmap_header_create(display);
|
win32_32bpp_bitmap_header_create(display);
|
||||||
|
|
||||||
return(GX_SUCCESS);
|
return(GX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
103
ports/win32/src/gx_win32_display_driver_24xrgb_rotated.c
Normal file
103
ports/win32/src/gx_win32_display_driver_24xrgb_rotated.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_graphics_driver_setup_24xrgb_rotated PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function creates a Windows specific 24xrgb rotated 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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
UINT win32_graphics_driver_setup_24xrgb_rotated(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_rotated_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_32bpp_bitmap_header_create(display);
|
||||||
|
|
||||||
|
return(GX_SUCCESS);
|
||||||
|
}
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
@ -26,74 +26,12 @@
|
|||||||
#include "gx_display.h"
|
#include "gx_display.h"
|
||||||
#include "gx_win32_display_driver.h"
|
#include "gx_win32_display_driver.h"
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* FUNCTION RELEASE */
|
|
||||||
/* */
|
|
||||||
/* win32_32argb_bitmap_header_create PORTABLE C */
|
|
||||||
/* 6.1.3 */
|
|
||||||
/* AUTHOR */
|
|
||||||
/* */
|
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
|
||||||
/* */
|
|
||||||
/* DESCRIPTION */
|
|
||||||
/* */
|
|
||||||
/* This function creates bitmap header for 32argb driver. */
|
|
||||||
/* */
|
|
||||||
/* INPUT */
|
|
||||||
/* */
|
|
||||||
/* display Pointer to GX_DISPLAY */
|
|
||||||
/* */
|
|
||||||
/* OUTPUT */
|
|
||||||
/* */
|
|
||||||
/* None */
|
|
||||||
/* */
|
|
||||||
/* CALLS */
|
|
||||||
/* */
|
|
||||||
/* None */
|
|
||||||
/* */
|
|
||||||
/* CALLED BY */
|
|
||||||
/* */
|
|
||||||
/* win32_graphics_driver_setup_32argb */
|
|
||||||
/* */
|
|
||||||
/* RELEASE HISTORY */
|
|
||||||
/* */
|
|
||||||
/* DATE NAME DESCRIPTION */
|
|
||||||
/* */
|
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
|
||||||
/* */
|
|
||||||
/**************************************************************************/
|
|
||||||
static void win32_32argb_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 */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* win32_graphics_driver_setup_32argb PORTABLE C */
|
/* win32_graphics_driver_setup_32argb PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -113,7 +51,7 @@ DWORD *putmask;
|
|||||||
/* CALLS */
|
/* CALLS */
|
||||||
/* */
|
/* */
|
||||||
/* _gx_display_driver_32argb_setup guix display setup funciton. */
|
/* _gx_display_driver_32argb_setup guix display setup funciton. */
|
||||||
/* win32_32argb_bitmap_header_create Create bitmap header info */
|
/* win32_32bpp_bitmap_header_create Create bitmap header info */
|
||||||
/* gx_win32_get_free_data_instance Get display data instance */
|
/* gx_win32_get_free_data_instance Get display data instance */
|
||||||
/* GX_WIN32_EVENT_THREAD_CREATE Create event thread */
|
/* GX_WIN32_EVENT_THREAD_CREATE Create event thread */
|
||||||
/* */
|
/* */
|
||||||
@ -126,6 +64,10 @@ DWORD *putmask;
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* Updated bitmap header */
|
||||||
|
/* create function call, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
UINT win32_graphics_driver_setup_32argb(GX_DISPLAY *display)
|
UINT win32_graphics_driver_setup_32argb(GX_DISPLAY *display)
|
||||||
@ -156,57 +98,8 @@ GX_WIN32_DISPLAY_DRIVER_DATA *data;
|
|||||||
GX_WIN32_EVENT_THREAD_CREATE(data, "GUI-WIN32-32argb");
|
GX_WIN32_EVENT_THREAD_CREATE(data, "GUI-WIN32-32argb");
|
||||||
|
|
||||||
/* Create bitmap header for 32argb display driver. */
|
/* Create bitmap header for 32argb display driver. */
|
||||||
win32_32argb_bitmap_header_create(display);
|
win32_32bpp_bitmap_header_create(display);
|
||||||
return(GX_SUCCESS);
|
return(GX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* FUNCTION RELEASE */
|
|
||||||
/* */
|
|
||||||
/* win32_graphics_driver_cleanup_32argb PORTABLE C */
|
|
||||||
/* 6.1.3 */
|
|
||||||
/* AUTHOR */
|
|
||||||
/* */
|
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
|
||||||
/* */
|
|
||||||
/* DESCRIPTION */
|
|
||||||
/* */
|
|
||||||
/* This function do cleanup operation for specific 32argb display */
|
|
||||||
/* driver. */
|
|
||||||
/* */
|
|
||||||
/* INPUT */
|
|
||||||
/* */
|
|
||||||
/* display Pointer to GX_DISPLAY */
|
|
||||||
/* */
|
|
||||||
/* OUTPUT */
|
|
||||||
/* */
|
|
||||||
/* None */
|
|
||||||
/* */
|
|
||||||
/* CALLS */
|
|
||||||
/* */
|
|
||||||
/* None */
|
|
||||||
/* */
|
|
||||||
/* CALLED BY */
|
|
||||||
/* */
|
|
||||||
/* guix_studio_delete_display */
|
|
||||||
/* */
|
|
||||||
/* RELEASE HISTORY */
|
|
||||||
/* */
|
|
||||||
/* DATE NAME DESCRIPTION */
|
|
||||||
/* */
|
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
|
||||||
/* */
|
|
||||||
/**************************************************************************/
|
|
||||||
VOID win32_graphics_driver_cleanup_32argb(GX_DISPLAY *display)
|
|
||||||
{
|
|
||||||
GX_WIN32_DISPLAY_DRIVER_DATA *instance;
|
|
||||||
|
|
||||||
instance = (GX_WIN32_DISPLAY_DRIVER_DATA *)display -> gx_display_driver_data;
|
|
||||||
|
|
||||||
/* mark this instance as not used: */
|
|
||||||
instance -> win32_driver_type = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
103
ports/win32/src/gx_win32_display_driver_32argb_rotated.c
Normal file
103
ports/win32/src/gx_win32_display_driver_32argb_rotated.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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 "windows.h"
|
||||||
|
#include "tx_api.h"
|
||||||
|
#include "gx_api.h"
|
||||||
|
#include "gx_system.h"
|
||||||
|
#include "gx_display.h"
|
||||||
|
#include "gx_win32_display_driver.h"
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FUNCTION RELEASE */
|
||||||
|
/* */
|
||||||
|
/* win32_graphics_driver_setup_32argb_rotated PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function creates a Windows specific 32argb display driver. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* display Pointer to GX_DISPLAY */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* status Completion status */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_32argb_rotated_setup */
|
||||||
|
/* guix display setup funciton. */
|
||||||
|
/* win32_32bpp_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 */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
UINT win32_graphics_driver_setup_32argb_rotated(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_32ARGB;
|
||||||
|
|
||||||
|
_gx_display_driver_32argb_rotated_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-32argb");
|
||||||
|
|
||||||
|
/* Create bitmap header for 32argb display driver. */
|
||||||
|
win32_32bpp_bitmap_header_create(display);
|
||||||
|
return(GX_SUCCESS);
|
||||||
|
}
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
@ -31,7 +31,7 @@
|
|||||||
/* FUNCTION RELEASE */
|
/* FUNCTION RELEASE */
|
||||||
/* */
|
/* */
|
||||||
/* win32_display_driver_8bit_palette_set PORTABLE C */
|
/* win32_display_driver_8bit_palette_set PORTABLE C */
|
||||||
/* 6.1.3 */
|
/* 6.1.4 */
|
||||||
/* AUTHOR */
|
/* AUTHOR */
|
||||||
/* */
|
/* */
|
||||||
/* Kenneth Maxwell, Microsoft Corporation */
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
@ -63,9 +63,12 @@
|
|||||||
/* DATE NAME DESCRIPTION */
|
/* DATE NAME DESCRIPTION */
|
||||||
/* */
|
/* */
|
||||||
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
/* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Modified comment(s), */
|
||||||
|
/* made the function public, */
|
||||||
|
/* resulting in version 6.1.4 */
|
||||||
/* */
|
/* */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static VOID win32_display_driver_8bit_palette_set(GX_DISPLAY *display, GX_COLOR *palette, INT count)
|
VOID win32_display_driver_8bit_palette_set(GX_DISPLAY *display, GX_COLOR *palette, INT count)
|
||||||
{
|
{
|
||||||
GX_COLOR color;
|
GX_COLOR color;
|
||||||
int loop;
|
int loop;
|
||||||
|
107
ports/win32/src/gx_win32_display_driver_8bit_palette_rotated.c
Normal file
107
ports/win32/src/gx_win32_display_driver_8bit_palette_rotated.c
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* 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_graphics_driver_setup_8bit_palette_rotated PORTABLE C */
|
||||||
|
/* 6.1.4 */
|
||||||
|
/* AUTHOR */
|
||||||
|
/* */
|
||||||
|
/* Kenneth Maxwell, Microsoft Corporation */
|
||||||
|
/* */
|
||||||
|
/* DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* This function creates a Windows specific 8bpp display driver. */
|
||||||
|
/* */
|
||||||
|
/* INPUT */
|
||||||
|
/* */
|
||||||
|
/* display Pointer to GX_DISPLAY */
|
||||||
|
/* */
|
||||||
|
/* OUTPUT */
|
||||||
|
/* */
|
||||||
|
/* status Completion status */
|
||||||
|
/* */
|
||||||
|
/* CALLS */
|
||||||
|
/* */
|
||||||
|
/* _gx_display_driver_8bit_palette_setup guix display setup funciton. */
|
||||||
|
/* win32_8bit_palette_bitmap_header_create */
|
||||||
|
/* Create bitmap header info */
|
||||||
|
/* gx_win32_get_free_data_instance Get display data instance */
|
||||||
|
/* [gx_display_driver_palette_set] Set palette table for 8bpp */
|
||||||
|
/* GX_WIN32_EVENT_THREAD_CREATE Create event thread */
|
||||||
|
/* */
|
||||||
|
/* CALLED BY */
|
||||||
|
/* */
|
||||||
|
/* Application Code */
|
||||||
|
/* */
|
||||||
|
/* RELEASE HISTORY */
|
||||||
|
/* */
|
||||||
|
/* DATE NAME DESCRIPTION */
|
||||||
|
/* */
|
||||||
|
/* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
|
||||||
|
/* */
|
||||||
|
/**************************************************************************/
|
||||||
|
UINT win32_graphics_driver_setup_8bit_palette_rotated(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_8BIT_PALETTE;
|
||||||
|
|
||||||
|
|
||||||
|
_gx_display_driver_8bit_palette_rotated_setup(display, data, gx_win32_display_buffer_toggle);
|
||||||
|
display->gx_display_driver_palette_set = win32_display_driver_8bit_palette_set;
|
||||||
|
|
||||||
|
/* 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-8bit-palette");
|
||||||
|
|
||||||
|
/* Create bitmap header for 8bit palette driver. */
|
||||||
|
win32_8bit_palette_bitmap_header_create(display);
|
||||||
|
|
||||||
|
return(GX_SUCCESS);
|
||||||
|
}
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
@ -33,8 +33,6 @@ extern GX_SCROLLBAR_APPEARANCE Window_Screen_Vertical_Scroll_properties;
|
|||||||
void ToggleScreen(GX_WINDOW *new_win, GX_WINDOW *old_win);
|
void ToggleScreen(GX_WINDOW *new_win, GX_WINDOW *old_win);
|
||||||
UINT string_length_get(GX_CONST GX_CHAR* input_string, UINT max_string_length);
|
UINT string_length_get(GX_CONST GX_CHAR* input_string, UINT max_string_length);
|
||||||
|
|
||||||
TX_THREAD demo_thread;
|
|
||||||
UCHAR demo_thread_stack[4096];
|
|
||||||
TX_BYTE_POOL rotate_pool;
|
TX_BYTE_POOL rotate_pool;
|
||||||
GX_WINDOW_ROOT *root;
|
GX_WINDOW_ROOT *root;
|
||||||
GX_SCROLLBAR list_scroll;
|
GX_SCROLLBAR list_scroll;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user