[weston] Make border width and ball radius configurable

Submitted by Seedo Eldho Paul on Nov. 29, 2014, 1:36 p.m.

Details

Message ID 1417268198-9510-1-git-send-email-seedoeldhopaul@gmail.com
State Rejected
Headers show

Not browsing as part of any series.

Commit Message

Seedo Eldho Paul Nov. 29, 2014, 1:36 p.m.
Also change "simple-shm exiting" to "simple-damage exiting"

Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
---
 clients/simple-damage.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/clients/simple-damage.c b/clients/simple-damage.c
index fe532fe..9f3d58f 100644
--- a/clients/simple-damage.c
+++ b/clients/simple-damage.c
@@ -172,8 +172,6 @@  window_init_game(struct window *window)
 	gettimeofday(&tv, NULL);
 	srand(tv.tv_usec);
 
-	window->ball.radius = 10;
-
 	ax1 = window->border + window->ball.radius;
 	ay1 = window->border + window->ball.radius;
 	ax2 = window->width - window->border - window->ball.radius;
@@ -233,8 +231,8 @@  window_advance_game(struct window *window, uint32_t timestamp)
 
 static struct window *
 create_window(struct display *display, int width, int height,
-	      enum wl_output_transform transform, int scale,
-	      enum window_flags flags)
+	      int border, int radius, enum wl_output_transform transform,
+	      int scale, enum window_flags flags)
 {
 	struct window *window;
 
@@ -268,7 +266,8 @@  create_window(struct display *display, int width, int height,
 	window->display = display;
 	window->width = width;
 	window->height = height;
-	window->border = 10;
+	window->border = border;
+	window->ball.radius = radius;
 	window->flags = flags;
 	window->transform = transform;
 	window->scale = scale;
@@ -772,6 +771,8 @@  print_usage(int retval)
 		"  --version=VERSION\tVersion of wl_surface to use\n"
 		"  --width=WIDTH\t\tWidth of the window\n"
 		"  --height=HEIGHT\tHeight of the window\n"
+		"  --border=BORDER\tBorder width of the window\n"
+		"  --radius=RADIUS\tRadius of the ball\n"
 		"  --scale=SCALE\t\tScale factor for the surface\n"
 		"  --transform=TRANSFORM\tTransform for the surface\n"
 		"  --rotating-transform\tUse a different buffer_transform for each frame\n"
@@ -818,6 +819,7 @@  main(int argc, char **argv)
 	int i, ret = 0;
 	int version = -1;
 	int width = 300, height = 200, scale = 1;
+	int border = 10, radius = 10;
 	enum wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
 	enum window_flags flags = 0;
 
@@ -839,6 +841,10 @@  main(int argc, char **argv)
 			continue;
 		} else if (sscanf(argv[i], "--height=%d", &height) > 0) {
 			continue;
+		} else if (sscanf(argv[i], "--border=%d", &border) > 0) {
+			continue;
+		} else if (sscanf(argv[i], "--radius=%d", &radius) > 0) {
+			continue;
 		} else if (strncmp(argv[i], "--transform=", 12) == 0 &&
 			   parse_transform(argv[i] + 12, &transform) > 0) {
 			continue;
@@ -858,7 +864,8 @@  main(int argc, char **argv)
 
 	display = create_display(version);
 
-	window = create_window(display, width, height, transform, scale, flags);
+	window = create_window(display, width, height, border, radius, 
+		               transform, scale, flags);
 	if (!window)
 		return 1;
 
@@ -872,7 +879,7 @@  main(int argc, char **argv)
 	while (running && ret != -1)
 		ret = wl_display_dispatch(display->display);
 
-	fprintf(stderr, "simple-shm exiting\n");
+	fprintf(stderr, "simple-damage exiting\n");
 	destroy_window(window);
 	destroy_display(display);
 

Comments

I don't see anything wrong with this patch, but I'm forced to ask the
question: What's the point?  I mean, it's a little bouncing ball, why does
it need to be configurable?

On Sat, Nov 29, 2014 at 5:36 AM, Seedo Eldho Paul <seedoeldhopaul@gmail.com>
wrote:

> Also change "simple-shm exiting" to "simple-damage exiting"
>
> Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
> ---
>  clients/simple-damage.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/clients/simple-damage.c b/clients/simple-damage.c
> index fe532fe..9f3d58f 100644
> --- a/clients/simple-damage.c
> +++ b/clients/simple-damage.c
> @@ -172,8 +172,6 @@ window_init_game(struct window *window)
>         gettimeofday(&tv, NULL);
>         srand(tv.tv_usec);
>
> -       window->ball.radius = 10;
> -
>         ax1 = window->border + window->ball.radius;
>         ay1 = window->border + window->ball.radius;
>         ax2 = window->width - window->border - window->ball.radius;
> @@ -233,8 +231,8 @@ window_advance_game(struct window *window, uint32_t
> timestamp)
>
>  static struct window *
>  create_window(struct display *display, int width, int height,
> -             enum wl_output_transform transform, int scale,
> -             enum window_flags flags)
> +             int border, int radius, enum wl_output_transform transform,
> +             int scale, enum window_flags flags)
>  {
>         struct window *window;
>
> @@ -268,7 +266,8 @@ create_window(struct display *display, int width, int
> height,
>         window->display = display;
>         window->width = width;
>         window->height = height;
> -       window->border = 10;
> +       window->border = border;
> +       window->ball.radius = radius;
>         window->flags = flags;
>         window->transform = transform;
>         window->scale = scale;
> @@ -772,6 +771,8 @@ print_usage(int retval)
>                 "  --version=VERSION\tVersion of wl_surface to use\n"
>                 "  --width=WIDTH\t\tWidth of the window\n"
>                 "  --height=HEIGHT\tHeight of the window\n"
> +               "  --border=BORDER\tBorder width of the window\n"
> +               "  --radius=RADIUS\tRadius of the ball\n"
>                 "  --scale=SCALE\t\tScale factor for the surface\n"
>                 "  --transform=TRANSFORM\tTransform for the surface\n"
>                 "  --rotating-transform\tUse a different buffer_transform
> for each frame\n"
> @@ -818,6 +819,7 @@ main(int argc, char **argv)
>         int i, ret = 0;
>         int version = -1;
>         int width = 300, height = 200, scale = 1;
> +       int border = 10, radius = 10;
>         enum wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
>         enum window_flags flags = 0;
>
> @@ -839,6 +841,10 @@ main(int argc, char **argv)
>                         continue;
>                 } else if (sscanf(argv[i], "--height=%d", &height) > 0) {
>                         continue;
> +               } else if (sscanf(argv[i], "--border=%d", &border) > 0) {
> +                       continue;
> +               } else if (sscanf(argv[i], "--radius=%d", &radius) > 0) {
> +                       continue;
>                 } else if (strncmp(argv[i], "--transform=", 12) == 0 &&
>                            parse_transform(argv[i] + 12, &transform) > 0) {
>                         continue;
> @@ -858,7 +864,8 @@ main(int argc, char **argv)
>
>         display = create_display(version);
>
> -       window = create_window(display, width, height, transform, scale,
> flags);
> +       window = create_window(display, width, height, border, radius,
> +                              transform, scale, flags);
>         if (!window)
>                 return 1;
>
> @@ -872,7 +879,7 @@ main(int argc, char **argv)
>         while (running && ret != -1)
>                 ret = wl_display_dispatch(display->display);
>
> -       fprintf(stderr, "simple-shm exiting\n");
> +       fprintf(stderr, "simple-damage exiting\n");
>         destroy_window(window);
>         destroy_display(display);
>
> --
> 1.9.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
Hi!

I thought it would be nice to have the border and radius configurable when
the width and height of the arena already are.

(sorry I forgot to cc list earler)
Thanks,
SEEDO
On Nov 30, 2014 4:24 AM, "Jason Ekstrand" <jason@jlekstrand.net> wrote:

> I don't see anything wrong with this patch, but I'm forced to ask the
> question: What's the point?  I mean, it's a little bouncing ball, why does
> it need to be configurable?
>
> On Sat, Nov 29, 2014 at 5:36 AM, Seedo Eldho Paul <
> seedoeldhopaul@gmail.com> wrote:
>
>> Also change "simple-shm exiting" to "simple-damage exiting"
>>
>> Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
>> ---
>>  clients/simple-damage.c | 21 ++++++++++++++-------
>>  1 file changed, 14 insertions(+), 7 deletions(-)
>>
>> diff --git a/clients/simple-damage.c b/clients/simple-damage.c
>> index fe532fe..9f3d58f 100644
>> --- a/clients/simple-damage.c
>> +++ b/clients/simple-damage.c
>> @@ -172,8 +172,6 @@ window_init_game(struct window *window)
>>         gettimeofday(&tv, NULL);
>>         srand(tv.tv_usec);
>>
>> -       window->ball.radius = 10;
>> -
>>         ax1 = window->border + window->ball.radius;
>>         ay1 = window->border + window->ball.radius;
>>         ax2 = window->width - window->border - window->ball.radius;
>> @@ -233,8 +231,8 @@ window_advance_game(struct window *window, uint32_t
>> timestamp)
>>
>>  static struct window *
>>  create_window(struct display *display, int width, int height,
>> -             enum wl_output_transform transform, int scale,
>> -             enum window_flags flags)
>> +             int border, int radius, enum wl_output_transform transform,
>> +             int scale, enum window_flags flags)
>>  {
>>         struct window *window;
>>
>> @@ -268,7 +266,8 @@ create_window(struct display *display, int width, int
>> height,
>>         window->display = display;
>>         window->width = width;
>>         window->height = height;
>> -       window->border = 10;
>> +       window->border = border;
>> +       window->ball.radius = radius;
>>         window->flags = flags;
>>         window->transform = transform;
>>         window->scale = scale;
>> @@ -772,6 +771,8 @@ print_usage(int retval)
>>                 "  --version=VERSION\tVersion of wl_surface to use\n"
>>                 "  --width=WIDTH\t\tWidth of the window\n"
>>                 "  --height=HEIGHT\tHeight of the window\n"
>> +               "  --border=BORDER\tBorder width of the window\n"
>> +               "  --radius=RADIUS\tRadius of the ball\n"
>>                 "  --scale=SCALE\t\tScale factor for the surface\n"
>>                 "  --transform=TRANSFORM\tTransform for the surface\n"
>>                 "  --rotating-transform\tUse a different buffer_transform
>> for each frame\n"
>> @@ -818,6 +819,7 @@ main(int argc, char **argv)
>>         int i, ret = 0;
>>         int version = -1;
>>         int width = 300, height = 200, scale = 1;
>> +       int border = 10, radius = 10;
>>         enum wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
>>         enum window_flags flags = 0;
>>
>> @@ -839,6 +841,10 @@ main(int argc, char **argv)
>>                         continue;
>>                 } else if (sscanf(argv[i], "--height=%d", &height) > 0) {
>>                         continue;
>> +               } else if (sscanf(argv[i], "--border=%d", &border) > 0) {
>> +                       continue;
>> +               } else if (sscanf(argv[i], "--radius=%d", &radius) > 0) {
>> +                       continue;
>>                 } else if (strncmp(argv[i], "--transform=", 12) == 0 &&
>>                            parse_transform(argv[i] + 12, &transform) > 0)
>> {
>>                         continue;
>> @@ -858,7 +864,8 @@ main(int argc, char **argv)
>>
>>         display = create_display(version);
>>
>> -       window = create_window(display, width, height, transform, scale,
>> flags);
>> +       window = create_window(display, width, height, border, radius,
>> +                              transform, scale, flags);
>>         if (!window)
>>                 return 1;
>>
>> @@ -872,7 +879,7 @@ main(int argc, char **argv)
>>         while (running && ret != -1)
>>                 ret = wl_display_dispatch(display->display);
>>
>> -       fprintf(stderr, "simple-shm exiting\n");
>> +       fprintf(stderr, "simple-damage exiting\n");
>>         destroy_window(window);
>>         destroy_display(display);
>>
>> --
>> 1.9.1
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>
>
>
On Sun, 30 Nov 2014 08:15:42 +0530
Seedo Eldho Paul <seedoeldhopaul@gmail.com> wrote:

> Hi!
> 
> I thought it would be nice to have the border and radius configurable
> when the width and height of the arena already are.

I don't think this actually adds anything to the test case, does it?
After all, the purpose of this client is to test the damage tracking
algorithms under various buffer/output scales and transforms, AFAIU.

Thanks for the attempt though, it's a properly formatted patch.

Cheers,
pq


> 
> (sorry I forgot to cc list earler)
> Thanks,
> SEEDO
> On Nov 30, 2014 4:24 AM, "Jason Ekstrand" <jason@jlekstrand.net>
> wrote:
> 
> > I don't see anything wrong with this patch, but I'm forced to ask
> > the question: What's the point?  I mean, it's a little bouncing
> > ball, why does it need to be configurable?
> >
> > On Sat, Nov 29, 2014 at 5:36 AM, Seedo Eldho Paul <
> > seedoeldhopaul@gmail.com> wrote:
> >
> >> Also change "simple-shm exiting" to "simple-damage exiting"
> >>
> >> Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
> >> ---
> >>  clients/simple-damage.c | 21 ++++++++++++++-------
> >>  1 file changed, 14 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/clients/simple-damage.c b/clients/simple-damage.c
> >> index fe532fe..9f3d58f 100644
> >> --- a/clients/simple-damage.c
> >> +++ b/clients/simple-damage.c
> >> @@ -172,8 +172,6 @@ window_init_game(struct window *window)
> >>         gettimeofday(&tv, NULL);
> >>         srand(tv.tv_usec);
> >>
> >> -       window->ball.radius = 10;
> >> -
> >>         ax1 = window->border + window->ball.radius;
> >>         ay1 = window->border + window->ball.radius;
> >>         ax2 = window->width - window->border - window->ball.radius;
> >> @@ -233,8 +231,8 @@ window_advance_game(struct window *window,
> >> uint32_t timestamp)
> >>
> >>  static struct window *
> >>  create_window(struct display *display, int width, int height,
> >> -             enum wl_output_transform transform, int scale,
> >> -             enum window_flags flags)
> >> +             int border, int radius, enum wl_output_transform
> >> transform,
> >> +             int scale, enum window_flags flags)
> >>  {
> >>         struct window *window;
> >>
> >> @@ -268,7 +266,8 @@ create_window(struct display *display, int
> >> width, int height,
> >>         window->display = display;
> >>         window->width = width;
> >>         window->height = height;
> >> -       window->border = 10;
> >> +       window->border = border;
> >> +       window->ball.radius = radius;
> >>         window->flags = flags;
> >>         window->transform = transform;
> >>         window->scale = scale;
> >> @@ -772,6 +771,8 @@ print_usage(int retval)
> >>                 "  --version=VERSION\tVersion of wl_surface to
> >> use\n" "  --width=WIDTH\t\tWidth of the window\n"
> >>                 "  --height=HEIGHT\tHeight of the window\n"
> >> +               "  --border=BORDER\tBorder width of the window\n"
> >> +               "  --radius=RADIUS\tRadius of the ball\n"
> >>                 "  --scale=SCALE\t\tScale factor for the surface\n"
> >>                 "  --transform=TRANSFORM\tTransform for the
> >> surface\n" "  --rotating-transform\tUse a different
> >> buffer_transform for each frame\n"
> >> @@ -818,6 +819,7 @@ main(int argc, char **argv)
> >>         int i, ret = 0;
> >>         int version = -1;
> >>         int width = 300, height = 200, scale = 1;
> >> +       int border = 10, radius = 10;
> >>         enum wl_output_transform transform =
> >> WL_OUTPUT_TRANSFORM_NORMAL; enum window_flags flags = 0;
> >>
> >> @@ -839,6 +841,10 @@ main(int argc, char **argv)
> >>                         continue;
> >>                 } else if (sscanf(argv[i], "--height=%d", &height)
> >> > 0) { continue;
> >> +               } else if (sscanf(argv[i], "--border=%d", &border)
> >> > 0) {
> >> +                       continue;
> >> +               } else if (sscanf(argv[i], "--radius=%d", &radius)
> >> > 0) {
> >> +                       continue;
> >>                 } else if (strncmp(argv[i], "--transform=", 12) ==
> >> 0 && parse_transform(argv[i] + 12, &transform) > 0)
> >> {
> >>                         continue;
> >> @@ -858,7 +864,8 @@ main(int argc, char **argv)
> >>
> >>         display = create_display(version);
> >>
> >> -       window = create_window(display, width, height, transform,
> >> scale, flags);
> >> +       window = create_window(display, width, height, border,
> >> radius,
> >> +                              transform, scale, flags);
> >>         if (!window)
> >>                 return 1;
> >>
> >> @@ -872,7 +879,7 @@ main(int argc, char **argv)
> >>         while (running && ret != -1)
> >>                 ret = wl_display_dispatch(display->display);
> >>
> >> -       fprintf(stderr, "simple-shm exiting\n");
> >> +       fprintf(stderr, "simple-damage exiting\n");
> >>         destroy_window(window);
> >>         destroy_display(display);
> >>
> >> --
> >> 1.9.1
> >>
> >> _______________________________________________
> >> wayland-devel mailing list
> >> wayland-devel@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >>
> >
> >