From: Jean-Philippe Bruyère Date: Wed, 13 Jan 2021 13:08:04 +0000 (+0100) Subject: check if defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) X-Git-Tag: v0.2.0~73 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=49b33fe9bab0f3389ae58eea38b4b5aa5594eb03;p=jp%2Fvkvg.git check if defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) --- diff --git a/src/vkvg_context.c b/src/vkvg_context.c index bc47d44..fbf7cec 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -31,6 +31,7 @@ static vec2 debugLinePoints[1000]; static uint32_t dlpCount = 0; #endif +//todo:this could be used to define a default background static VkClearValue clearValues[3] = { { {{0}} }, { {{1.0f, 0}} }, diff --git a/src/vkvg_device_internal.c b/src/vkvg_device_internal.c index 8fef5bd..f76c94c 100644 --- a/src/vkvg_device_internal.c +++ b/src/vkvg_device_internal.c @@ -56,7 +56,7 @@ void _flush_all_contexes (VkvgDevice dev){ ctx = ctx->pPrev; } } - +//TODO:save/reload cache in user temp directory void _create_pipeline_cache(VkvgDevice dev){ VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO}; @@ -282,7 +282,7 @@ void _setupPipelines(VkvgDevice dev) .pCode = (uint32_t*)vkvg_main_vert_spv, .codeSize = vkvg_main_vert_spv_len }; VK_CHECK_RESULT(vkCreateShaderModule(dev->vkDev, &createInfo, NULL, &modVert)); -#ifdef VKVG_LCD_FONT_FILTER +#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) createInfo.pCode = (uint32_t*)vkvg_main_lcd_frag_spv; createInfo.codeSize = vkvg_main_lcd_frag_spv_len; #else diff --git a/src/vkvg_fonts.c b/src/vkvg_fonts.c index 268a1ce..2255754 100644 --- a/src/vkvg_fonts.c +++ b/src/vkvg_fonts.c @@ -42,7 +42,7 @@ void _init_fonts_cache (VkvgDevice dev){ FT_CHECK_RESULT(FT_Init_FreeType(&cache->library)); -#ifdef VKVG_LCD_FONT_FILTER +#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) FT_CHECK_RESULT(FT_Library_SetLcdFilter (cache->library, FT_LCD_FILTER_LIGHT)); cache->texFormat = FB_COLOR_FORMAT; cache->texPixelSize = 4; @@ -261,7 +261,7 @@ void _flush_chars_to_tex (VkvgDevice dev, _vkvg_font_t* f) { //create a new char entry and put glyph in stagging buffer, ready for upload. _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){ -#ifdef VKVG_LCD_FONT_FILTER +#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) FT_CHECK_RESULT(FT_Load_Glyph(f->face, gindex, FT_LOAD_TARGET_NORMAL)); FT_CHECK_RESULT(FT_Render_Glyph(f->face->glyph, FT_RENDER_MODE_LCD)); #else @@ -273,7 +273,7 @@ _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){ uint8_t* data = dev->fontCache->hostBuff; uint32_t bmpWidth= bmp.width; //real width in pixel of char bitmap -#ifdef VKVG_LCD_FONT_FILTER +#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) bmpWidth /= 3; #endif @@ -286,7 +286,7 @@ _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){ int penX = dev->fontCache->stagingX; for(uint32_t y=0; y #include FT_FREETYPE_H -#ifdef VKVG_LCD_FONT_FILTER +#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) #include #endif diff --git a/src/vkvg_internal.h b/src/vkvg_internal.h index 8ff0177..a7402bd 100644 --- a/src/vkvg_internal.h +++ b/src/vkvg_internal.h @@ -50,8 +50,8 @@ #define PATH_CLOSED_BIT 0x80000000 /* most significant bit of path elmts is closed/open path state */ #define PATH_HAS_CURVES_BIT 0x40000000 /* 2rd most significant bit of path elmts is curved status - * for main path, this indicate that curve datas are present - * for segments, this indicate that the segment is curved or not */ + * for main path, this indicate that curve datas are present. + * For segments, this indicate that the segment is curved or not */ #define PATH_ELT_MASK 0x3FFFFFFF /* Bit mask for fetching path element value */ #define ROUNDF(f, c) (((float)((int)((f) * (c))) / (c))) diff --git a/tests/common/test.c b/tests/common/test.c index f145e7d..c64f002 100644 --- a/tests/common/test.c +++ b/tests/common/test.c @@ -679,4 +679,4 @@ void draw_random_curve (VkvgContext ctx) { float x = truncf((w-z)*rand()/RAND_MAX); float y = truncf((h-v)*rand()/RAND_MAX); vkvg_rectangle(ctx, x, y, z, v); -}*/ \ No newline at end of file +}*/