Skip to content

Commit

Permalink
Show more warnings, clean up some.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregersn committed Apr 1, 2024
1 parent 31a752e commit ee96b8c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions include/pyro/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ namespace Pyro
return !this->operator<(rhs);
}

Vector &operator=(const Vector &rhs)
// Removed 2024-04-01, not needed? Gives a lot of warnings.
/*Vector &operator=(const Vector &rhs)
{
this->x = rhs.x;
this->y = rhs.y;
this->z = rhs.z;
return *this;
}
}*/

float dist(const Vector &other) const;
float dot(const Vector &other) const;
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ project('Pyro', 'cpp',
license: 'GPLv3',
default_options: ['cpp_std=c++17'])



freetype_dep = dependency('freetype2')
libjpeg_dep = dependency('libjpeg')
libpng_dep = dependency('libpng')
Expand Down
12 changes: 6 additions & 6 deletions src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ namespace Pyro

// png_write_info(png_ptr, info_ptr);

png_bytep row_pointers[this->_pixelheight];
std::vector<png_bytep> row_pointers;

uint8_t *converted_data{nullptr};
unsigned int stride{this->_pixelwidth};
Expand Down Expand Up @@ -488,10 +488,10 @@ namespace Pyro
png_bytep data = (png_bytep)converted_data;
for (unsigned int y = 0; y < this->_pixelheight; y++)
{
row_pointers[y] = &(data[y * stride]);
row_pointers.push_back(&(data[y * stride]));
}

png_set_rows(png_ptr, info_ptr, row_pointers);
png_set_rows(png_ptr, info_ptr, &row_pointers[0]);
// png_write_image(png_ptr, row_pointers);
// png_write_end(png_ptr, NULL);
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_BGR, NULL);
Expand Down Expand Up @@ -796,9 +796,9 @@ namespace Pyro
uint32_t b = abs(int((dst & BLUE_MASK) - (src & BLUE_MASK)));
uint32_t g = abs(int((dst & GREEN_MASK) - (src & GREEN_MASK)));

uint32_t rb = (r < 0 ? -r : r) |
(b < 0 ? -b : b);
uint32_t gn = (g < 0 ? -g : g);
uint32_t rb = r |
b;
uint32_t gn = g;

return min((dst >> 24) + a, 0xFFu) << 24 |
(((dst & RB_MASK) * d_a + rb * s_a) >> 8 & RB_MASK) |
Expand Down
3 changes: 3 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cpp_args = ['-Wall', '-Wextra', '-Wpedantic',]

pyro_sources = ['pyro.cpp',
'runner.cpp',
'sdl.cpp',
Expand All @@ -19,4 +21,5 @@ pyrolib = library('pyro',
pyro_sources,
include_directories: inc_dir,
dependencies: [libpng_dep, cairo_dep, libjpeg_dep, freetype_dep, sdl_dep, eigen_dep],
cpp_args: cpp_args,
install: false)

0 comments on commit ee96b8c

Please sign in to comment.