9front - general discussion about 9front
 help / color / mirror / Atom feed
* bug: replclipr(2) allows line(2) to escape the window
@ 2018-10-18  0:09 Nick Owens
  0 siblings, 0 replies; only message in thread
From: Nick Owens @ 2018-10-18  0:09 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

the attached program will draw lines in the upper left corner of rio,
regardless of the position of the rio window it is executed from.

this is not an issue with, for example, ellipse(2), otherwise you
would see an ellipse as well as lines.

[-- Attachment #2: line.c --]
[-- Type: text/x-csrc, Size: 988 bytes --]

#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>

void
usage(void)
{
	fprint(2, "usage: %s\n", argv0);
	exits("usage");
}

Rectangle lol[] = {
	{{50, 50}, {50, 100}},
	{{50, 100}, {75, 100}},

	{{100, 50}, {100, 100}},
	{{100, 100}, {125, 100}},
	{{125, 100}, {125, 50}},
	{{125, 50}, {100, 50}},

	{{150, 50}, {150, 100}},
	{{150, 100}, {175, 100}},};

void
main(int argc, char *argv[])
{
	int i;

	ARGBEGIN{
	default:
		usage();
	}ARGEND

	initdraw(nil, nil, argv0);
	einit(Emouse);
	for(;;){
		while(ecanmouse())
			emouse();

		replclipr(screen, 0, Rect(0, 0, 9000, 9000));

		for(i = 0; i < nelem(lol); i++){
			line(screen, lol[i].min, lol[i].max, 0, 0, 5, display->black, ZP);
		}

		//draw(screen, Rect(0, 0, 9000, 9000), display->black, nil, ZP);
		ellipse(screen, Pt(100, 75), 100, 75, 3, display->black, ZP);

		flushimage(display, 1);
	}

	exits(nil);
}

void
eresized(int new)
{
	if(new && getwindow(display, Refnone) < 0)
		sysfatal("getwindow: %r");
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-18  0:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18  0:09 bug: replclipr(2) allows line(2) to escape the window Nick Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).