Skip to content

Commit 5f4007d

Browse files
committed
Change tabs to 8 spaces
This change should eliminate all tabs in source files and the strange mix of tabs/spaces that was originally used during development. The chosen standard is to indent exclusively using spaces and to use 4 spaces for a new scope.
1 parent 39b8b1d commit 5f4007d

21 files changed

+2810
-2811
lines changed

Color.h

+71-71
Original file line numberDiff line numberDiff line change
@@ -30,91 +30,91 @@
3030
class Color {
3131
public:
3232
Color()
33-
: myR(0), myG(0), myB(0) {}
33+
: myR(0), myG(0), myB(0) {}
3434
Color(float r, float g, float b)
35-
: myR(r), myG(g), myB(b) {}
35+
: myR(r), myG(g), myB(b) {}
3636
Color(uint32 val)
3737
{
38-
myB = (val & 0xFF) / 255.0F; val >>= 8;
39-
myG = (val & 0xFF) / 255.0F; val >>= 8;
40-
myR = (val & 0xFF) / 255.0F;
38+
myB = (val & 0xFF) / 255.0F; val >>= 8;
39+
myG = (val & 0xFF) / 255.0F; val >>= 8;
40+
myR = (val & 0xFF) / 255.0F;
4141
}
4242

43-
uint32 toInt32() const
44-
{
45-
return 0xFF000000 |
46-
(ftoc(myB) << 16) |
47-
(ftoc(myG) << 8) |
48-
(ftoc(myR));
49-
}
50-
51-
float luminance() const
52-
{
53-
return 0.3*myR + 0.6*myG + 0.1*myB;
54-
}
55-
56-
Color operator+(const Color &rhs) const
57-
{
58-
return Color(
59-
myR+rhs.myR,
60-
myG+rhs.myG,
61-
myB+rhs.myB);
62-
}
63-
Color operator*(float scale) const
64-
{
65-
return Color(myR*scale, myG*scale, myB*scale);
66-
}
67-
Color lerp(const Color &rhs, float bias) const
68-
{
69-
QColor c1(QColor(toInt32()).toHsv());
70-
QColor c2(QColor(rhs.toInt32()).toHsv());
71-
72-
// Lerp in HSV space
73-
float h = lerpHue((float)c1.hsvHueF(),
74-
(float)c2.hsvHueF(), bias);
75-
float s = SYSlerp((float)c1.hsvSaturationF(),
76-
(float)c2.hsvSaturationF(), bias);
77-
float l = SYSlerp((float)c1.lightnessF(),
78-
(float)c2.lightnessF(), bias);
79-
80-
QColor c3(QColor::fromHsvF(h, s, l));
81-
82-
return Color(c3.redF(), c3.greenF(), c3.blueF());
83-
}
84-
85-
void fromHSV(float h, float s, float v)
86-
{
87-
QColor c(QColor::fromHsvF(h, s, v));
88-
89-
*this = Color(c.redF(), c.greenF(), c.blueF());
90-
}
43+
uint32 toInt32() const
44+
{
45+
return 0xFF000000 |
46+
(ftoc(myB) << 16) |
47+
(ftoc(myG) << 8) |
48+
(ftoc(myR));
49+
}
50+
51+
float luminance() const
52+
{
53+
return 0.3*myR + 0.6*myG + 0.1*myB;
54+
}
55+
56+
Color operator+(const Color &rhs) const
57+
{
58+
return Color(
59+
myR+rhs.myR,
60+
myG+rhs.myG,
61+
myB+rhs.myB);
62+
}
63+
Color operator*(float scale) const
64+
{
65+
return Color(myR*scale, myG*scale, myB*scale);
66+
}
67+
Color lerp(const Color &rhs, float bias) const
68+
{
69+
QColor c1(QColor(toInt32()).toHsv());
70+
QColor c2(QColor(rhs.toInt32()).toHsv());
71+
72+
// Lerp in HSV space
73+
float h = lerpHue((float)c1.hsvHueF(),
74+
(float)c2.hsvHueF(), bias);
75+
float s = SYSlerp((float)c1.hsvSaturationF(),
76+
(float)c2.hsvSaturationF(), bias);
77+
float l = SYSlerp((float)c1.lightnessF(),
78+
(float)c2.lightnessF(), bias);
79+
80+
QColor c3(QColor::fromHsvF(h, s, l));
81+
82+
return Color(c3.redF(), c3.greenF(), c3.blueF());
83+
}
84+
85+
void fromHSV(float h, float s, float v)
86+
{
87+
QColor c(QColor::fromHsvF(h, s, v));
88+
89+
*this = Color(c.redF(), c.greenF(), c.blueF());
90+
}
9191

9292
private:
9393
static uint32 ftoc(float v)
94-
{
95-
v *= 255.0F;
96-
return SYSclamp((int)v, 0, 255);
97-
}
94+
{
95+
v *= 255.0F;
96+
return SYSclamp((int)v, 0, 255);
97+
}
9898

9999
static float lerpHue(float h1, float h2, float bias)
100-
{
101-
h1 = SYSclamp(h1, 0.0F, 1.0F);
102-
h2 = SYSclamp(h2, 0.0F, 1.0F);
103-
if (h2 > h1 + 0.5F)
104-
h1 += 1;
105-
else if (h1 > h2 + 0.5F)
106-
h2 += 1;
100+
{
101+
h1 = SYSclamp(h1, 0.0F, 1.0F);
102+
h2 = SYSclamp(h2, 0.0F, 1.0F);
103+
if (h2 > h1 + 0.5F)
104+
h1 += 1;
105+
else if (h1 > h2 + 0.5F)
106+
h2 += 1;
107107

108-
float h = SYSlerp(h1, h2, bias);
109-
if (h > 1) h -= 1;
110-
return h;
111-
}
108+
float h = SYSlerp(h1, h2, bias);
109+
if (h > 1) h -= 1;
110+
return h;
111+
}
112112

113113

114114
private:
115-
float myR;
116-
float myG;
117-
float myB;
115+
float myR;
116+
float myG;
117+
float myB;
118118
};
119119

120120
#endif

0 commit comments

Comments
 (0)