9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Thaddeus Woskowiak <tswoskowiak@gmail.com>
To: 9front@9front.org
Subject: Re: [9front] [PATCH] plot: fix disc and circle operations
Date: Sat, 22 Oct 2022 14:53:52 -0400	[thread overview]
Message-ID: <CAG3JMtayrwvGu_gB6Y7dCuRQX_uzZZhHBE_AoV-Yiki4K6N5fQ@mail.gmail.com> (raw)
In-Reply-To: <CAB-jnzgp2FOk2rch6MqPccG3cDqUO6=e_wbwP=En0GpSYuZB7g@mail.gmail.com>

On Sat, Oct 22, 2022 at 12:24 PM an2qzavok <an2qzavok@gmail.com> wrote:
>
> Discs and circles were drawn on screen directly and later erased by
> offscreen buffer.
> This change puts them in line with other operations, which draw to
> offscreen first and to screen when necessary
>
> diff dfee08d50df674cd76f74320bc9c8bc6a4a95f1e uncommitted
> --- a/sys/src/cmd/plot/libplot/circ.c
> +++ b/sys/src/cmd/plot/libplot/circ.c
> @@ -8,5 +8,5 @@
>          rad=SCR(-r);
>      else
>          rad=SCR(r);
> -    ellipse(screen, p, rad, rad, 0, getcolor(e1->foregr), ZP);
> +    m_circ(p, rad, e1->foregr);
>  }
> --- a/sys/src/cmd/plot/libplot/disk.c
> +++ b/sys/src/cmd/plot/libplot/disk.c
> @@ -8,5 +8,5 @@
>          rad=SCR(-r);
>      else
>          rad=SCR(r);
> -    fillellipse(screen, p, rad, rad, getcolor(e1->foregr), ZP);
> +    m_disc(p, rad, e1->foregr);
>  }
> --- a/sys/src/cmd/plot/libplot/machdep.c
> +++ b/sys/src/cmd/plot/libplot/machdep.c
> @@ -34,6 +34,29 @@
>      if(offscreen != screen && !buffer)
>          draw(screen, xlr(Rect(x0, y0, x1+1, y1+1)), getcolor(c), nil, ZP);
>  }
> +
> +/*
> + * Draw circle at point p with radius rad in color c
> + */
> +void
> +m_circ(Point p, int rad, int c)
> +{
> +    ellipse(offscreen, p, rad, rad, 0, getcolor(c), ZP);
> +    if (offscreen != screen && !buffer)
> +        ellipse(screen, p, rad, rad, 0, getcolor(c), ZP);
> +}
> +
> +/*
> + * Draw disc (filled circle) at point p with radius rad in color c
> + */
> +void
> +m_disc(Point p, int rad, int c)
> +{
> +    fillellipse(offscreen, p, rad, rad, getcolor(c), ZP);
> +    if (offscreen != screen && !buffer)
> +        fillellipse(screen, p, rad, rad, getcolor(c), ZP);
> +}
> +
>  /*
>   * Draw text between pointers p and q with first character centered at x, y.
>   * Use color c.  Centered if cen is non-zero, right-justified if
> right is non-zero.
> --- a/sys/src/cmd/plot/libplot/mplot.h
> +++ b/sys/src/cmd/plot/libplot/mplot.h
> @@ -36,6 +36,8 @@
>   */
>  #include "../plot.h"
>  void m_clrwin(int, int, int, int, int);
> +void m_circ(Point, int, int);
> +void m_disc(Point, int, int);
>  void m_finish(void);
>  void m_initialize(char *);
>  int m_text(int, int, char *, char *, int, int, int);


Thank you for fixing these bugs. I was the one asking about this issue
in cat-v the other day. Time to sysupdate.

      parent reply	other threads:[~2022-10-22 18:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 16:22 an2qzavok
2022-10-22 18:21 ` ori
2022-10-22 18:25   ` an2qzavok
2022-10-22 18:31     ` ori
2022-10-22 18:53 ` Thaddeus Woskowiak [this message]

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=CAG3JMtayrwvGu_gB6Y7dCuRQX_uzZZhHBE_AoV-Yiki4K6N5fQ@mail.gmail.com \
    --to=tswoskowiak@gmail.com \
    --cc=9front@9front.org \
    /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).