1 /**************************************************************************** 2 * 3 * The MIT License (MIT) 4 * 5 * Copyright 2020 NXP 6 * All Rights Reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining 9 * a copy of this software and associated documentation files (the 10 * 'Software'), to deal in the Software without restriction, including 11 * without limitation the rights to use, copy, modify, merge, publish, 12 * distribute, sub license, and/or sell copies of the Software, and to 13 * permit persons to whom the Software is furnished to do so, subject 14 * to the following conditions: 15 * 16 * The above copyright notice and this permission notice (including the 17 * next paragraph) shall be included in all copies or substantial 18 * portions of the Software. 19 * 20 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 23 * IN NO EVENT SHALL VIVANTE AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 24 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 * 28 *****************************************************************************/ 29 30 //#define ENABLE_DEBUG_TRACE 31 32 #ifdef ENABLE_DEBUG_TRACE 33 /* With debug configuration */ 34 35 /* Macros */ 36 #define TRACE_DBG(x) printf x 37 #define TRACE_BIN(x) // printf x /* Tracer for binary layout */ 38 #define TRACE_WRN(x) printf x 39 #define TRACE_INFO(x) printf x 40 #define TRACE_ERR(x) printf x 41 #define DBG_ARY(obj, param, count) \ 42 dbg_float_ary(#param, &obj->param[0], count, &g_offset); 43 44 #define DBG_INT_ARY(obj, param, count) \ 45 dbg_int_ary(#param, obj->param, count, &g_offset); 46 47 #define DBG_FIELD(obj, param) \ 48 dbg_int_param(#param, obj->param, &g_offset) 49 50 #define DBG_READ_32B(name, value, offset) \ 51 dbg_int_param_no_offset_update(name, value, offset) 52 extern int g_offset; 53 54 #define VFT_DBG_FONT_FACE_DESC(a,b) vft_dbg_font_face_desc(a,b) 55 #define VFT_DBG_GLYPH_TABLE(a,b) vft_dbg_glyph_table(a,b) 56 #define VFT_DBG_KERN_TABLE(a,b) vft_dbg_kern_table(a,b) 57 #define VFT_DBG_PATH_TABLE(a,b) vft_dbg_path_table(a,b) 58 59 static int g_offset = 0; /* Dummy just to solve build errors */ 60 #define DBG_TRACE(x) 61 #define DBG_INC_OFFSET(x) g_offset += (x); 62 #define DBG_OFFSET() (g_offset) 63 64 /* Prorotypes */ 65 void vft_dbg_font_face_desc(font_face_desc_t* font_face, int offset); 66 void vft_dbg_glyph_desc(glyph_desc_t* g, int offset); 67 void vft_dbg_kern_desc(kern_desc_t* kern_desc, int num_kern_entries, int offset); 68 void vfg_dbg_path_data(path_desc_t* path_data_desc, int offset); 69 void vft_dbg_matrix(char *name, vg_lite_matrix_t *mat); 70 void vft_dbg_path_table(font_face_desc_t* font_face, int offset); 71 void vft_dbg_kern_table(font_face_desc_t* font_face, int offset); 72 void vft_dbg_glyph_table(font_face_desc_t* font_face, int offset); 73 74 void dbg_float_ary_no_offset_update(char *name, float *ary, 75 int count, int disk_offset); 76 void dbg_int_ary_no_offset_update(char *name, uint32_t *ary, 77 int count, int disk_offset); 78 void dbg_int_param_no_offset_update(char *name, uint32_t value, int disk_offset); 79 80 #else 81 /** Without -debug configuration */ 82 /* Macros */ 83 #define TRACE_DBG(x) 84 #define TRACE_BIN(x) 85 #define TRACE_WRN(x) printf x 86 #define TRACE_INFO(x) 87 #define TRACE_ERR(x) printf x 88 89 #define DBG_READ_32B(a,b,c) 90 #define DBG_TRACE(x) 91 #define vft_dbg_glyph_desc(g,offset) 92 #define dbg_float_ary_no_offset_update(a, b, c,d) 93 #define dbg_int_ary_no_offset_update(a, b, c,d) 94 #define vft_dbg_path_bounds(a,b,c) 95 #define vft_dbg_path(a,b,c) 96 97 #define VFT_DBG_FONT_FACE_DESC(a,b) 98 #define VFT_DBG_GLYPH_TABLE(a,b) 99 #define VFT_DBG_KERN_TABLE(a,b) 100 #define VFT_DBG_PATH_TABLE(a,b) 101 102 #define DBG_INC_OFFSET(x) 103 #define DBG_OFFSET() (0) 104 105 #endif 106 107 #define TRACE_BIN_FIELD_STR(x) TRACE_BIN(("BIN: %08x: "#x"=%s\n",offset,_desc.x)); 108 #define TRACE_BIN_FIELD_UINT16(x) TRACE_BIN(("BIN: %08x: "#x"=%hu\n",offset,_desc.x)); offset += 2; 109 #define TRACE_BIN_FIELD_UINT32(x) TRACE_BIN(("BIN: %08x: "#x"=%u\n",offset,_desc.x)); offset += 4; 110 #define TRACE_BIN_FIELD_FLOAT(x) TRACE_BIN(("BIN: %08x: "#x"=%f\n",offset,_desc.x)); offset += 4; 111 112