show_logo_common.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2010. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. *
  31. * The following software/firmware and/or related documentation ("MediaTek Software")
  32. * have been modified by MediaTek Inc. All revisions are subject to any receiver's
  33. * applicable license agreements with MediaTek Inc.
  34. */
  35. #ifndef _SHOW_LOGO_COMMON_H
  36. #define _SHOW_LOGO_COMMON_H
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #define RGB565_TO_ARGB8888(x) \
  41. ((((x) & 0x1F) << 3) | \
  42. (((x) & 0x7E0) << 5) | \
  43. (((x) & 0xF800) << 8) | \
  44. (0xFF << 24)) // opaque
  45. #define RGB565_TO_ABGR8888(x) \
  46. ((((x) & 0x1F) << 19) | \
  47. (((x) & 0x7E0) << 5) | \
  48. (((x) & 0xF800) >> 8) | \
  49. (0xFF << 24)) // opaque
  50. #define ARGB8888_TO_ABGR8888(x) \
  51. ((((x) & 0xFF) << 16) | \
  52. ((x) & 0xFF00) | \
  53. (((x) & 0xFF0000) >> 16)| \
  54. ((x) & 0xFF000000))
  55. #define ARGB8888_TO_RGB565(x) \
  56. (((((x) >> 19) & 0x1F) << 11)| \
  57. ((((x) >> 10) & 0x3F) << 5)| \
  58. (((x) >> 3) & 0x1F))
  59. #define ARGB8888_TO_BGR565(x) \
  60. ((((x) >> 19) & 0x1F) | \
  61. ((((x) >> 10) & 0x3F) << 5)| \
  62. (((x) >> 3) & 0x1F) << 11)
  63. #define ALIGN_TO(x, n) \
  64. (((x) + ((n) - 1)) & ~((n) - 1))
  65. // define the rectangle parameters
  66. typedef struct {
  67. int left, top, right, bottom;
  68. } RECT_REGION_T;
  69. // dedfine the LCM SCREEM parameters
  70. typedef struct {
  71. int width;
  72. int height;
  73. int bits_per_pixel;
  74. int rotation; // phical screen rotation:0 , 90, 180, 270
  75. int needAllign; // if need adjust the width or height with 32: no need (0), need (1)
  76. int allignWidth;
  77. int need180Adjust; // if need adjust the drawing logo for 180 roration: no need (0), need (1)
  78. int fb_size;
  79. int fill_dst_bits;
  80. int red_offset; // if red_offset is 0: logo use format BGR565 or ABGR8888, red_offset is 11/16: RGB565, ARGB8888
  81. int blue_offset; // if blue_offset is 11/16: logo use format BGR565 or ABGR8888, blue_offset is 0: RGB565, ARGB8888
  82. } LCM_SCREEN_T;
  83. /* internal use function */
  84. int check_rect_valid(RECT_REGION_T rect);
  85. void fill_point_buffer(unsigned int *fill_addr, unsigned int src_color, LCM_SCREEN_T phical_screen, unsigned int bits);
  86. void fill_rect_with_content_by_32bit_argb8888(unsigned int *fill_addr, RECT_REGION_T rect, unsigned int *src_addr, LCM_SCREEN_T phical_screen, unsigned int bits);
  87. void fill_rect_with_content_by_32bit_rgb565(unsigned int *fill_addr, RECT_REGION_T rect, unsigned short *src_addr, LCM_SCREEN_T phical_screen, unsigned int bits);
  88. void fill_rect_with_color_by_32bit(unsigned int *fill_addr, RECT_REGION_T rect, unsigned int src_color, LCM_SCREEN_T phical_screen);
  89. void fill_rect_with_content_by_16bit_argb8888(unsigned short *fill_addr, RECT_REGION_T rect, unsigned int *src_addr, LCM_SCREEN_T phical_screen);
  90. void fill_rect_with_content_by_16bit_rgb565(unsigned short *fill_addr, RECT_REGION_T rect, unsigned short *src_addr, LCM_SCREEN_T phical_screen);
  91. void fill_rect_with_color_by_16bit(unsigned short *fill_addr, RECT_REGION_T rect, unsigned int src_color, LCM_SCREEN_T phical_screen);
  92. /* public interface */
  93. /*
  94. * Draw a rectangle with logo content
  95. *
  96. * @parameter
  97. *
  98. */
  99. void fill_rect_with_content(void *fill_addr, RECT_REGION_T rect, void *src_addr, LCM_SCREEN_T phical_screen, unsigned int bits);
  100. /*
  101. * Draw a rectangle with spcial color
  102. *
  103. * @parameter
  104. *
  105. */
  106. void fill_rect_with_color(void *fill_addr, RECT_REGION_T rect, unsigned int src_color, LCM_SCREEN_T phical_screen);
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif