Skip to content

Commit 7241be3

Browse files
committed
Tweak format settings and reformat files.
1 parent 5fd7d1c commit 7241be3

35 files changed

+2894
-2884
lines changed

.clang-format

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,13 @@ Language: Cpp
77
# Force pointers to the type for C++.
88
# DerivePointerAlignment: false
99
# PointerAlignment: Right
10-
ColumnLimit: 80
10+
ColumnLimit: 0
11+
SortIncludes: Never
12+
NamespaceIndentation: All
13+
AllowShortFunctionsOnASingleLine: All
14+
SpaceBeforeParens: Custom
15+
SpaceBeforeParensOptions:
16+
AfterControlStatements: true
17+
BreakBeforeBraces: Custom
18+
BraceWrapping:
19+
BeforeLambdaBody: true

include/pyro/color.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Pyro
1111
{
1212
class Color
1313
{
14-
private:
14+
private:
1515
float _hue{0.0f};
1616
float _saturation{0.0f};
1717
float _lightness{0.0f};
@@ -26,7 +26,7 @@ namespace Pyro
2626
void update_hsl();
2727
void update_rgb();
2828

29-
public:
29+
public:
3030
float r();
3131
float g();
3232
float b();
@@ -155,7 +155,7 @@ namespace Pyro
155155
{
156156
std::vector<Pyro::Color> colors;
157157

158-
public:
158+
public:
159159
Palette();
160160
unsigned int add(Color col);
161161
Color get(unsigned int index);
@@ -182,6 +182,6 @@ namespace Pyro
182182
183183
*/
184184

185-
}
185+
} // namespace Pyro
186186

187187
#endif

include/pyro/constants.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ namespace Pyro
6868
const int SOFT_LIGHT{1 << 11};
6969
const int DODGE{1 << 12};
7070
const int BURN{1 << 13};
71-
}
71+
} // namespace Pyro
7272

7373
#endif

include/pyro/font.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ namespace Pyro
88

99
class Font
1010
{
11-
private:
11+
private:
1212
std::filesystem::path filename{""};
1313

14-
public:
14+
public:
1515
explicit Font(std::filesystem::path filename);
1616
static Font *load(std::filesystem::path filename);
1717
FontImpl *impl;
1818
};
1919

2020
Font *create_font(std::filesystem::path filename, int size);
21-
}
21+
} // namespace Pyro
2222
#endif

include/pyro/font_impl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespace Pyro
99
{
1010
class FontImpl
1111
{
12-
private:
12+
private:
1313
std::filesystem::path filename{""};
1414
FT_Face face{nullptr};
1515

16-
public:
16+
public:
1717
explicit FontImpl(std::filesystem::path filename);
1818
FT_Face get_ft_face() { return this->face; };
1919
};
20-
}
20+
} // namespace Pyro
2121
#endif

include/pyro/graphics.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Pyro
2222

2323
class Graphics : public Image
2424
{
25-
protected:
25+
protected:
2626
GraphicsMode mode;
2727
std::filesystem::path filename{""};
2828

@@ -33,7 +33,7 @@ namespace Pyro
3333
Transformer2D transformer;
3434
StyleStack style;
3535

36-
public:
36+
public:
3737
Graphics(unsigned int width, unsigned int height, std::filesystem::path filename = "");
3838
virtual ~Graphics() override;
3939

@@ -44,14 +44,14 @@ namespace Pyro
4444
this->style.imagemode(mode);
4545
};
4646
void image(Image *img, float x, float y);
47-
virtual void image_impl(Image * /*img*/, float /*x*/, float /*y*/) {};
47+
virtual void image_impl(Image * /*img*/, float /*x*/, float /*y*/){};
4848
Image *loadimage(std::filesystem::path const &filename) { return Image::load(filename); };
4949

5050
// Color functions
5151
void nostroke();
5252
void nofill();
5353

54-
virtual void blendmode(int /*mode*/) {};
54+
virtual void blendmode(int /*mode*/){};
5555
void colormode(int mode)
5656
{
5757
this->style.colormode(mode);
@@ -124,7 +124,7 @@ namespace Pyro
124124
};
125125
virtual void background(float r, float g, float b, float a = 1.0);
126126

127-
virtual void shape(Shape /*s*/, float /*x*/, float /*y*/) {};
127+
virtual void shape(Shape /*s*/, float /*x*/, float /*y*/){};
128128

