bsd compatibility mods
[goodguy/history.git] / cinelerra-5.1 / plugins / titler / titler.C
index 9056bc19a9ec8fa333392729ba3f389d883b0ef2..fefbbdb119c371a3e860ee45a72382f9c0836a1d 100644 (file)
@@ -2224,16 +2224,20 @@ TitleTranslateUnit::TitleTranslateUnit(TitleMain *plugin, TitleTranslate *server
        type **out_rows = (type**)output->get_rows(); \
        float fr = 1./(256.-max), fs = max/255.; \
        float r = max > 1 ? 0.5 : 0; \
-       for( int y=y1; y<y2; ++y ) { \
-               float fy = y+yofs;  int iy = fy; \
-               float yf1 = fy>=iy ? fy - iy : fy+1-iy; \
+       int ix1= x1, iy1 = y1, ix2= x2, iy2 = y2; \
+       float fy = y1 + yofs; \
+       for( int y=iy1; y<iy2; ++y,++fy ) { \
+               int iy = fy;  float yf1 = fy - iy; \
+               if( yf1 < 0 ) ++yf1; \
                float yf0 = 1. - yf1; \
                unsigned char *in_row0 = in_rows[iy<0 ? 0 : iy]; \
                unsigned char *in_row1 = in_rows[iy<ih1 ? iy+1 : ih1]; \
-               for( int x=x1; x<x2; ++x ) { \
+               float fx = x1 + xofs; \
+               for( int x=ix1; x<ix2; ++x,++fx ) { \
                        type *op = out_rows[y] + x*comps; \
-                       float fx = x+xofs;  int ix = fx; \
-                       float xf1 = fx - ix, xf0 = 1. - xf1; \
+                       int ix = fx;  float xf1 = fx - ix; \
+                       if( xf1 < 0 ) ++xf1; \
+                       float xf0 = 1. - xf1; \
                        int i0 = (ix<0 ? 0 : ix)*4, i1 = (ix<iw1 ? ix+1 : iw1)*4; \
                        uint8_t *cp00 = in_row0 + i0, *cp01 = in_row0 + i1; \
                        uint8_t *cp10 = in_row1 + i0, *cp11 = in_row1 + i1; \
@@ -2348,46 +2352,9 @@ int TitleMain::init_freetype()
 
 void TitleMain::draw_boundry()
 {
-       VFrame &out = *output;
-       int iw = output->get_w(), ih = output->get_h();
-       int mr = MIN(iw, ih)/200 + 2, rr = 2*mr;
-       int x = title_x, y = title_y, w = title_w, h = title_h;
-       int r2 = (rr+1)/2;
-       int x0 = x-r2, x1 = x+(w+1)/2, x2 = x+w+r2;
-       int y0 = y-r2, y1 = y+(h+1)/2, y2 = y+h+r2;
-       int st = 1;
-       for( int r=2; r<mr; r<<=1 ) st = r;
-       out.set_stiple(st);
-
-       for( int r=mr/2; --r>=0; ) { // bbox
-               int lft = x+r, rgt = x+w-1-r;
-               int top = y+r, bot = y+h-1-r;
-               out.draw_line(lft,top, rgt,top);
-               out.draw_line(rgt,top, rgt,bot);
-               out.draw_line(rgt,bot, lft,bot);
-               out.draw_line(lft,bot, lft,top);
-       }
-
-       for( int r=mr; r<rr; ++r ) { // center
-               out.draw_smooth(x1-r,y1, x1-r,y1+r, x1,y1+r);
-               out.draw_smooth(x1,y1+r, x1+r,y1+r, x1+r,y1);
-               out.draw_smooth(x1+r,y1, x1+r,y1-r, x1,y1-r);
-               out.draw_smooth(x1,y1-r, x1-r,y1-r, x1-r,y1);
-       }
-
-       for( int r=rr; --r>=0; ) { // edge arrows
-               out.draw_line(x1-r,y0+r, x1+r,y0+r);
-               out.draw_line(x2-r,y1-r, x2-r,y1+r);
-               out.draw_line(x1-r,y2-r, x1+r,y2-r);
-               out.draw_line(x0+r,y1+r, x0+r,y1-r);
-       }
-       x0 += r2;  y0 += r2;  x2 -= r2;  y2 -= r2;
-       for( int r=2*mr; --r>=0; ) { // corner arrows
-               out.draw_line(x0,y0+r, x0+r,y0);
-               out.draw_line(x2,y0+r, x2-r,y0);
-               out.draw_line(x2,y2-r, x2-r,y2);
-               out.draw_line(x0,y2-r, x0+r,y2);
-       }
+       if( !gui_open() ) return;
+       DragCheckBox::draw_boundary(output,
+               title_x, title_y, title_w, title_h);
 }