~ubuntu-branches/ubuntu/quantal/xscreensaver/quantal

« back to all changes in this revision

Viewing changes to hacks/ripples.c

  • Committer: Bazaar Package Importer
  • Author(s): Ted Gould
  • Date: 2008-08-28 16:15:25 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080828161525-mxga521aoezxjq8h
Tags: 5.07-0ubuntu1
* Upgrade upstream version
* debian/control: Remove suggest xdaliclock as it is no longer
  included
* Remove 10_jwz-screensaver-randr-patch-3.patch as it has been merged
  upstream.
* Add 24_hacks_xsublim_enable.patch as it seems that xsublim was dropped
  from the build files.  There is nothing in the Changelog about it
  so I believe it was accidental.
* Updating the .desktop files from the XML files using gnome-screensaver's
  utility to do so.  Lots of text updates.  Also:
    * Added: abstractile.desktop
    * Added: cwaves.desktop
    * Added: m6502.desktop
    * Added: skytentacles.desktop
    * Removed: xteevee.desktop
* xscreensaver-gl-extra.files: Added skytentacles
* xscreensaver-data-extra.files: Added abstractile, cwaves and m6502
* xscreensaver-data.files: Remove partial abstractile, m6502 and cwaves

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
  int draw_count;
91
91
 
92
92
  int iterations, delay, rate, box, oily, stir, fluidity;
 
93
  int duration;
 
94
  time_t start_time;
93
95
 
94
96
  void (*draw_transparent) (struct state *st, short *src);
95
97
 
529
531
 
530
532
    st->img_loader = load_image_async_simple (0, xgwa.screen, st->window,
531
533
                                              st->window, 0, 0);
 
534
    st->start_time = time ((time_t) 0);
532
535
  } else {
533
536
    XGCValues gcv;
534
537
 
715
718
static void
716
719
add_circle_drop(struct state *st, int x, int y, int radius, int dheight)
717
720
{
718
 
  int i, r2, cx, cy;
 
721
  int r, r2, cx, cy;
719
722
  short *buf = (random()&1) ? st->bufferA : st->bufferB;
720
723
 
721
 
  i = y * st->width + x;
722
724
  r2 = radius * radius;
723
725
 
 
726
 
724
727
  for (cy = -radius; cy <= radius; cy++)
725
728
    for (cx = -radius; cx <= radius; cx++) {
726
 
      int r = cx*cx + cy*cy;
727
 
      if (r <= r2) {
728
 
        buf[i + cx + cy*st->width] =
729
 
          (short)(dheight * sinc(st, sqrt(r)/radius));
730
 
      }
 
729
      int xx = x+cx;
 
730
      int yy = y+cy;
 
731
      if (xx < 0 || yy < 0 || xx >= st->width || yy >= st->height) {break;}
 
732
      r = cx*cx + cy*cy;
 
733
      if (r > r2) break;
 
734
      buf[xx + yy*st->width] =
 
735
        (short)(dheight * sinc(st, sqrt(r)/radius));
731
736
    }
732
737
}
733
738
 
951
956
  st->window = win;
952
957
  st->iterations = 0;
953
958
  st->delay = get_integer_resource(disp, "delay", "Integer");
 
959
  st->duration = get_integer_resource (st->dpy, "duration", "Seconds");
954
960
  st->rate = get_integer_resource(disp, "rate", "Integer");
955
961
  st->box = get_integer_resource(disp, "box", "Integer");
956
962
  st->oily = get_boolean_resource(disp, "oily", "Boolean");
963
969
#endif /* HAVE_XSHM_EXTENSION */
964
970
  st->light = get_integer_resource(disp, "light", "Integer");
965
971
 
 
972
  if (st->delay < 0) st->delay = 0;
 
973
  if (st->duration < 1) st->duration = 1;
966
974
  if (st->fluidity <= 1) st->fluidity = 1;
967
975
  if (st->fluidity > 16) st->fluidity = 16; /* 16 = sizeof(short) */
968
976
  if (st->light < 0) st->light = 0;
1021
1029
      if (! st->img_loader) {  /* just finished */
1022
1030
        XWindowAttributes xgwa;
1023
1031
        XGetWindowAttributes(st->dpy, st->window, &xgwa);
 
1032
        st->start_time = time ((time_t) 0);
1024
1033
        st->orig_map = XGetImage (st->dpy, st->window, 0, 0, 
1025
1034
                                  xgwa.width, xgwa.height,
1026
1035
                                  ~0L, ZPixmap);
1029
1038
      return st->delay;
1030
1039
    }
1031
1040
 
 
1041
    if (!st->img_loader &&
 
1042
        st->start_time + st->duration < time ((time_t) 0)) {
 
1043
      XWindowAttributes xgwa;
 
1044
      XGetWindowAttributes(st->dpy, st->window, &xgwa);
 
1045
      st->img_loader = load_image_async_simple (0, xgwa.screen, st->window,
 
1046
                                                st->window, 0, 0);
 
1047
      st->start_time = time ((time_t) 0);
 
1048
      return st->delay;
 
1049
    }
 
1050
 
1032
1051
    if (st->rate > 0 && (st->iterations % st->rate) == 0)
1033
1052
      add_drop(st, ripple_blob, -SPLASH);
1034
1053
    if (st->stir)
1071
1090
  "*colors:             200",
1072
1091
  "*dontClearRoot:      True",
1073
1092
  "*delay:              50000",
 
1093
  "*duration:           120",
1074
1094
  "*rate:               5",
1075
1095
  "*box:                0",
1076
 
  "*water:              False",
 
1096
  "*water:              True",
1077
1097
  "*oily:               False",
1078
1098
  "*stir:               False",
1079
1099
  "*fluidity:           6",
1080
 
  "*light:              0",
 
1100
  "*light:              4",
1081
1101
  "*grayscale:          False",
1082
1102
#ifdef HAVE_XSHM_EXTENSION
1083
1103
  "*useSHM: True",
1092
1112
  { "-colors",  ".colors",      XrmoptionSepArg, 0},
1093
1113
  { "-colours", ".colors",      XrmoptionSepArg, 0},
1094
1114
  {"-delay",    ".delay",       XrmoptionSepArg, 0},
 
1115
  {"-duration", ".duration",    XrmoptionSepArg, 0 },
1095
1116
  {"-rate",     ".rate",        XrmoptionSepArg, 0},
1096
1117
  {"-box",      ".box",         XrmoptionSepArg, 0},
1097
1118
  {"-water",    ".water",       XrmoptionNoArg, "True"},