// pass the FILE pointer to libpng
png_init_io(png_ptr, file);
- // TODO BEGIN
// have libpng process the png data
png_read_png(png_ptr, png_info_ptr, PNG_TRANSFORM_IDENTITY, nullptr);
<< '"' << std::endl;
return;
}
- value = (float)int_input / max_value;
+ value = static_cast<float>(int_input) / max_value;
data_.push_back(std::round(value * 255.0F));
}
} else if (str_input.compare("P5") == 0) {
std::cout << "WARNING: File data after PGM max is not whitespace "
"(filename \""
<< filename << "\")"
- << " value is " << (int)c << std::endl;
+ << " value is " << c << std::endl;
}
if (!ifs.good()) {
<< '"' << std::endl;
return;
}
- value = (float)int_input / max_value;
+ value = static_cast<float>(int_input) / max_value;
data_.push_back(std::round(value * 255.0F));
if (i % 3 == 2) {
// PPM is RGB but Image stores as RGBA
if (c != '\n' && c != ' ') {
std::cout
<< "WARNING: File data after PPM max is not whitespace (filename \""
- << filename << "\") value is " << (int)c << std::endl;
+ << filename << "\") value is " << c << std::endl;
}
if (!ifs.good()) {
* Image supports decoding .png, .pgm, and .ppm . Decoding only checks the
* filename suffix as a guide on which file-type to expect.
*/
- Image(const char *filename);
+ explicit Image(const char *filename);
/// Same constructor as Image(const char *filename)
- Image(const std::string &filename);
+ explicit Image(const std::string &filename);
// allow copy
Image(const Image &other) = default;
#include "image.h"
int main(int argc, char **argv) {
- //Image image("testin.ppm");
- //image.SaveAsPNG("testout.png", true);
+ // Image image("testin.ppm");
+ // image.SaveAsPNG("testout.png", true);
return 0;
}
}
cl_context_properties context_properties[] = {
- CL_CONTEXT_PLATFORM, (cl_context_properties)first_platform_id, 0};
+ CL_CONTEXT_PLATFORM,
+ static_cast<cl_context_properties>(first_platform_id), 0};
context_ = clCreateContextFromType(context_properties, CL_DEVICE_TYPE_GPU,
nullptr, nullptr, &err_num);