~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/ghost/test/multitest/Basic.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "Basic.h"
29
29
 
30
 
int min_i(int a, int b) { 
31
 
        return (a<b)?a:b; 
32
 
}
33
 
int max_i(int a, int b) {
34
 
        return (b<a)?a:b; 
35
 
}
36
 
int clamp_i(int val, int min, int max) { 
 
30
int min_i(int a, int b)
 
31
{
 
32
        return (a < b) ? a : b;
 
33
}
 
34
int max_i(int a, int b)
 
35
{
 
36
        return (b < a) ? a : b;
 
37
}
 
38
int clamp_i(int val, int min, int max)
 
39
{
37
40
        return min_i(max_i(val, min), max);
38
41
}
39
42
 
40
 
float min_f(float a, float b) { 
41
 
        return (a<b)?a:b; 
42
 
}
43
 
float max_f(float a, float b) { 
44
 
        return (b<a)?a:b; 
45
 
}
46
 
float clamp_f(float val, float min, float max) { 
 
43
float min_f(float a, float b)
 
44
{
 
45
        return (a < b) ? a : b;
 
46
}
 
47
float max_f(float a, float b)
 
48
{
 
49
        return (b < a) ? a : b;
 
50
}
 
51
float clamp_f(float val, float min, float max)
 
52
{
47
53
        return min_f(max_f(val, min), max);
48
54
}
49
55
 
50
 
void rect_copy(int dst[2][2], int src[2][2]) {
51
 
        dst[0][0]= src[0][0], dst[0][1]= src[0][1];
52
 
        dst[1][0]= src[1][0], dst[1][1]= src[1][1];
 
56
void rect_copy(int dst[2][2], int src[2][2])
 
57
{
 
58
        dst[0][0] = src[0][0], dst[0][1] = src[0][1];
 
59
        dst[1][0] = src[1][0], dst[1][1] = src[1][1];
53
60
}
54
 
int rect_contains_pt(int rect[2][2], int pt[2]){
 
61
int rect_contains_pt(int rect[2][2], int pt[2])
 
62
{
55
63
        return ((rect[0][0] <= pt[0] && pt[0] <= rect[1][0]) &&
56
 
                        (rect[0][1] <= pt[1] && pt[1] <= rect[1][1]));
57
 
}
58
 
int rect_width(int rect[2][2]) {
59
 
        return (rect[1][0]-rect[0][0]);
60
 
}
61
 
int rect_height(int rect[2][2]) {
62
 
        return (rect[1][1]-rect[0][1]);
 
64
                (rect[0][1] <= pt[1] && pt[1] <= rect[1][1]));
 
65
}
 
66
int rect_width(int rect[2][2])
 
67
{
 
68
        return (rect[1][0] - rect[0][0]);
 
69
}
 
70
int rect_height(int rect[2][2])
 
71
{
 
72
        return (rect[1][1] - rect[0][1]);
63
73
}