mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-07 10:21:30 +00:00
Fix .gpl loader to ignore extra properties in the file
This commit is contained in:
parent
1ab782b85d
commit
6aa4149dec
@ -30,6 +30,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
namespace raster {
|
namespace raster {
|
||||||
namespace file {
|
namespace file {
|
||||||
@ -56,8 +57,13 @@ Palette* load_gpl_file(const char *filename)
|
|||||||
if (line.empty() || line[0] == '#')
|
if (line.empty() || line[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Remove properties (TODO add these properties in the palette)
|
||||||
|
if (!std::isdigit(line[0]))
|
||||||
|
continue;
|
||||||
|
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
std::istringstream lineIn(line);
|
std::istringstream lineIn(line);
|
||||||
|
// TODO add support to read the color name
|
||||||
lineIn >> r >> g >> b;
|
lineIn >> r >> g >> b;
|
||||||
if (lineIn.good()) {
|
if (lineIn.good()) {
|
||||||
pal->setEntry(entryCounter, rgba(r, g, b, 255));
|
pal->setEntry(entryCounter, rgba(r, g, b, 255));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user