static uint32_t dlpCount = 0;
#endif
+//todo:this could be used to define a default background
static VkClearValue clearValues[3] = {
{ {{0}} },
{ {{1.0f, 0}} },
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};
.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
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;
//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
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
int penX = dev->fontCache->stagingX;
for(uint32_t y=0; y<bmp.rows; y++) {
for(uint32_t x=0; x<bmpWidth; x++) {
-#ifdef VKVG_LCD_FONT_FILTER
+#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
unsigned char r = bmp.buffer[y * bmp.pitch + x * 3];
unsigned char g = bmp.buffer[y * bmp.pitch + x * 3 + 1];
unsigned char b = bmp.buffer[y * bmp.pitch + x * 3 + 2];
#include <ft2build.h>
#include FT_FREETYPE_H
-#ifdef VKVG_LCD_FONT_FILTER
+#if defined(VKVG_LCD_FONT_FILTER) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
#include <freetype/ftlcdfil.h>
#endif
#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)))
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
+}*/