freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] gsoc-anurag-2022 3b233936c 12/18: Temp fix for upside-down b


From: Werner Lemberg
Subject: [freetype2] gsoc-anurag-2022 3b233936c 12/18: Temp fix for upside-down bitmap
Date: Thu, 11 Aug 2022 04:28:55 -0400 (EDT)

branch: gsoc-anurag-2022
commit 3b233936c7e26e29763e34a8ad64fa8872501862
Author: Anurag Thakur <anurag105csec21@bpitindia.edu.in>
Commit: Anurag Thakur <anurag105csec21@bpitindia.edu.in>

    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;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]