This commit is contained in:
Honkazel 2025-02-04 12:24:19 +05:00
parent 355f3aa8eb
commit ca0fb7b941
7 changed files with 5 additions and 11 deletions

View file

@ -27,8 +27,7 @@ add_compile_options(
-Wpedantic
-Wno-unused-parameter
-Wno-unused-value
-Wno-missing-field-initializers
-Wno-narrowing)
-Wno-missing-field-initializers)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)

View file

@ -18,7 +18,7 @@ namespace Hyprgraphics {
double l = 0, a = 0, b = 0;
};
CColor(); // black
CColor() = default; // black
CColor(const SSRGB& rgb);
CColor(const SHSL& hsl);
CColor(const SOkLab& lab);

View file

@ -26,10 +26,6 @@ static double hueToRgb(double p, double q, double t) {
return p;
}
Hyprgraphics::CColor::CColor() {
;
}
Hyprgraphics::CColor::CColor(const SSRGB& rgb) : r(rgb.r), g(rgb.g), b(rgb.b) {
;
}

View file

@ -110,7 +110,7 @@ std::expected<cairo_surface_t*, std::string> BMP::createSurfaceFromBMP(const std
cairo_format_t format = CAIRO_FORMAT_ARGB32;
int stride = cairo_format_stride_for_width(format, bitmapHeader.width);
// SHIT!
// Good cast!
unsigned char* imageData = (unsigned char*)malloc(static_cast<size_t>(bitmapHeader.height * stride));
if (bitmapHeader.numberOfBitPerPixel == 24)

View file

@ -56,7 +56,7 @@ std::expected<cairo_surface_t*, std::string> PNG::createSurfaceFromPNG(const std
if (!succeededDecode && ret == SPNG_EBUFSIZ) {
// hack, but I don't know why decoded_image_size is sometimes wrong
// Because of the cast from unsigned int to unsigned long? and because of the realloc?
// Good cast! At least now it's explicit
imageLength = static_cast<size_t>(ihdr.height * ihdr.width * 4) /* FIXME: this is wrong if we doing >32bpp!!!! */;
imageData = (uint8_t*)realloc(imageData, imageLength);

View file

@ -47,7 +47,7 @@ std::expected<cairo_surface_t*, std::string> WEBP::createSurfaceFromWEBP(const s
config.options.no_fancy_upsampling = 1;
config.output.u.RGBA.rgba = CAIRODATA;
config.output.u.RGBA.stride = CAIROSTRIDE;
// SHIT!
// Really good cast!
config.output.u.RGBA.size = static_cast<size_t>(CAIROSTRIDE * HEIGHT);
config.output.is_external_memory = 1;
config.output.width = WIDTH;

View file

@ -25,7 +25,6 @@ static bool tryLoadImage(const std::string& path) {
std::string name = image.getMime();
std::ranges::replace(name, '/', '_');
// No lint?
return cairo_surface_write_to_png(image.cairoSurface()->cairo(), (TEST_DIR + "/" + name + ".png").c_str()) == CAIRO_STATUS_SUCCESS;
}