plan9fox/sys/man/2
cinap_lenrek 71dbddef16 draw: fix drawing of replicated source image on memlayer with a clip rectangle
when a replicated source image with a clipr with clipr.min > Pt(0, 0),
drawclip() would properly translate the src->clipr on the dstr
but then clamp the source rectangle back on src->r.

while traversing down multiple layers, this would cause the translation to
be applied multiple times to the dst rectangle giving the wrong image result.

this change adds a new drawclipnorepl() function that avoids the clamping
of source and mask rectangles to src->r and mask->r. this is then used in
libmemlayer.

the final memimagedraw() call will call drawclip() which will do the final
claming.

a testcase is provided:

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

Image *blue;
Image *red;

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

	if(initdraw(nil, nil, argv[0]) < 0)
		sysfatal("initdraw: %r");
	i = allocimage(display, screen->r, screen->chan, 1, DWhite);

	red = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DRed);
	blue = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPaleblue);
	replclipr(red, 1, Rect(10, 10, 110, 110));
	replclipr(blue, 1, Rect(11, 11, 111, 111));

	/* draw on non-layer, works correctly */
	draw(i, i->r, red, nil, ZP);
	draw(i, i->r, blue, nil, ZP);
	draw(screen, screen->r, i, nil, i->r.min);
	flushimage(display, 1);

	/* draw on (screen) layer is too far to the right */
	draw(screen, screen->r, red, nil, ZP);
	draw(screen, screen->r, blue, nil, ZP);
	flushimage(display, 1);

	for(;;){
		sleep(1000);
	}
}
2013-12-09 03:35:01 +01:00
..
0intro
9p 9p(2): correct usage for srvrelease()/srvacquire() 2013-10-17 08:26:05 +02:00
9pcmdbuf
9pfid
9pfile
abort
abs
access
addpt
aes
allocimage
aml arch(3), aml(2): document /dev/acpitbls file 2013-11-10 21:26:11 +01:00
arg
arith3
assert
atof
auth auth(2): auth_getkey only takes a single argument: char *params 2013-06-01 14:00:19 -04:00
authsrv
avl
bin
bind
bio bio: remove useless Breadn() as it does the same as Bread() 2012-12-25 02:45:28 +01:00
blowfish
brk
cachechars
chdir
cleanname
color
complete
control
cputime
ctime Add isotime() and isodate() functions to libc. 2012-09-02 23:05:41 +12:00
ctype
debugger fix <mach.h> types in manual (erik quanstros machmantype patch) 2013-04-25 00:13:19 +02:00
des
dial dial(2): not in parallel on 9front 2012-06-25 16:53:33 +02:00
dirread
disk
draw
dsa
dup
ec vac(1), ec(2), usb(3), hjfs(8): fix source reference 2013-01-09 08:17:09 +01:00
elgamal
encode
encrypt
errstr
event event(2): english 2011-10-31 17:53:32 -05:00
exec
exits
exp
fauth
fcall
fd2path
fgetc
flate
floor
fmtinstall
fopen
fork
fprintf
frame
frexp
fscanf
fversion
getcallerpc
getenv
getfcr
getfields
getpid
getuser
getwd
graphics graphics(2): remove non existing char *mousedir argument from geninitdraw (from sources / geninitdraw-no-mousedir patch) 2013-05-25 04:39:53 +02:00
html
httpd
hypot
intmap
ioproc ioproc(2): document iosleep 2011-08-26 10:06:10 +02:00
iounit
ip
isalpharune
keyboard
lock
mach fix <mach.h> types in manual (erik quanstros machmantype patch) 2013-04-25 00:13:19 +02:00
malloc
matrix
memdraw draw: fix drawing of replicated source image on memlayer with a clip rectangle 2013-12-09 03:35:01 +01:00
memlayer
memory
mktemp
mouse mouse(2): .IR syntax 2011-11-03 23:57:57 +01:00
mp
muldiv
nan
ndb ndb(2): fix wrong attr names 2013-02-22 22:52:52 +01:00
notify
nusb proto(2): document 9front extensions 2011-09-01 11:58:16 +02:00
object fix <mach.h> types in manual (erik quanstros machmantype patch) 2013-04-25 00:13:19 +02:00
open
perror
pipe
plumb
pool
postnote
prime
print
privalloc
proto proto(2): document 9front extensions 2011-09-01 11:58:16 +02:00
pushssl pushssl(2), pushtls(2): clarify filedescriptor closing 2013-09-20 17:44:14 +02:00
pushtls pushssl(2), pushtls(2): clarify filedescriptor closing 2013-09-20 17:44:14 +02:00
qball
qsort
quaternion
quote
rand rand(2): fix nroff output 2011-11-27 00:50:53 +01:00
rc4
read
readcolmap
readv
regexp
remove
rendezvous
rsa
rune
runestrcat
scribble
scsi
sechash added ec(2), added ripemd160 to sechash(2) 2012-06-04 12:27:38 +02:00
seek
segattach
segbrk
segflush
semacquire tsemacquire: manpage and syscallfmt 2012-07-30 22:45:49 +02:00
setjmp
sin
sinh
sleep
stat
strcat
string
stringsize
subfont
symbol fix <mach.h> types in manual (erik quanstros machmantype patch) 2013-04-25 00:13:19 +02:00
thread
time
tmpfile
venti
venti-cache
venti-client
venti-conn
venti-fcall
venti-file
venti-log
venti-mem
venti-packet
venti-server
venti-zero
wait
window