summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnurag Thakur <anurag105csec21@bpitindia.edu.in>2022-07-12 18:31:20 +0530
committerAnurag Thakur <anurag105csec21@bpitindia.edu.in>2022-10-04 03:16:11 +0530
commit8687c459c09f297df4d96874343960e71045ab14 (patch)
treefa0be924ef96aa367bda0b2919cd78c6059881ab
parent39bcb3a647369a5e8882791121a8c0ba2261f819 (diff)
downloadfreetype2-8687c459c09f297df4d96874343960e71045ab14.tar.gz
Temp fix for upside-down bitmap
-rw-r--r--modules.cfg2
-rw-r--r--src/dense/ftdense.c18
2 files changed, 19 insertions, 1 deletions
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;
}