129129
void beginshape(int kind = DEFAULT)
130130
{
@@ -172,7 +172,7 @@ namespace Pyro
172172
void point(float x, float y);
173173
void point(Vector p);
174174
virtual void line(Vector /*p0*/, Vector /*p1*/){};
175-
virtual void line(float /*x0*/, float /*y0*/, float /*x1*/, float /*y1*/) {};
175+
virtual void line(float /*x0*/, float /*y0*/, float /*x1*/, float /*y1*/){};
176176
void curve(Vector p0, Vector p1, Vector p2, Vector p3);
177177
void curve(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3);
178178
void bezier(Vector p0, Vector p1, Vector p2, Vector p3);
@@ -215,8 +215,8 @@ namespace Pyro
215215
void text(std::string const &text, float x, float y);
216216
void textfont(Font *font);
217217

218-
virtual void textfont_impl(Font * /*font*/) {};
219-
virtual void text_impl(std::string /*text*/, float /*x*/, float /*y*/) {};
218+
virtual void textfont_impl(Font * /*font*/){};
219+
virtual void text_impl(std::string /*text*/, float /*x*/, float /*y*/){};
220220
};
221221
/**
222222
* Create a graphics object
@@ -230,6 +230,6 @@ namespace Pyro
230230
std::filesystem::path filename = "");
231231

232232
Graphics *creategraphics(unsigned int width, unsigned int height, int dpi, Unit unit, GraphicsMode mode = GraphicsMode::CAIRO, std::filesystem::path filename = "");
233-
};
233+
}; // namespace Pyro
234234

235235
#endif

include/pyro/graphics_cairo.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace Pyro
1010
{
1111
class GraphicsCairo : public Graphics
1212
{
13-
private:
13+
private:
1414
cairo_surface_t *surface{nullptr};
1515
cairo_t *cr{nullptr};
1616

1717
cairo_font_face_t *font{nullptr};
1818

19-
public:
19+
public:
2020
GraphicsCairo(unsigned int width, unsigned int height,
2121
GraphicsMode mode = GraphicsMode::CAIRO,
2222
std::filesystem::path filename = "");
@@ -47,6 +47,6 @@ namespace Pyro
4747
void text_impl(std::string text, float x, float y) override;
4848
void textfont_impl(Font *font) override;
4949
};
50-
}
50+
} // namespace Pyro
5151

5252
#endif

include/pyro/image.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Pyro
2323

2424
class Image
2525
{
26-
private:
26+
private:
2727
bool pixels_locked{false};
2828
void *cache{nullptr};
2929
uint32_t *data{nullptr};
@@ -38,7 +38,7 @@ namespace Pyro
3838
int destX1, int destY1, int destX2, int destY2,
3939
unsigned int mode);
4040

41-
protected:
41+
protected:
4242
unsigned int _width{0};
4343
unsigned int _height{0};
4444
unsigned int _pixelwidth{0};
@@ -50,7 +50,7 @@ namespace Pyro
5050
int mx1{0}, my1{0}, mx2{0}, my2{0};
5151
bool initialized{false};
5252

53-
public:
53+
public:
5454
unsigned int format{ARGB};
5555
unsigned int width() { return this->_pixelwidth; };
5656
unsigned int height() { return this->_pixelheight; };
@@ -114,5 +114,5 @@ namespace Pyro
114114
};
115115

116116
Image *createimage(unsigned int width, unsigned int height, int format = RGB);
117-
}
117+
} // namespace Pyro
118118
#endif

include/pyro/noise.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ namespace Pyro
88
double noise(double x, double y);
99
double noise(double x, double y, double z);
1010
double noise(double x, double y, double z, double w);
11-
}
11+
} // namespace Pyro
1212

1313
#endif

include/pyro/pyro.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ namespace Pyro
9393
inline void beziervertex(float x2, float y2, float x3, float y3, float x4, float y4) { pg->beziervertex(x2, y2, x3, y3, x4, y4); };
9494
inline void beziervertex(Vector p2, Vector p3, Vector p4) { pg->beziervertex(p2, p3, p4); };
9595

96-
inline void curve(Vector p0, Vector p1, Vector p2, Vector p3) { pg->curve( p0, p1, p2, p3); };
97-
inline void curve(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) { pg->curve( x0, y0, x1, y1, x2, y2, x3, y3); };
98-
inline void bezier(Vector p0, Vector p1, Vector p2, Vector p3) { pg->bezier( p0, p1, p2, p3); };
99-
inline void bezier(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) { pg->bezier( x0, y0, x1, y1, x2, y2, x3, y3); };
96+
inline void curve(Vector p0, Vector p1, Vector p2, Vector p3) { pg->curve(p0, p1, p2, p3); };
97+
inline void curve(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) { pg->curve(x0, y0, x1, y1, x2, y2, x3, y3); };
98+
inline void bezier(Vector p0, Vector p1, Vector p2, Vector p3) { pg->bezier(p0, p1, p2, p3); };
99+
inline void bezier(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) { pg->bezier(x0, y0, x1, y1, x2, y2, x3, y3); };
100100

101101
inline void point(float x, float y) { pg->point(x, y); };
102102
inline void point(Vector p) { pg->point(p); };

include/pyro/runner.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Pyro
88
{
99
class Runner
1010
{
11-
public:
11+
public:
1212
std::function<void()> keypressed_cb{nullptr};
1313
std::function<void()> mousepressed_cb{nullptr};
14-
Runner() : running(true) {};
15-
Runner(const Runner & /*in*/) {};
14+
Runner() : running(true){};
15+
Runner(const Runner & /*in*/){};
1616
Runner &operator=(const Runner & /*in*/) { return *this; };
17-
virtual ~Runner() {};
17+
virtual ~Runner(){};
1818

