From: cinap_lenrek@felloff.net
To: 9fans@9fans.net
Subject: [9fans] libmemlayer bug
Date: Mon, 9 Dec 2013 05:09:13 +0100 [thread overview]
Message-ID: <55dbceb34c7d3f45100fd9cbf396b510@felloff.net> (raw)
when drawing a replicated source image with a clipr with
clipr.min > Pt(0, 0), drawclip() would translate the
src->clipr on the dstr but then clamp the source rectangle
back on src->r.
this causes problems in libmemlayer when it drawclips() at each iteration
when traversing down the layers. the clamping of sr back to src->r (which is 1x1
in the example below) it will shift the destination rectangle to the right
as it is reapplied at each loop iteration.
#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);
}
}
in 9front, i added drawclipnorepl() function that is like drawclip() but does not clamp
the source and mask rectangles to be in src->r and mask->r and use it in libmemlayer.
http://code.google.com/p/plan9front/source/detail?r=c18ae5b7ea0ee138080824c4f164628f899b7770
--
cinap
next reply other threads:[~2013-12-09 4:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 4:09 cinap_lenrek [this message]
2013-12-09 4:43 ` Conor Williams
2013-12-09 5:00 ` cinap_lenrek
2013-12-09 5:28 ` Conor Williams
2013-12-09 6:09 ` Matthew Veety
2013-12-09 6:22 ` Conor Williams
2013-12-09 6:26 ` erik quanstrom
2013-12-09 13:05 ` Matthew Veety
2013-12-09 6:41 ` erik quanstrom
2013-12-09 6:54 ` cinap_lenrek
2014-01-15 6:06 ` Conor Williams
2014-01-15 7:52 ` cinap_lenrek
2014-01-15 8:30 ` Conor Williams
2014-01-15 14:42 ` erik quanstrom
2014-01-15 19:08 ` cinap_lenrek
2014-01-15 21:19 ` Conor Williams
2014-01-15 21:31 ` Conor Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55dbceb34c7d3f45100fd9cbf396b510@felloff.net \
--to=cinap_lenrek@felloff.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).