Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcxfer.C
index 263daaa97823d4bcc93c6da3b3147465f49d3bd2..19aa7694f910819f8b97c8b4452fc368501826b2 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * CINELERRA
+ * Copyright (C) 2016-2020 William Morrow
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
 
 void BC_Xfer::init(
        uint8_t **output_rows, int out_colormodel, int out_x, int out_y, int out_w, int out_h,
@@ -176,12 +196,17 @@ void BC_CModels::transfer(unsigned char **output_rows, unsigned char **input_row
        int in_colormodel, int out_colormodel, int bg_color,
        int in_rowspan, int out_rowspan)
 {
-       BC_Xfer xfer(output_rows, input_rows,
-               out_yp, out_up, out_vp, in_yp, in_up, in_vp,
-               in_x, in_y, in_w, in_h, out_x, out_y, out_w, out_h,
-               in_colormodel, out_colormodel, bg_color,0xff, in_rowspan, out_rowspan);
-       if( xfer.xfer() )
-               printf("BC_CModels::transfer failed: %d to %d\n", in_colormodel, out_colormodel);
+       int ret = 1;
+       if( in_w > 0 && in_h > 0 && out_w > 0 && out_h > 0 ) {
+               BC_Xfer xfer(output_rows, input_rows,
+                       out_yp, out_up, out_vp, in_yp, in_up, in_vp,
+                       in_x, in_y, in_w, in_h, out_x, out_y, out_w, out_h,
+                       in_colormodel, out_colormodel, bg_color,0xff, in_rowspan, out_rowspan);
+               ret = xfer.xfer();
+       }
+       if( ret )
+               printf("BC_CModels::transfer failed:%d %d(%dx%d) to %d(%dx%d)\n", __LINE__,
+                       in_colormodel, in_w, in_h, out_colormodel, out_w, out_h);
 }
 
 void BC_CModels::transfer(
@@ -191,12 +216,17 @@ void BC_CModels::transfer(
                int in_x, int in_y, int in_w, int in_h, int in_rowspan,
        int bg_color)
 {
-       BC_Xfer xfer(
-               output_ptrs, out_colormodel, out_x, out_y, out_w, out_h, out_rowspan,
-               input_ptrs, in_colormodel, in_x, in_y, in_w, in_h, in_rowspan,
-               bg_color,0xff);
-       if( xfer.xfer() )
-               printf("BC_CModels::transfer failed: %d to %d\n", in_colormodel, out_colormodel);
+       int ret = 1;
+       if( in_w > 0 && in_h > 0 && out_w > 0 && out_h > 0 ) {
+               BC_Xfer xfer(
+                       output_ptrs, out_colormodel, out_x, out_y, out_w, out_h, out_rowspan,
+                       input_ptrs, in_colormodel, in_x, in_y, in_w, in_h, in_rowspan,
+                       bg_color,0xff);
+               ret = xfer.xfer();
+       }
+       if( ret )
+               printf("BC_CModels::transfer failed:%d %d(%dx%d) to %d(%dx%d)\n", __LINE__,
+                       in_colormodel, in_w, in_h, out_colormodel, out_w, out_h);
 }
 
 // color is rgb
@@ -205,10 +235,17 @@ int BC_CModels::init_color(int color, int alpha,
                unsigned char *out_yp, unsigned char *out_up, unsigned char *out_vp,
                int out_x, int out_y, int out_w, int out_h, int out_rowspan)
 {
-       BC_Xfer xfer(output_rows, 0, out_yp,out_up,out_vp, 0,0,0,
-               0,0,0,0, out_x,out_y,out_w,out_h, BC_TRANSPARENCY,
-               out_colormodel, color,alpha, 0, out_rowspan);
-       return xfer.xfer();
+       int ret = 1;
+       if( out_w > 0 && out_h > 0 ) {
+               BC_Xfer xfer(output_rows, 0, out_yp,out_up,out_vp, 0,0,0,
+                       0,0,0,0, out_x,out_y,out_w,out_h, BC_TRANSPARENCY,
+                       out_colormodel, color,alpha, 0, out_rowspan);
+               ret = xfer.xfer();
+       }
+       if( ret )
+               printf("BC_CModels::init_color failed:%d(%dx%d)\n",
+                       out_colormodel, out_w, out_h);
+       return ret;
 }
 
 // specialized functions