~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/blenlib/intern/rct.c

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * 
5
5
 * april 95
6
6
 * 
7
 
 * $Id: rct.c,v 1.3 2002/11/25 12:01:55 mein Exp $
 
7
 * $Id: rct.c,v 1.4 2006/01/28 18:33:07 hos Exp $
8
8
 *
9
9
 * A minimalist lib for functions doing stuff with rectangle structs.
10
10
 *
87
87
        rect->ymin= ymin;
88
88
        rect->ymax= ymax;
89
89
}
 
90
void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
 
91
{
 
92
        rect->xmin= xmin;
 
93
        rect->xmax= xmax;
 
94
        rect->ymin= ymin;
 
95
        rect->ymax= ymax;
 
96
}
 
97
 
 
98
void BLI_translate_rcti(rcti *rect, int x, int y)
 
99
{
 
100
        rect->xmin += x;
 
101
        rect->ymin += y;
 
102
        rect->xmax += x;
 
103
        rect->ymax += y;
 
104
}
 
105
void BLI_translate_rctf(rctf *rect, float x, float y)
 
106
{
 
107
        rect->xmin += x;
 
108
        rect->ymin += y;
 
109
        rect->xmax += x;
 
110
        rect->ymax += y;
 
111
}
90
112
 
91
113
int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
92
114
{
117
139
                return 0;
118
140
        }
119
141
}
 
142
 
 
143
int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
 
144
{
 
145
        int xmin, xmax;
 
146
        int ymin, ymax;
 
147
        
 
148
        xmin = (src1->xmin) > (src2->xmin) ? (src1->xmin) : (src2->xmin);
 
149
        xmax = (src1->xmax) < (src2->xmax) ? (src1->xmax) : (src2->xmax);
 
150
        ymin = (src1->ymin) > (src2->ymin) ? (src1->ymin) : (src2->ymin);
 
151
        ymax = (src1->ymax) < (src2->ymax) ? (src1->ymax) : (src2->ymax);
 
152
        
 
153
        if(xmax>=xmin && ymax>=ymin) {
 
154
                if(dest) {
 
155
                        dest->xmin = xmin;
 
156
                        dest->xmax = xmax;
 
157
                        dest->ymin = ymin;
 
158
                        dest->ymax = ymax;
 
159
                }
 
160
                return 1;
 
161
        }
 
162
        else {
 
163
                if(dest) {
 
164
                        dest->xmin = 0;
 
165
                        dest->xmax = 0;
 
166
                        dest->ymin = 0;
 
167
                        dest->ymax = 0;
 
168
                }
 
169
                return 0;
 
170
        }
 
171
}