From 7996f488e561411da6e5b7a0f2562388630d2753 Mon Sep 17 00:00:00 2001 From: Anurag Thakur Date: Tue, 12 Jul 2022 18:31:20 +0530 Subject: [PATCH] Temp fix for upside-down bitmap --- modules.cfg | 2 +- src/dense/ftdense.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/modules.cfg b/modules.cfg index 9aa857061..7b7d32e34 100644 --- a/modules.cfg +++ b/modules.cfg @@ -97,7 +97,7 @@ RASTER_MODULES += dense # Anti-aliasing rasterizer. RASTER_MODULES += smooth -# RASTER_MODULES += dense +#RASTER_MODULES += dense # Monochrome rasterizer. RASTER_MODULES += raster diff --git a/src/dense/ftdense.c b/src/dense/ftdense.c index 763b03dfe..8cffc20e9 100644 --- a/src/dense/ftdense.c +++ b/src/dense/ftdense.c @@ -416,6 +416,12 @@ FT_DEFINE_OUTLINE_FUNCS( dense_decompose_funcs, 0 /* delta */ ) +void swap(unsigned char *a, unsigned char *b){ + unsigned char temp = *a; + *a = *b; + *b = temp; +} + /* @QUES: So, this calls FT_Outline_Decompose, that calls the move to, line to, conic to, cubic to interface methods. The aRasterFP structure stores the well, stuff in its m_a and finally renders it to the target->buffer*/ @@ -476,6 +482,18 @@ dense_render_glyph( RasterFP* aRasterFP, const FT_Bitmap* target ) *dest = 0; dest++; } + + + for (int col = 0; col < aRasterFP->m_w; col++) + { + for (int row = 0; row < aRasterFP->m_h/2; row++) + { + //printf("Swapping position: %d, %d with %d, %d with rows = %d, cols = %d",row,col, aRasterFP->m_h-row, col, aRasterFP->m_h, aRasterFP->m_w); + swap(target->buffer + aRasterFP->m_w*row + col, target->buffer + (aRasterFP->m_h-row-1)*aRasterFP->m_w + col); + } + + } + return error; }