#include "DRW/drwwh.h"
#include "DRW/drwWwinit.h"
#include "DRW/drwWxdata.h"
#include "DRW/drwWredraw.h"
#include "DRW/drwUredraw.h"


#include "DRW/drwWfontfn.h"
#include "DRW/drwSprRend.h"
#include "DRW/drwDFOShI.h"
#include "DRW/drwRender.h"


extern byte *drawfile1, *drawfile2;
extern font_f trinity10bi;
extern int Windowheight;


static char *String1 = "Full and half-scale red squares plotted with bottom left corner of draw page at bottom left of window.";
static char *String2 = "Full and half-scale blue squares plotted with bottom left corner of 'bounding box' at bottom left of window.";
static char *String3 = "Double-size Wimp pool sprite plotted at 800,432 (wrt bottom left of window).";


void drw_u_redraw(wimp_draw *r,
                  int printing,
                  int page)

{

if (r->w == pwd->uwd->barwin)
 {
  drw_wimp_renderwindow(pwd->uwd->barwin, (drawfile_diagram *)drawfile1,
                        0, -Windowheight,
                        r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                        (double) 1, (double) 1, 0);
  drw_wimp_renderwindow(pwd->uwd->barwin, (drawfile_diagram *)drawfile1,
                        0, -Windowheight,
                        r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                        (double) 0.5, (double) 0.5, 0);
  drw_wimp_renderwindow(pwd->uwd->barwin, (drawfile_diagram *)drawfile2,
                        0, -Windowheight,
                        r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                        (double) 1, (double) 1, 1);
  drw_wimp_renderwindow(pwd->uwd->barwin, (drawfile_diagram *)drawfile2,
                        0, -Windowheight,
                        r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                        (double) 0.5, (double) 0.5, 1);
  drw_wimp_renderwindowsprite(pwd->uwd->barwin, "!draw", NULL,
                              800, -Windowheight + 432,
                              r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                             (double) 2, (double) 2);
  drw_wimp_plotwindowtexth(pwd->uwd->barwin, String1, trinity10bi, 0,
                           0, -616, 255, 0, 0, 223, 223, 223,
                           r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                           (double) 1, (double) 1, TRUE);
  drw_wimp_plotwindowtexth(pwd->uwd->barwin, String2, trinity10bi, 0,
                           100, -966, 0, 0, 255, 223, 223, 223,
                           r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                           (double) 1, (double) 1, TRUE);
  drw_wimp_plotwindowtexth(pwd->uwd->barwin, String3, trinity10bi, 0,
                           500, -680, 0, 0, 0, 223, 223, 223,
                           r->box.x0, r->box.y0, r->box.x1, r->box.y1,
                           (double) 1, (double) 1, TRUE);
 }

}


