freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master a005039b: * graph/gblblit.c (gblender_blit_init


From: Werner Lemberg
Subject: [freetype2-demos] master a005039b: * graph/gblblit.c (gblender_blit_init): Fix for negative pitch.
Date: Thu, 15 Sep 2022 23:42:55 -0400 (EDT)

branch: master
commit a005039bdad5e5bcae9b8f12448f844eb24b92b6
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * graph/gblblit.c (gblender_blit_init): Fix for negative pitch.
    
    Reported by Anurag Thakur.
---
 graph/gblblit.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/graph/gblblit.c b/graph/gblblit.c
index bc4ba91a..4f7f3587 100644
--- a/graph/gblblit.c
+++ b/graph/gblblit.c
@@ -329,6 +329,11 @@ gblender_blit_init( GBlenderBlit           blit,
     return -2;
   }
 
+  if ( src_pitch < 0 )
+    src_buffer -= src_pitch * ( src_height - 1 );
+  if ( dst_pitch < 0 )
+    dst_buffer -= dst_pitch * ( dst_height - 1 );
+
   if ( dst_x < 0 )
   {
     src_width += dst_x;
@@ -360,14 +365,10 @@ gblender_blit_init( GBlenderBlit           blit,
   blit->height    = src_height;
 
   blit->src_pitch = src_pitch;
-  if ( src_pitch < 0 )
-    src_y -= src_height - 1;
   blit->src_line  = src_buffer + src_pitch * src_y;
   blit->src_x     = src_x;
 
   blit->dst_pitch = dst_pitch;
-  if ( dst_pitch < 0 )
-    dst_y -= dst_height - 1;
   blit->dst_line  = dst_buffer + dst_pitch * dst_y;
   blit->dst_x     = dst_x;
 



reply via email to

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