+static int watermark2_width=47;
+static int watermark2_height=11;
+static int watermark2[47] = {95,1989,71,0,2015,337,1678,0,2015,5,1921,320,1938,25,2006,1024,
+ 1042,21,13,960,1039,976,8,2000,1359,1088,31,1989,321,1728,0,1152,
+ 1344,832,0,1984,0,896,1088,1088,896,0,1984,128,256,512,1984};
+
+static void draw_watermark(gfxdevice_t*dev, gfxbbox_t r, char drawall)
+{
+ swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+ double wx = r.xmax / 5.0;
+ double tx = r.xmax*4.0 / 5.0;
+ double ty = r.ymax-wx*watermark2_height/watermark2_width;
+ double sx = (r.xmax - tx) / watermark2_width;
+ double sy = (r.ymax - ty) / watermark2_height;
+ double px = sx-0.5;
+ double py = sy-0.5;
+ if(ty > 0 && px > 1.0 && py > 1.0) {
+ int x,y;
+ for(y=0;y<watermark2_height;y++)
+ for(x=0;x<watermark2_width;x++) {
+ if(((watermark2[x]>>y)&1)) {
+ if(!drawall && rand()%5)
+ continue;
+ unsigned int b = rand();
+ moveto(dev, i->tag, x*sx+tx+((b>>1)&1)/20.0, y*sy+ty+((b>>3)&1)/20.0);
+ lineto(dev, i->tag, x*sx+px+tx+((b>>2)&1)/20.0, y*sy+ty+((b>>3)&1)/20.0);
+ lineto(dev, i->tag, x*sx+px+tx+((b>>2)&1)/20.0, y*sy+py+ty+((b>>4)&1)/20.0);
+ lineto(dev, i->tag, x*sx+tx+((b>>1)&1)/20.0, y*sy+py+ty+((b>>4)&1)/20.0);
+ lineto(dev, i->tag, x*sx+tx+((b>>1)&1)/20.0, y*sy+ty+((b>>3)&1)/20.0);
+ }
+ }
+ }
+}
+
+static void swfoutput_setfillcolor(gfxdevice_t* dev, U8 r, U8 g, U8 b, U8 a)
+{
+ swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+ if(i->fillrgb.r == r &&
+ i->fillrgb.g == g &&
+ i->fillrgb.b == b &&
+ i->fillrgb.a == a) return;
+ if(i->shapeid>=0)
+ endshape(dev);
+
+ i->fillrgb.r = r;
+ i->fillrgb.g = g;
+ i->fillrgb.b = b;
+ i->fillrgb.a = a;
+}
+static void insert_watermark(gfxdevice_t*dev, char drawall)
+{
+ swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+ if(!drawall && i->watermarks>20)
+ return;
+ endshape(dev);
+ endtext(dev);
+
+ if(drawall) {
+ swfoutput_setfillcolor(dev, 0,0,255,192);
+ } else {
+ swfoutput_setfillcolor(dev, rand(),rand(),rand(),(rand()&127)+128);
+ }
+ startshape(dev);
+ startFill(dev);
+
+ gfxbbox_t r; r.xmin = r.ymin = 0;
+ r.xmax = i->max_x;
+ r.ymax = i->max_y;
+ draw_watermark(dev, r, drawall);
+ endshape(dev);
+ i->watermarks++;
+}
+
+