-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix improve the octree quantization method using better Euclidean color distance (fix #2787) #4416
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
src/app/cmd/set_pixel_format.cpp
Outdated
@@ -73,7 +73,8 @@ SetPixelFormat::SetPixelFormat(Sprite* sprite, | |||
const render::Dithering& dithering, | |||
const doc::RgbMapAlgorithm mapAlgorithm, | |||
doc::rgba_to_graya_func toGray, | |||
render::TaskDelegate* delegate) | |||
render::TaskDelegate* delegate, | |||
const doc::FitCriteria fitCriteria) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is unused [misc-unused-parameters]
const doc::FitCriteria fitCriteria) | |
const doc::FitCriteria /*fitCriteria*/) |
@@ -37,7 +38,8 @@ namespace cmd { | |||
const render::Dithering& dithering, | |||
const doc::RgbMapAlgorithm mapAlgorithm, | |||
doc::rgba_to_graya_func toGray, | |||
render::TaskDelegate* delegate); | |||
render::TaskDelegate* delegate, | |||
const doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); | |
doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); |
@@ -56,7 +58,8 @@ | |||
const bool isBackground, | |||
const doc::RgbMapAlgorithm mapAlgorithm, | |||
doc::rgba_to_graya_func toGray, | |||
render::TaskDelegate* delegate); | |||
render::TaskDelegate* delegate, | |||
const doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); | |
doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); |
@@ -35,19 +35,21 @@ void OctreeNode::addColor(color_t c, int level, OctreeNode* parent, | |||
(*m_children)[index].addColor(c, level + 1, this, paletteIndex, levelDeep); | |||
} | |||
|
|||
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index, const Palette* palette, int level) const | |||
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: function 'mapColor' is within a recursive call chain [misc-no-recursion]
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index,
^
Additional context
src/doc/octree_map.cpp:37: example recursive call chain, starting from function 'mapColor'
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index,
^
src/doc/octree_map.cpp:51: Frame #1: function 'mapColor' calls function 'mapColor' here:
return (*m_children)[index].mapColor(r, g, b, a, mask_index, palette, level + 1, fitCriteria);
^
src/doc/octree_map.cpp:51: ... which was the starting point of the recursive call chain; there may be other cycles
return (*m_children)[index].mapColor(r, g, b, a, mask_index, palette, level + 1, fitCriteria);
^
src/render/quantization.cpp
Outdated
else | ||
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color); | ||
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color, fitCriteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'color_t' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color, fitCriteria);
^
src/render/quantization.cpp
Outdated
else | ||
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color); | ||
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color, fitCriteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'color_t' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color, fitCriteria);
^
src/render/quantization.cpp
Outdated
else | ||
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color); | ||
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color, fitCriteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'color_t' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]
*dst_it = palette->findBestfit(c, c, c, a, new_mask_color, fitCriteria);
^
src/render/quantization.cpp
Outdated
else | ||
*dst_it = palette->findBestfit(r, g, b, a, new_mask_color); | ||
*dst_it = palette->findBestfit(r, g, b, a, new_mask_color, fitCriteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'color_t' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]
*dst_it = palette->findBestfit(r, g, b, a, new_mask_color, fitCriteria);
^
src/render/quantization.h
Outdated
@@ -68,7 +68,8 @@ namespace render { | |||
bool is_background, | |||
doc::color_t new_mask_color, | |||
doc::rgba_to_graya_func toGray = nullptr, | |||
TaskDelegate* delegate = nullptr); | |||
TaskDelegate* delegate = nullptr, | |||
const doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); | |
doc::FitCriteria fitCriteria = doc::FitCriteria::DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -160,7 +161,8 @@ | |||
const RgbMapFor forLayer) const; | |||
RgbMap* rgbMap(const frame_t frame, | |||
const RgbMapFor forLayer, | |||
RgbMapAlgorithm mapAlgo) const; | |||
const RgbMapAlgorithm mapAlgo, | |||
const FitCriteria fitCriteria = FitCriteria::DEFAULT) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const FitCriteria fitCriteria = FitCriteria::DEFAULT) const; | |
FitCriteria fitCriteria = FitCriteria::DEFAULT) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -564,6 +592,23 @@ void ChangePixelFormatCommand::onLoadParams(const Params& params) | |||
m_rgbmap = Preferences::instance().quantization.rgbmapAlgorithm(); | |||
} | |||
|
|||
// TODO change this with NewParams as in ColorQuantizationParams | |||
std::string fitCriteria = params.get("fitCriteria"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'fitCriteria' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string fitCriteria = params.get("fitCriteria"); | |
std::string const fitCriteria = params.get("fitCriteria"); |
src/doc/sprite.h
Outdated
@@ -258,6 +260,9 @@ namespace doc { | |||
mutable RgbMapAlgorithm m_rgbMapAlgorithm; | |||
mutable std::unique_ptr<RgbMap> m_rgbMap; | |||
|
|||
// Last 'color fit criteria' used on indexed conversions | |||
mutable FitCriteria m_fitCriteria = FitCriteria::DEFAULT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this in doc::Sprite
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! We don't need it, and we don't need mutable RgbMapAlgorithm m_rgbMapAlgorithm;
either. I'll add this parameters into class Rgbmap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually moving it to the RgbMap is a similar case. If you think it makes more sense to move them inside RgbMap go for it (not sure if this FitCriteria is only used inside the RgbMap and not in the findBest of the palette).
One important thing I'm missing and probably I thought incorrectly was that this FitCriteria was something used in the Sprite > Color Mode > More Options > Advance only. But it looks like you are planning as part of the whole program configuration. Something particular for the Octree (if I'm guided by the #2787 title), or something that can be used in both rgbmaps (rgb5a3/octree). What is the plan with this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a first approximation, I thought of it only for octree quantization. But I tested it with RGB5A3 and it can be processed without problems. So I extended it for both rgbmaps.
I added a global setting to set the default value in Advanced conversion RGB->Indexed
, then added this setting to work with Sprite > ColorMode > Indexed
too.
We can stop here and wait for the artist's reception to see if it is feasible to extend this option further (include parameter in lua for example).
All of these other 'color fit criteria' in the Palette::findBestFit
function can be useful for artists who want to fit any RGB image to a custom palette and achieve a more appropriate color selection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dacap I will limit the feature to be used only in Sprite > Color Mode > More Options > Advance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
virtual RgbMapAlgorithm rgbamapAlgorithm() const = 0; | ||
|
||
// Color Best Fit Criteria used to generate the rgbmap | ||
virtual FitCriteria fitCriteria() const = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: unknown type name 'FitCriteria' [clang-diagnostic-error]
virtual FitCriteria fitCriteria() const = 0;
^
|
||
// Color Best Fit Criteria used to generate the rgbmap | ||
virtual FitCriteria fitCriteria() const = 0; | ||
virtual void fitCriteria(const FitCriteria fitCriteria) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
virtual void fitCriteria(const FitCriteria fitCriteria) = 0; | |
virtual void fitCriteria(FitCriteria fitCriteria) = 0; |
|
||
// Color Best Fit Criteria used to generate the rgbmap | ||
virtual FitCriteria fitCriteria() const = 0; | ||
virtual void fitCriteria(const FitCriteria fitCriteria) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: unknown type name 'FitCriteria' [clang-diagnostic-error]
virtual void fitCriteria(const FitCriteria fitCriteria) = 0;
^
14f4214
to
1889936
Compare
This new parameter called 'color fit criteria' is used to compare colors under different criteria in the |
246ab35
to
0660d91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 25 out of 38. Check the log or trigger a new build to see more.
@@ -35,19 +35,21 @@ void OctreeNode::addColor(color_t c, int level, OctreeNode* parent, | |||
(*m_children)[index].addColor(c, level + 1, this, paletteIndex, levelDeep); | |||
} | |||
|
|||
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index, const Palette* palette, int level) const | |||
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: function 'mapColor' is within a recursive call chain [misc-no-recursion]
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index,
^
Additional context
src/doc/octree_map.cpp:37: example recursive call chain, starting from function 'mapColor'
int OctreeNode::mapColor(int r, int g, int b, int a, int mask_index,
^
src/doc/octree_map.cpp:51: Frame #1: function 'mapColor' calls function 'mapColor' here:
return (*m_children)[index].mapColor(r, g, b, a, mask_index, palette, level + 1, octree);
^
src/doc/octree_map.cpp:51: ... which was the starting point of the recursive call chain; there may be other cycles
return (*m_children)[index].mapColor(r, g, b, a, mask_index, palette, level + 1, octree);
^
@@ -135,9 +141,22 @@ class OctreeMap : public RgbMap { | |||
const int levelDeep = 7); | |||
|
|||
// RgbMap impl | |||
void regenerateMap(const Palette* palette, const int maskIndex) override; | |||
void regenerateMap(const Palette* palette, | |||
const int maskIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'maskIndex' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const int maskIndex, | |
int maskIndex, |
void regenerateMap(const Palette* palette, const int maskIndex) override; | ||
void regenerateMap(const Palette* palette, | ||
const int maskIndex, | ||
const FitCriteria fitCriteria) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const FitCriteria fitCriteria) override; | |
FitCriteria fitCriteria) override; |
int size = std::min(256, int(m_colors.size())); | ||
int bestfit = 0; | ||
int lowest = std::numeric_limits<int>::max(); | ||
int size = std::min(256, int(m_colors.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'size' of type 'int' can be declared 'const' [misc-const-correctness]
int size = std::min(256, int(m_colors.size())); | |
int const size = std::min(256, int(m_colors.size())); |
for (int i=0; i<size; ++i) { | ||
color_t rgb = m_colors[i]; | ||
for (int i=0; i<size; ++i) { | ||
color_t rgb = m_colors[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'rgb' of type 'color_t' (aka 'unsigned int') can be declared 'const' [misc-const-correctness]
color_t rgb = m_colors[i]; | |
color_t const rgb = m_colors[i]; |
int RgbMapBase::findBestfit(int r, int g, int b, int a, | ||
int mask_index) const | ||
{ | ||
ASSERT(r >= 0 && r <= 255); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ASSERT(r >= 0 && r <= 255);
^
Additional context
laf/base/debug.h:60: expanded from macro 'ASSERT'
if (!(condition)) { \
^
int mask_index) const | ||
{ | ||
ASSERT(r >= 0 && r <= 255); | ||
ASSERT(g >= 0 && g <= 255); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ASSERT(g >= 0 && g <= 255);
^
Additional context
laf/base/debug.h:60: expanded from macro 'ASSERT'
if (!(condition)) { \
^
{ | ||
ASSERT(r >= 0 && r <= 255); | ||
ASSERT(g >= 0 && g <= 255); | ||
ASSERT(b >= 0 && b <= 255); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ASSERT(b >= 0 && b <= 255);
^
Additional context
laf/base/debug.h:60: expanded from macro 'ASSERT'
if (!(condition)) { \
^
ASSERT(r >= 0 && r <= 255); | ||
ASSERT(g >= 0 && g <= 255); | ||
ASSERT(b >= 0 && b <= 255); | ||
ASSERT(a >= 0 && a <= 255); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ASSERT(a >= 0 && a <= 255);
^
Additional context
laf/base/debug.h:60: expanded from macro 'ASSERT'
if (!(condition)) { \
^
src/doc/rgbmap_base.cpp
Outdated
|
||
int bestfit = 0; | ||
double lowest = std::numeric_limits<double>::max(); | ||
int size = m_palette->size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'size' of type 'int' can be declared 'const' [misc-const-correctness]
int size = m_palette->size(); | |
int const size = m_palette->size(); |
0660d91
to
75023df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
rgbToOtherSpace(x, y, z); | ||
|
||
for (int i=0; i<size; ++i) { | ||
color_t rgb = m_palette->getEntry(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'rgb' of type 'color_t' (aka 'unsigned int') can be declared 'const' [misc-const-correctness]
color_t rgb = m_palette->getEntry(i); | |
color_t const rgb = m_palette->getEntry(i); |
double Zpal = double(rgba_getb(rgb)); | ||
// Palette color conversion RGB-->XYZ and r,g,b is assumed CIE XYZ | ||
rgbToOtherSpace(Xpal, Ypal, Zpal); | ||
double xDiff = x - Xpal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'xDiff' of type 'double' can be declared 'const' [misc-const-correctness]
double xDiff = x - Xpal; | |
double const xDiff = x - Xpal; |
// Palette color conversion RGB-->XYZ and r,g,b is assumed CIE XYZ | ||
rgbToOtherSpace(Xpal, Ypal, Zpal); | ||
double xDiff = x - Xpal; | ||
double yDiff = y - Ypal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'yDiff' of type 'double' can be declared 'const' [misc-const-correctness]
double yDiff = y - Ypal; | |
double const yDiff = y - Ypal; |
rgbToOtherSpace(Xpal, Ypal, Zpal); | ||
double xDiff = x - Xpal; | ||
double yDiff = y - Ypal; | ||
double zDiff = z - Zpal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'zDiff' of type 'double' can be declared 'const' [misc-const-correctness]
double zDiff = z - Zpal; | |
double const zDiff = z - Zpal; |
double xDiff = x - Xpal; | ||
double yDiff = y - Ypal; | ||
double zDiff = z - Zpal; | ||
double aDiff = double(a - rgba_geta(rgb)) / 128.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'aDiff' of type 'double' can be declared 'const' [misc-const-correctness]
double aDiff = double(a - rgba_geta(rgb)) / 128.0; | |
double const aDiff = double(a - rgba_geta(rgb)) / 128.0; |
protected: | ||
FitCriteria m_fitCriteria; | ||
const Palette* m_palette = nullptr; | ||
int m_modifications = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: member variable 'm_modifications' has protected visibility [misc-non-private-member-variables-in-classes]
int m_modifications = 0;
^
FitCriteria m_fitCriteria; | ||
const Palette* m_palette = nullptr; | ||
int m_modifications = 0; | ||
int m_maskIndex = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: member variable 'm_maskIndex' has protected visibility [misc-non-private-member-variables-in-classes]
int m_maskIndex = 0;
^
, m_maskIndex(0) | ||
{ | ||
} | ||
RgbMapRGB5A3::RgbMapRGB5A3() : m_map(MAPSIZE) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: performing an implicit widening conversion to type 'size_type' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result]
RgbMapRGB5A3::RgbMapRGB5A3() : m_map(MAPSIZE) {}
^
Additional context
src/doc/rgbmap_rgb5a3.cpp:22: expanded from macro 'MAPSIZE'
#define MAPSIZE (RSIZE*GSIZE*BSIZE*ASIZE)
^
src/doc/rgbmap_rgb5a3.cpp:18: expanded from macro 'RSIZE'
#define RSIZE 32
^
src/doc/rgbmap_rgb5a3.cpp:24: make conversion explicit to silence this warning
RgbMapRGB5A3::RgbMapRGB5A3() : m_map(MAPSIZE) {}
^
src/doc/rgbmap_rgb5a3.cpp:22: expanded from macro 'MAPSIZE'
#define MAPSIZE (RSIZE*GSIZE*BSIZE*ASIZE)
^
src/doc/rgbmap_rgb5a3.cpp:18: expanded from macro 'RSIZE'
#define RSIZE 32
^
src/doc/rgbmap_rgb5a3.cpp:24: perform multiplication in a wider type
RgbMapRGB5A3::RgbMapRGB5A3() : m_map(MAPSIZE) {}
^
src/doc/rgbmap_rgb5a3.cpp:22: expanded from macro 'MAPSIZE'
#define MAPSIZE (RSIZE*GSIZE*BSIZE*ASIZE)
^
src/doc/rgbmap_rgb5a3.cpp:18: expanded from macro 'RSIZE'
#define RSIZE 32
^
// Bit activated on m_map entries that aren't yet calculated. | ||
const int INVALID = 256; | ||
|
||
public: | ||
RgbMapRGB5A3(); | ||
|
||
// RgbMap impl | ||
void regenerateMap(const Palette* palette, int maskIndex) override; | ||
void regenerateMap(const Palette* palette, | ||
const int maskIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'maskIndex' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const int maskIndex, | |
int maskIndex, |
void regenerateMap(const Palette* palette, int maskIndex) override; | ||
void regenerateMap(const Palette* palette, | ||
const int maskIndex, | ||
const FitCriteria fitCriteria) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fitCriteria' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const FitCriteria fitCriteria) override; | |
FitCriteria fitCriteria) override; |
…side rgbmap algorithms Added also 'modifications' function as a common function
Also, fixed the order where the 'm_palette' is set in OctreeMap::regenerateMap because the new findBestfit function needs to access the 'm_palette' pointer.
75023df
to
8a17be1
Compare
First approach.
I'm still looking for a way to run the color mode conversion preview when changing the "color fit criteria" selector (combo box), just like it runs when changing the RGB mapping method.
fix #2787