Code

partial fix sent by jfb for bug #188814
authorjucablues <jucablues@users.sourceforge.net>
Sat, 23 Feb 2008 04:27:03 +0000 (04:27 +0000)
committerjucablues <jucablues@users.sourceforge.net>
Sat, 23 Feb 2008 04:27:03 +0000 (04:27 +0000)
src/display/pixblock-scaler.cpp
src/display/pixblock-transform.cpp

index ddb4c4ee2652a5a53f4cb374a9be910f510167cf..5bf3c2762eb7c93884f9cbefb326ab3085d0fe7d 100644 (file)
@@ -17,6 +17,7 @@ using std::floor;
 
 #include "display/nr-filter-utils.h"
 #include "libnr/nr-pixblock.h"
+#include "libnr/nr-blit.h"
 
 namespace NR {
 
@@ -95,6 +96,13 @@ static void scale_bicubic_rgba(NRPixBlock *to, NRPixBlock *from)
         return;
     }
 
+    if (from->mode != to->mode){
+        NRPixBlock *o_from = from;
+        from = new NRPixBlock;
+        nr_pixblock_setup_fast(from, to->mode, o_from->area.x0, o_from->area.y0, o_from->area.x1, o_from->area.y1, false);
+        nr_blit_pixblock_pixblock(from, o_from);
+    }
+
     // Precalculate sizes of source and destination pixblocks
     int from_width = from->area.x1 - from->area.x0;
     int from_height = from->area.y1 - from->area.y0;
index ab9d2e68b9b800ca18510886fd171fada18a00c2..abe0f90c0f9aa86cbb48fb10926f04f8697b9982 100644 (file)
@@ -21,6 +21,7 @@ using std::floor;
 
 #include "display/nr-filter-utils.h"
 
+#include "libnr/nr-blit.h"
 #include "libnr/nr-pixblock.h"
 #include "libnr/nr-matrix.h"
 
@@ -148,6 +149,13 @@ void transform_bicubic(NRPixBlock *to, NRPixBlock *from, Matrix &trans)
         return;
     }
 
+    if (from->mode != to->mode){
+        NRPixBlock *o_from = from;
+        from = new NRPixBlock;
+        nr_pixblock_setup_fast(from, to->mode, o_from->area.x0, o_from->area.y0, o_from->area.x1, o_from->area.y1, false);
+        nr_blit_pixblock_pixblock(from, o_from);
+    }
+    
     // Precalculate sizes of source and destination pixblocks
     int from_width = from->area.x1 - from->area.x0;
     int from_height = from->area.y1 - from->area.y0;