Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Nov 16, 2024
1 parent 654db69 commit 8228e6b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ color::color(const std::string &hex) : color(0, 0, 0, 255) {
}

color::color(uint32_t pixel, const SDL_PixelFormat *format) {
std::array<uint8_t, 4> rgba;
SDL_GetRGBA(pixel, format, &rgba[0], &rgba[1], &rgba[2], &rgba[3]);
_r = rgba[0];
_g = rgba[1];
_b = rgba[2];
_a = rgba[3];
uint8_t r, g, b, a;

Check warning on line 27 in src/color.cpp

View workflow job for this annotation

GitHub Actions / lint

src/color.cpp:27:3 [readability-isolate-declaration]

multiple declarations in a single statement reduces readability

Check warning on line 27 in src/color.cpp

View workflow job for this annotation

GitHub Actions / lint

src/color.cpp:27:11 [cppcoreguidelines-init-variables]

variable 'r' is not initialized

Check warning on line 27 in src/color.cpp

View workflow job for this annotation

GitHub Actions / lint

src/color.cpp:27:14 [cppcoreguidelines-init-variables]

variable 'g' is not initialized

Check warning on line 27 in src/color.cpp

View workflow job for this annotation

GitHub Actions / lint

src/color.cpp:27:17 [cppcoreguidelines-init-variables]

variable 'b' is not initialized

Check warning on line 27 in src/color.cpp

View workflow job for this annotation

GitHub Actions / lint

src/color.cpp:27:20 [cppcoreguidelines-init-variables]

variable 'a' is not initialized
SDL_GetRGBA(pixel, format, &r, &g, &b, &a);
_r = r;
_g = g;
_b = b;
_a = a;
}

bool color::operator==(const color &other) const noexcept {

Check warning on line 35 in src/color.cpp

View workflow job for this annotation

GitHub Actions / lint

src/color.cpp:35:13 [modernize-use-trailing-return-type]

use a trailing return type for this function
Expand Down

0 comments on commit 8228e6b

Please sign in to comment.