Update contrib.
1 /* Copyright (c) 2009 The Khronos Group Inc.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and/or associated documentation files (the
5 * "Materials"), to deal in the Materials without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Materials, and to
8 * permit persons to whom the Materials are furnished to do so, subject to
9 * the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Materials.
14 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29 OWFint min(OWFint aLhs, OWFint aRhs)
37 void OWF_Rect_Set(OWF_RECTANGLE* rect,
50 rect->height = height;
53 OWFboolean OWF_Rect_Clip(OWF_RECTANGLE* clipped,
55 OWF_RECTANGLE* bounds)
57 OWFint dw, dh, dx0, dy0, dx1, dy1; /* destination image coordinates */
58 OWFint bl, bt, br, bb;
62 br = bl + bounds->width;
63 bb = bt + bounds->height;
70 /* Crop x coords to target image width */
76 /* check if destination rectangle is outside target image */
81 /* Crop y coord to target image height */
87 /* check if destination rectangle is outside target image */
92 /* clamp right edge */
96 } else if (dx1 < bl) {
100 /* clamp bottom edge */
104 } else if (dy1 < bt) {
110 clipped->width = dx1 - dx0;
111 clipped->height = dy1 - dy0;