A Vector has been replaced.
This commit is contained in:
@ -37,30 +37,30 @@ using namespace lout::container::typed;
|
|||||||
const enum ScaleMode { SIMPLE, BEAUTIFUL, BEAUTIFUL_GAMMA }
|
const enum ScaleMode { SIMPLE, BEAUTIFUL, BEAUTIFUL_GAMMA }
|
||||||
scaleMode = BEAUTIFUL_GAMMA;
|
scaleMode = BEAUTIFUL_GAMMA;
|
||||||
|
|
||||||
Vector <FltkImgbuf::GammaCorrectionTable> *FltkImgbuf::gammaCorrectionTables
|
std::vector< std::unique_ptr< FltkImgbuf::GammaCorrectionTable > > FltkImgbuf::gammaCorrectionTables;
|
||||||
= new Vector <FltkImgbuf::GammaCorrectionTable> (true, 2);
|
|
||||||
|
|
||||||
uchar *FltkImgbuf::findGammaCorrectionTable (double gamma)
|
uchar *FltkImgbuf::findGammaCorrectionTable (double gamma)
|
||||||
{
|
{
|
||||||
// Since the number of possible keys is low, a linear search is
|
// Since the number of possible keys is low, a linear search is
|
||||||
// sufficiently fast.
|
// sufficiently fast.
|
||||||
|
|
||||||
for (int i = 0; i < gammaCorrectionTables->size(); i++) {
|
for (std::size_t i = 0; i < gammaCorrectionTables.size(); i++) {
|
||||||
GammaCorrectionTable *gct = gammaCorrectionTables->get(i);
|
GammaCorrectionTable *gct = gammaCorrectionTables.at(i).get();
|
||||||
if (gct->gamma == gamma)
|
if (gct->gamma == gamma)
|
||||||
return gct->map;
|
return gct->map;
|
||||||
}
|
}
|
||||||
|
|
||||||
_MSG("Creating new table for gamma = %g\n", gamma);
|
_MSG("Creating new table for gamma = %g\n", gamma);
|
||||||
|
|
||||||
GammaCorrectionTable *gct = new GammaCorrectionTable();
|
auto gct = std::make_unique< GammaCorrectionTable >();
|
||||||
gct->gamma = gamma;
|
gct->gamma = gamma;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++)
|
for (int i = 0; i < 256; i++)
|
||||||
gct->map[i] = 255 * pow((double)i / 255, gamma);
|
gct->map[i] = 255 * pow((double)i / 255, gamma);
|
||||||
|
|
||||||
gammaCorrectionTables->put (gct);
|
auto *rv= gct->map;
|
||||||
return gct->map;
|
gammaCorrectionTables.push_back (std::move(gct));
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FltkImgbuf::excessiveImageDimensions (int width, int height)
|
bool FltkImgbuf::excessiveImageDimensions (int width, int height)
|
||||||
@ -72,8 +72,7 @@ bool FltkImgbuf::excessiveImageDimensions (int width, int height)
|
|||||||
void FltkImgbuf::freeall ()
|
void FltkImgbuf::freeall ()
|
||||||
{
|
{
|
||||||
_MSG("Deleting gammaCorrectionTables\n");
|
_MSG("Deleting gammaCorrectionTables\n");
|
||||||
delete gammaCorrectionTables;
|
gammaCorrectionTables.clear();
|
||||||
gammaCorrectionTables = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FltkImgbuf::FltkImgbuf (Type type, int width, int height, double gamma)
|
FltkImgbuf::FltkImgbuf (Type type, int width, int height, double gamma)
|
||||||
|
|||||||
@ -36,8 +36,7 @@ private:
|
|||||||
// the image buffer.
|
// the image buffer.
|
||||||
lout::misc::BitSet *copiedRows;
|
lout::misc::BitSet *copiedRows;
|
||||||
|
|
||||||
static lout::container::typed::Vector <GammaCorrectionTable>
|
static std::vector< std::unique_ptr< GammaCorrectionTable > > gammaCorrectionTables;
|
||||||
*gammaCorrectionTables;
|
|
||||||
|
|
||||||
static uchar *findGammaCorrectionTable (double gamma);
|
static uchar *findGammaCorrectionTable (double gamma);
|
||||||
static bool excessiveImageDimensions (int width, int height);
|
static bool excessiveImageDimensions (int width, int height);
|
||||||
|
|||||||
@ -372,10 +372,10 @@ int a_Dialog_choice(const char *title, const char *msg, ...)
|
|||||||
window->set_modal();
|
window->set_modal();
|
||||||
window->begin();
|
window->begin();
|
||||||
|
|
||||||
Fl_Text_Buffer *buf = new Fl_Text_Buffer();
|
auto buf = std::make_unique< Fl_Text_Buffer >();
|
||||||
buf->text(msg);
|
buf->text(msg);
|
||||||
Fl_Text_Display *td = new Fl_Text_Display(0, 0, ww, wh - bh);
|
Fl_Text_Display *td = new Fl_Text_Display(0, 0, ww, wh - bh);
|
||||||
td->buffer(buf);
|
td->buffer(buf.get());
|
||||||
td->textsize((int) rint(14.0 * prefs.font_factor));
|
td->textsize((int) rint(14.0 * prefs.font_factor));
|
||||||
td->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
|
td->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
|
||||||
|
|
||||||
@ -400,8 +400,8 @@ int a_Dialog_choice(const char *title, const char *msg, ...)
|
|||||||
while (window->shown())
|
while (window->shown())
|
||||||
Fl::wait();
|
Fl::wait();
|
||||||
_MSG("Dialog_choice answer = %d\n", answer);
|
_MSG("Dialog_choice answer = %d\n", answer);
|
||||||
td->buffer(NULL);
|
td->buffer(nullptr);
|
||||||
delete buf;
|
buf.reset();
|
||||||
window.reset();
|
window.reset();
|
||||||
|
|
||||||
return choice_answer;
|
return choice_answer;
|
||||||
|
|||||||
Reference in New Issue
Block a user