1919
virtual int update()
2020
{
@@ -79,6 +79,6 @@ namespace Pyro
7979

8080
extern bool running;
8181
extern Runner *pyro;
82-
}
82+
} // namespace Pyro
8383

8484
#endif

include/pyro/sdl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Pyro
88
{
99
class SDLRunner : public Runner
1010
{
11-
protected:
11+
protected:
1212
SDL_Window *sdl_window{nullptr};
1313
SDL_Renderer *sdl_renderer{nullptr};
1414
SDL_Texture *sdl_texture{nullptr};
@@ -21,7 +21,7 @@ namespace Pyro
2121
unsigned int width;
2222
unsigned int height;
2323

24-
public:
24+
public:
2525
explicit SDLRunner(bool headless = false);
2626
SDLRunner(const SDLRunner &in);
2727
SDLRunner &operator=(const SDLRunner &in);
@@ -30,6 +30,6 @@ namespace Pyro
3030
int quit() override;
3131
int init(unsigned int width, unsigned int height) override;
3232
};
33-
}
33+
} // namespace Pyro
3434

3535
#endif

include/pyro/shape.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ namespace Pyro
1616
const int QUADS{6};
1717
const int QUAD_STRIP{7};
1818

19-
2019
template <typename T>
2120
T bezierpoint(T a, T b, T c, T d, float t)
2221
{
2322
float t1 = 1.0f - t;
24-
return (a*t1 + 3*b*t)*t1*t1 + (3*c*t1 + d*t)*t*t;
23+
return (a * t1 + 3 * b * t) * t1 * t1 + (3 * c * t1 + d * t) * t * t;
2524
};
2625

2726
template <typename T>
@@ -55,7 +54,7 @@ namespace Pyro
5554
std::vector<std::vector<Pyro::t_shapepoint>> contours{std::vector<std::vector<Pyro::t_shapepoint>>()};
5655
int kind{DEFAULT};
5756

58-
public:
57+
public:
5958
int close{false};
6059
Shape();
6160
~Shape();
@@ -74,5 +73,5 @@ namespace Pyro
7473
void beziervertex(float x2, float y2, float x3, float y3, float x4, float y4) { this->beziervertex(Vector(x2, y2), Vector(x3, y3), Vector(x4, y4)); };
7574
std::vector<std::vector<Pyro::Vector>> getpoints() { return this->outpoints; };
7675
};
77-
};
76+
}; // namespace Pyro
7877
#endif

include/pyro/style.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ namespace Pyro
4343

4444
class StyleStack
4545
{
46-
private:
46+
private:
4747
std::vector<t_style> stack;
4848
t_style current;
4949

50-
public:
50+
public:
5151
StyleStack();
5252
void push();
5353
void pop();
@@ -79,6 +79,6 @@ namespace Pyro
7979
void strokejoin(int join);
8080
int strokejoin();
8181
};
82-
}
82+
} // namespace Pyro
8383

8484
#endif

include/pyro/transformer.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ namespace Pyro
99
{
1010
class Transformer2D
1111
{
12-
private:
12+
private:
1313
std::vector<Eigen::Affine2d> stack;
1414
Eigen::Affine2d current;
1515

16-
public:
16+
public:
1717
Transformer2D();
1818
void translate(Vector v);
1919
void translate(float x, float y);
@@ -36,5 +36,5 @@ namespace Pyro
3636
float screen_y(float x, float y, float z = 0.0f) { return this->screen_y(Vector(x, y, z)); };
3737
};
3838

39-
}
39+
} // namespace Pyro
4040
#endif

include/pyro/utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ namespace Pyro
3939
}
4040
};
4141

42-
}
42+
} // namespace Pyro
4343

4444
#endif

include/pyro/vector.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Pyro
88
{
99
class Vector
1010
{
11-
public:
11+
public:
1212
float x{};
1313
float y{};
1414
float z{};
@@ -147,6 +147,6 @@ namespace Pyro
147147

148148
Vector operator*(float const f, Vector const v);
149149

150-
}
150+
} // namespace Pyro
151151

152152
#endif

0 commit comments

Comments
 (0)