~gordallott/unity/hud

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/ResultViewGrid.cpp

  • Committer: Gord Allott
  • Date: 2012-01-27 09:49:12 UTC
  • mfrom: (1737.95.27 unity)
  • Revision ID: gord.allott@canonical.com-20120127094912-3ojyykjf7js35f4l
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
626
626
        int half_width = recorded_dash_width_ / 2;
627
627
        int half_height = recorded_dash_height_;
628
628
 
629
 
        int offset_x = MAX(MIN((x_position - half_width) / (half_width / 10), 5), -5);
630
 
        int offset_y = MAX(MIN(((y_position + absolute_y) - half_height) / (half_height / 10), 5), -5);
 
629
        int offset_x, offset_y;
 
630
 
 
631
        /* Guard against divide-by-zero. SIGFPEs are not mythological
 
632
         * contrary to popular belief */
 
633
        if (half_width >= 10)
 
634
          offset_x = MAX(MIN((x_position - half_width) / (half_width / 10), 5), -5);
 
635
        else
 
636
          offset_x = 0;
 
637
 
 
638
        if (half_height >= 10)
 
639
          offset_y = MAX(MIN(((y_position + absolute_y) - half_height) / (half_height / 10), 5), -5);
 
640
        else
 
641
          offset_y = 0;
631
642
 
632
643
        if (recorded_dash_width_ < 1 || recorded_dash_height_ < 1)
633
644
        {