FIX: load_from_svg_file_change_color() supports 8bit colour values

JIRA: nojira
Change-Id: I72e68bd9cb547064736d130205074da0e7eabd60
(cherry picked from commit 8bdac292a0bd34786189f4ca320f646340157d2c)
This commit is contained in:
Mack 2024-07-31 16:18:09 +08:00 committed by Noisyfox
parent 94abdf8088
commit 9380260a74
2 changed files with 5 additions and 3 deletions

View file

@ -561,8 +561,10 @@ bool BitmapCache::load_from_svg_file_change_color(const std::string &filename, u
if (image == nullptr) {
return false;
}
unsigned int change_color = nsvg__parseColorHex(hexColor);
char temp_color[8];
strncpy(temp_color, hexColor, 7);
temp_color[7] = '\0';
unsigned int change_color = nsvg__parseColorHex(temp_color);
change_color |= (unsigned int) (1.0f * 255) << 24; // opacity
unsigned int green_color = 4282560000;
for (NSVGshape* shape = image->shapes; shape != nullptr; shape = shape->next) {