clang-tidy/clang-format fixes
This commit is contained in:
parent
ddb83ac7fc
commit
4f78d92bc8
4 changed files with 10 additions and 10 deletions
|
@ -272,7 +272,6 @@ void Image::DecodePNG(const std::string &filename) {
|
||||||
// pass the FILE pointer to libpng
|
// pass the FILE pointer to libpng
|
||||||
png_init_io(png_ptr, file);
|
png_init_io(png_ptr, file);
|
||||||
|
|
||||||
// TODO BEGIN
|
|
||||||
// have libpng process the png data
|
// have libpng process the png data
|
||||||
png_read_png(png_ptr, png_info_ptr, PNG_TRANSFORM_IDENTITY, nullptr);
|
png_read_png(png_ptr, png_info_ptr, PNG_TRANSFORM_IDENTITY, nullptr);
|
||||||
|
|
||||||
|
@ -404,7 +403,7 @@ void Image::DecodePGM(const std::string &filename) {
|
||||||
<< '"' << std::endl;
|
<< '"' << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
value = (float)int_input / max_value;
|
value = static_cast<float>(int_input) / max_value;
|
||||||
data_.push_back(std::round(value * 255.0F));
|
data_.push_back(std::round(value * 255.0F));
|
||||||
}
|
}
|
||||||
} else if (str_input.compare("P5") == 0) {
|
} else if (str_input.compare("P5") == 0) {
|
||||||
|
@ -453,7 +452,7 @@ void Image::DecodePGM(const std::string &filename) {
|
||||||
std::cout << "WARNING: File data after PGM max is not whitespace "
|
std::cout << "WARNING: File data after PGM max is not whitespace "
|
||||||
"(filename \""
|
"(filename \""
|
||||||
<< filename << "\")"
|
<< filename << "\")"
|
||||||
<< " value is " << (int)c << std::endl;
|
<< " value is " << c << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ifs.good()) {
|
if (!ifs.good()) {
|
||||||
|
@ -557,7 +556,7 @@ void Image::DecodePPM(const std::string &filename) {
|
||||||
<< '"' << std::endl;
|
<< '"' << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
value = (float)int_input / max_value;
|
value = static_cast<float>(int_input) / max_value;
|
||||||
data_.push_back(std::round(value * 255.0F));
|
data_.push_back(std::round(value * 255.0F));
|
||||||
if (i % 3 == 2) {
|
if (i % 3 == 2) {
|
||||||
// PPM is RGB but Image stores as RGBA
|
// PPM is RGB but Image stores as RGBA
|
||||||
|
@ -609,7 +608,7 @@ void Image::DecodePPM(const std::string &filename) {
|
||||||
if (c != '\n' && c != ' ') {
|
if (c != '\n' && c != ' ') {
|
||||||
std::cout
|
std::cout
|
||||||
<< "WARNING: File data after PPM max is not whitespace (filename \""
|
<< "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()) {
|
if (!ifs.good()) {
|
||||||
|
|
|
@ -17,10 +17,10 @@ class Image {
|
||||||
* Image supports decoding .png, .pgm, and .ppm . Decoding only checks the
|
* Image supports decoding .png, .pgm, and .ppm . Decoding only checks the
|
||||||
* filename suffix as a guide on which file-type to expect.
|
* 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)
|
/// Same constructor as Image(const char *filename)
|
||||||
Image(const std::string &filename);
|
explicit Image(const std::string &filename);
|
||||||
|
|
||||||
// allow copy
|
// allow copy
|
||||||
Image(const Image &other) = default;
|
Image(const Image &other) = default;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
//Image image("testin.ppm");
|
// Image image("testin.ppm");
|
||||||
//image.SaveAsPNG("testout.png", true);
|
// image.SaveAsPNG("testout.png", true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -562,7 +562,8 @@ OpenCLContext::OpenCLContext() : context_(nullptr), queue_(nullptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_context_properties context_properties[] = {
|
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,
|
context_ = clCreateContextFromType(context_properties, CL_DEVICE_TYPE_GPU,
|
||||||
nullptr, nullptr, &err_num);
|
nullptr, nullptr, &err_num);
|
||||||
|
|
Loading…
Reference in a new issue