Merge branch 'more-cxx11-fixes'
More simplifications that are possible now that C++11 is required. No real changes to the behaviour. See #22962. Closes #22684.
This commit is contained in:
commit
f8ce99bf66
14 changed files with 105 additions and 182 deletions
|
|
@ -108,18 +108,10 @@
|
|||
#define wxDO_IF(condition) wxDO_IF_HELPER(wxMAKE_UNIQUE_NAME(wxdoif), condition)
|
||||
|
||||
/*
|
||||
Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as
|
||||
nullptr for the compilers which don't support the latter.
|
||||
This macro is obsolete, use standard __func__ instead.
|
||||
*/
|
||||
#ifndef __WXFUNCTION__
|
||||
#if defined(__GNUC__) || \
|
||||
defined(__VISUALC__) || \
|
||||
defined(__FUNCTION__)
|
||||
#define __WXFUNCTION__ __FUNCTION__
|
||||
#else
|
||||
/* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */
|
||||
#define __WXFUNCTION__ (nullptr)
|
||||
#endif
|
||||
#define __WXFUNCTION__ __func__
|
||||
#endif /* __WXFUNCTION__ already defined */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include <limits.h> // for CHAR_BIT used below
|
||||
|
||||
#include "wx/chartype.h" // for __TFILE__ and wxChar
|
||||
#include "wx/cpp.h" // for __WXFUNCTION__
|
||||
#include "wx/dlimpexp.h" // for WXDLLIMPEXP_FWD_BASE
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
|
|
@ -284,7 +283,7 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
|
|||
|
||||
// A version asserting at the current location.
|
||||
#define wxASSERT_MSG(cond, msg) \
|
||||
wxASSERT_MSG_AT(cond, msg, __FILE__, __LINE__, __WXFUNCTION__)
|
||||
wxASSERT_MSG_AT(cond, msg, __FILE__, __LINE__, __func__)
|
||||
|
||||
// a version without any additional message, don't use unless condition
|
||||
// itself is fully self-explanatory
|
||||
|
|
@ -307,7 +306,7 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
|
|||
wxFAIL_COND_MSG_AT("Assert failure", msg, file, line, func)
|
||||
|
||||
#define wxFAIL_COND_MSG(cond, msg) \
|
||||
wxFAIL_COND_MSG_AT(cond, msg, __FILE__, __LINE__, __WXFUNCTION__)
|
||||
wxFAIL_COND_MSG_AT(cond, msg, __FILE__, __LINE__, __func__)
|
||||
|
||||
#define wxFAIL_MSG(msg) wxFAIL_COND_MSG("Assert failure", msg)
|
||||
#define wxFAIL wxFAIL_MSG((const char*)nullptr)
|
||||
|
|
|
|||
|
|
@ -606,13 +606,14 @@ protected:
|
|||
virtual wxObjectRefData* CreateRefData() const override;
|
||||
virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const override;
|
||||
|
||||
// Helper function used internally by wxImage class only.
|
||||
template <typename T>
|
||||
void ApplyToAllPixels(void (*filter)(wxImage *, unsigned char *, T), T value);
|
||||
|
||||
private:
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxImageHandler;
|
||||
|
||||
// Helper function used internally by wxImage class only: it applies the
|
||||
// given functor, which is passed the pixel data for each image pixel.
|
||||
template <typename F>
|
||||
void ApplyToAllPixels(const F& func);
|
||||
|
||||
// Possible values for MakeEmptyClone() flags.
|
||||
enum
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1158,7 +1158,7 @@ WXDLLIMPEXP_BASE wxString wxSysErrorMsgStr(unsigned long nErrCode = 0);
|
|||
|
||||
// creates wxLogger object for the current location
|
||||
#define wxMAKE_LOGGER(level) \
|
||||
wxLogger(wxLOG_##level, __FILE__, __LINE__, __WXFUNCTION__, wxLOG_COMPONENT)
|
||||
wxLogger(wxLOG_##level, __FILE__, __LINE__, __func__, wxLOG_COMPONENT)
|
||||
|
||||
// this macro generates the expression which logs whatever follows it in
|
||||
// parentheses at the level specified as argument
|
||||
|
|
|
|||
|
|
@ -106,15 +106,6 @@ public:
|
|||
|
||||
wxEvtHandler* GetHandler() const { return m_handler; }
|
||||
|
||||
// Called to notify about the state change in the main thread by SetState()
|
||||
// (which can itself be called from a different one).
|
||||
//
|
||||
// It also releases a reference added when switching to the active state by
|
||||
// SetState() when leaving it.
|
||||
//
|
||||
// TODO-C++11: make private when we don't need StateEventProcessor any more.
|
||||
void ProcessStateEvent(wxWebRequest::State state, const wxString& failMsg);
|
||||
|
||||
protected:
|
||||
wxString m_method;
|
||||
wxWebRequest::Storage m_storage;
|
||||
|
|
@ -138,6 +129,14 @@ private:
|
|||
// Called from public Cancel() at most once per object.
|
||||
virtual void DoCancel() = 0;
|
||||
|
||||
// Called to notify about the state change in the main thread by SetState()
|
||||
// (which can itself be called from a different one).
|
||||
//
|
||||
// It also releases a reference added when switching to the active state by
|
||||
// SetState() when leaving it.
|
||||
void ProcessStateEvent(wxWebRequest::State state, const wxString& failMsg);
|
||||
|
||||
|
||||
wxWebSession& m_session;
|
||||
wxEvtHandler* const m_handler;
|
||||
const int m_id;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ void wxMissingImplementation( const char fileName[], unsigned lineNumber,
|
|||
wxMissingImplementation( __FILE__, __LINE__, feature )
|
||||
|
||||
#define wxMISSING_FUNCTION() \
|
||||
wxMISSING_IMPLEMENTATION( __WXFUNCTION__ )
|
||||
wxMISSING_IMPLEMENTATION( __func__ )
|
||||
|
||||
#endif // _WX_QT_UTILS_H_
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ protected:
|
|||
wxFAIL_MSG_AT( msg,
|
||||
m_file ? m_file : __FILE__,
|
||||
m_line ? m_line : __LINE__,
|
||||
m_func ? m_func : __WXFUNCTION__ );
|
||||
m_func ? m_func : __func__ );
|
||||
#else // !__WXDEBUG__
|
||||
// We still need to report the failure somehow when wx asserts are
|
||||
// disabled.
|
||||
|
|
@ -437,7 +437,7 @@ protected:
|
|||
msg,
|
||||
wxASCII_STR(m_file ? m_file : __FILE__),
|
||||
m_line ? m_line : __LINE__,
|
||||
wxASCII_STR(m_func ? m_func : __WXFUNCTION__));
|
||||
wxASCII_STR(m_func ? m_func : __func__));
|
||||
#endif // __WXDEBUG__/!__WXDEBUG__
|
||||
}
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ private:
|
|||
*/
|
||||
#define wxTEST_DIALOG(codeToRun, ...) \
|
||||
{ \
|
||||
wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __WXFUNCTION__); \
|
||||
wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __func__); \
|
||||
wxCALL_FOR_EACH(WX_TEST_IMPL_ADD_EXPECTATION, __VA_ARGS__) \
|
||||
codeToRun; \
|
||||
wx_hook.CheckUnmetExpectations(); \
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@
|
|||
#define wxSTRINGIZE_T(x)
|
||||
|
||||
/**
|
||||
This macro expands to the name of the current function if the compiler
|
||||
supports any of @c \__FUNCTION__, @c \__func__ or equivalent variables or
|
||||
macros or to @NULL if none of them is available.
|
||||
This obsolete macro is the same as the standard @c \__func__ constant.
|
||||
|
||||
Please use the standard macro instead.
|
||||
|
||||
@header{wx/cpp.h}
|
||||
*/
|
||||
#define __WXFUNCTION__
|
||||
#define __WXFUNCTION__ __func__
|
||||
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -3062,34 +3062,6 @@ wxBEGIN_EVENT_TABLE(TestDefaultActionDialog, wxDialog)
|
|||
EVT_TEXT_ENTER(wxID_ANY, TestDefaultActionDialog::OnTextEnter)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// TODO-C++11: We can't declare this class inside TestDefaultActionDialog
|
||||
// itself when using C++98, so we have to do it here instead.
|
||||
namespace
|
||||
{
|
||||
|
||||
// We have to define a new class in order to actually handle pressing
|
||||
// Enter, if we didn't do it, pressing it would still close the dialog.
|
||||
class EnterHandlingTextCtrl : public wxTextCtrl
|
||||
{
|
||||
public:
|
||||
EnterHandlingTextCtrl(wxWindow* parent, int id, const wxString& value)
|
||||
: wxTextCtrl(parent, id, value,
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER)
|
||||
{
|
||||
Bind(wxEVT_TEXT_ENTER, &EnterHandlingTextCtrl::OnEnter, this);
|
||||
|
||||
SetInitialSize(GetSizeFromTextSize(GetTextExtent(value).x));
|
||||
}
|
||||
|
||||
private:
|
||||
void OnEnter(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Enter pressed");
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
TestDefaultActionDialog::TestDefaultActionDialog( wxWindow *parent ) :
|
||||
wxDialog( parent, -1, "Test default action" )
|
||||
{
|
||||
|
|
@ -3117,7 +3089,20 @@ TestDefaultActionDialog::TestDefaultActionDialog( wxWindow *parent ) :
|
|||
grid_sizer->Add(new wxStaticText(this, wxID_ANY, "wxTextCtrl without wxTE_PROCESS_ENTER"),
|
||||
wxSizerFlags().CentreVertical());
|
||||
|
||||
grid_sizer->Add(new EnterHandlingTextCtrl(this, wxID_ANY, "Enter here is handled by the application"),
|
||||
wxTextCtrl* textHandlingEnter =
|
||||
new wxTextCtrl(this, wxID_ANY, "Enter here is handled by the application",
|
||||
wxDefaultPosition,
|
||||
wxSize(50*GetCharWidth(), -1), // big enough
|
||||
wxTE_PROCESS_ENTER);
|
||||
textHandlingEnter->Bind(wxEVT_TEXT_ENTER,
|
||||
[](wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage("Enter pressed");
|
||||
|
||||
// Don't skip the event here, otherwise the dialog would close.
|
||||
}
|
||||
);
|
||||
grid_sizer->Add(textHandlingEnter,
|
||||
wxSizerFlags().CentreVertical());
|
||||
grid_sizer->Add(new wxStaticText(this, wxID_ANY, "wxTextCtrl with wxTE_PROCESS_ENTER"),
|
||||
wxSizerFlags().CentreVertical());
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|||
|
||||
void MyFrame::OnWatch(wxCommandEvent& event)
|
||||
{
|
||||
wxLogDebug("%s start=%d", __WXFUNCTION__, event.IsChecked());
|
||||
wxLogDebug("%s start=%d", __func__, event.IsChecked());
|
||||
|
||||
if (event.IsChecked())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -553,9 +553,7 @@ private:
|
|||
class TextCtrlImpl : public ControlImplBase<wxFileDialogTextCtrlImpl>
|
||||
{
|
||||
public:
|
||||
// The dummy argument is there just for consistency with the other classes
|
||||
// and allows to keep the code simple even without vararg templates support.
|
||||
explicit TextCtrlImpl(wxWindow* parent, const wxString& WXUNUSED(dummy))
|
||||
explicit TextCtrlImpl(wxWindow* parent)
|
||||
: ControlImplBase<wxFileDialogTextCtrlImpl>
|
||||
(
|
||||
new wxTextCtrl(parent, wxID_ANY)
|
||||
|
|
@ -668,13 +666,7 @@ public:
|
|||
{
|
||||
m_lastWasRadio = false;
|
||||
|
||||
// TODO-C++11: Can't use AddToLayoutAndReturn() here easily without
|
||||
// variadic templates.
|
||||
ChoiceImpl* const impl = new ChoiceImpl(this, n, strings);
|
||||
|
||||
AddToLayout(impl->m_win);
|
||||
|
||||
return impl;
|
||||
return AddToLayoutAndReturn<ChoiceImpl>(n, strings);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -703,10 +695,11 @@ private:
|
|||
GetSizer()->Add(win, wxSizerFlags().Center().Border(wxRIGHT));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* AddToLayoutAndReturn(const wxString& label = wxString())
|
||||
// Function arguments are used to construct T.
|
||||
template <typename T, typename... Args>
|
||||
T* AddToLayoutAndReturn(Args... args)
|
||||
{
|
||||
T* const controlImpl = new T(this, label);
|
||||
T* const controlImpl = new T(this, args...);
|
||||
|
||||
AddToLayout(controlImpl->m_win);
|
||||
|
||||
|
|
|
|||
|
|
@ -1847,45 +1847,18 @@ wxImage wxImage::ConvertToGreyscale() const
|
|||
return ConvertToGreyscale(0.299, 0.587, 0.114);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// red, green and blue are doubles in the range [0.0..1.0], they are used
|
||||
// internally by DoMakeGrey() only.
|
||||
class WeightValue
|
||||
{
|
||||
public:
|
||||
WeightValue(double r = 0.0, double g = 0.0, double b = 0.0)
|
||||
: red(r), green(g), blue(b) {}
|
||||
double red;
|
||||
double green;
|
||||
double blue;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoMakeGrey(wxImage *image, unsigned char *rgb, WeightValue weight)
|
||||
{
|
||||
if ( !image->HasMask() || rgb[0] != image->GetMaskRed() ||
|
||||
rgb[1] != image->GetMaskGreen() || rgb[2] != image->GetMaskBlue() )
|
||||
wxColour::MakeGrey(rgb, rgb + 1, rgb + 2, weight.red, weight.green, weight.blue);
|
||||
}
|
||||
|
||||
wxImage wxImage::ConvertToGreyscale(double weight_r, double weight_g, double weight_b) const
|
||||
{
|
||||
wxImage image = *this;
|
||||
image.ApplyToAllPixels(&DoMakeGrey, WeightValue(weight_r, weight_g, weight_b));
|
||||
image.ApplyToAllPixels([&image, weight_r, weight_g, weight_b](unsigned char *rgb)
|
||||
{
|
||||
if ( !image.HasMask() || rgb[0] != image.GetMaskRed() ||
|
||||
rgb[1] != image.GetMaskGreen() || rgb[2] != image.GetMaskBlue() )
|
||||
wxColour::MakeGrey(rgb, rgb + 1, rgb + 2, weight_r, weight_g, weight_b);
|
||||
});
|
||||
return image;
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoMakeMono(wxImage *WXUNUSED(image), unsigned char *rgb, wxImage::RGBValue rgbValue)
|
||||
{
|
||||
const bool on = (rgb[0] == rgbValue.red) && (rgb[1] == rgbValue.green) && (rgb[2] == rgbValue.blue);
|
||||
wxColour::MakeMono(rgb, rgb + 1, rgb + 2, on);
|
||||
}
|
||||
|
||||
wxImage wxImage::ConvertToMono(unsigned char r, unsigned char g, unsigned char b) const
|
||||
{
|
||||
wxImage image = *this;
|
||||
|
|
@ -1898,38 +1871,36 @@ wxImage wxImage::ConvertToMono(unsigned char r, unsigned char g, unsigned char b
|
|||
image.SetMaskColour(0, 0, 0);
|
||||
}
|
||||
|
||||
image.ApplyToAllPixels(&DoMakeMono, RGBValue(r, g, b));
|
||||
image.ApplyToAllPixels([r, g, b](unsigned char *rgb)
|
||||
{
|
||||
const bool on = (rgb[0] == r) && (rgb[1] == g) && (rgb[2] == b);
|
||||
wxColour::MakeMono(rgb, rgb + 1, rgb + 2, on);
|
||||
});
|
||||
return image;
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoMakeDisabled(wxImage *image, unsigned char *rgb, unsigned char brightness)
|
||||
{
|
||||
if ( !image->HasMask() || rgb[0] != image->GetMaskRed() ||
|
||||
rgb[1] != image->GetMaskGreen() || rgb[2] != image->GetMaskBlue() )
|
||||
wxColour::MakeDisabled(rgb, rgb + 1, rgb + 2, brightness);
|
||||
}
|
||||
|
||||
wxImage wxImage::ConvertToDisabled(unsigned char brightness) const
|
||||
{
|
||||
wxImage image = *this;
|
||||
image.ApplyToAllPixels(&DoMakeDisabled, brightness);
|
||||
image.ApplyToAllPixels([&image, brightness](unsigned char *rgb)
|
||||
{
|
||||
if ( !image.HasMask() || rgb[0] != image.GetMaskRed() ||
|
||||
rgb[1] != image.GetMaskGreen() || rgb[2] != image.GetMaskBlue() )
|
||||
wxColour::MakeDisabled(rgb, rgb + 1, rgb + 2, brightness);
|
||||
});
|
||||
return image;
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoChangeLightness(wxImage *image, unsigned char *rgb, int alpha)
|
||||
{
|
||||
if ( !image->HasMask() || rgb[0] != image->GetMaskRed() ||
|
||||
rgb[1] != image->GetMaskGreen() || rgb[2] != image->GetMaskBlue() )
|
||||
wxColour::ChangeLightness(rgb, rgb + 1, rgb + 2, alpha);
|
||||
}
|
||||
|
||||
wxImage wxImage::ChangeLightness(int alpha) const
|
||||
{
|
||||
wxASSERT(alpha >= 0 && alpha <= 200);
|
||||
wxImage image = *this;
|
||||
image.ApplyToAllPixels(&DoChangeLightness, alpha);
|
||||
image.ApplyToAllPixels([&image, alpha](unsigned char *rgb)
|
||||
{
|
||||
if ( !image.HasMask() || rgb[0] != image.GetMaskRed() ||
|
||||
rgb[1] != image.GetMaskGreen() || rgb[2] != image.GetMaskBlue() )
|
||||
wxColour::ChangeLightness(rgb, rgb + 1, rgb + 2, alpha);
|
||||
});
|
||||
return image;
|
||||
}
|
||||
|
||||
|
|
@ -3313,8 +3284,7 @@ wxImage::RGBValue wxImage::HSVtoRGB(const HSVValue& hsv)
|
|||
(unsigned char)wxRound(blue * 255.0));
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoRotateHue(wxImage *WXUNUSED(image), unsigned char *rgb, double angle)
|
||||
static void DoRotateHue(unsigned char *rgb, double angle)
|
||||
{
|
||||
wxImage::RGBValue rgbValue(rgb[0], rgb[1], rgb[2]);
|
||||
wxImage::HSVValue hsvValue = wxImage::RGBtoHSV(rgbValue);
|
||||
|
|
@ -3341,11 +3311,13 @@ void wxImage::RotateHue(double angle)
|
|||
return;
|
||||
|
||||
wxASSERT(angle >= -1.0 && angle <= 1.0);
|
||||
ApplyToAllPixels(&DoRotateHue, angle);
|
||||
ApplyToAllPixels([angle](unsigned char *rgb)
|
||||
{
|
||||
DoRotateHue(rgb, angle);
|
||||
});
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoChangeSaturation(wxImage *WXUNUSED(image), unsigned char *rgb, double factor)
|
||||
static void DoChangeSaturation(unsigned char *rgb, double factor)
|
||||
{
|
||||
wxImage::RGBValue rgbValue(rgb[0], rgb[1], rgb[2]);
|
||||
wxImage::HSVValue hsvValue = wxImage::RGBtoHSV(rgbValue);
|
||||
|
|
@ -3372,11 +3344,13 @@ void wxImage::ChangeSaturation(double factor)
|
|||
return;
|
||||
|
||||
wxASSERT(factor >= -1.0 && factor <= 1.0);
|
||||
ApplyToAllPixels(&DoChangeSaturation, factor);
|
||||
ApplyToAllPixels([factor](unsigned char *rgb)
|
||||
{
|
||||
DoChangeSaturation(rgb, factor);
|
||||
});
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoChangeBrightness(wxImage *WXUNUSED(image), unsigned char *rgb, double factor)
|
||||
static void DoChangeBrightness(unsigned char *rgb, double factor)
|
||||
{
|
||||
wxImage::RGBValue rgbValue(rgb[0], rgb[1], rgb[2]);
|
||||
wxImage::HSVValue hsvValue = wxImage::RGBtoHSV(rgbValue);
|
||||
|
|
@ -3403,20 +3377,10 @@ void wxImage::ChangeBrightness(double factor)
|
|||
return;
|
||||
|
||||
wxASSERT(factor >= -1.0 && factor <= 1.0);
|
||||
ApplyToAllPixels(&DoChangeBrightness, factor);
|
||||
}
|
||||
|
||||
// TODO-C++11: Replace with a lambda function.
|
||||
static void DoChangeHSV(wxImage *image, unsigned char *rgb, wxImage::HSVValue hsvValue)
|
||||
{
|
||||
if ( !wxIsNullDouble(hsvValue.hue) )
|
||||
DoRotateHue(image, rgb, hsvValue.hue);
|
||||
|
||||
if ( !wxIsNullDouble(hsvValue.saturation) )
|
||||
DoChangeSaturation(image, rgb, hsvValue.saturation);
|
||||
|
||||
if ( !wxIsNullDouble(hsvValue.value) )
|
||||
DoChangeBrightness(image, rgb, hsvValue.value);
|
||||
ApplyToAllPixels([factor](unsigned char *rgb)
|
||||
{
|
||||
DoChangeBrightness(rgb, factor);
|
||||
});
|
||||
}
|
||||
|
||||
// Changes the hue, the saturation and the brightness (value) of each pixel in
|
||||
|
|
@ -3432,7 +3396,17 @@ void wxImage::ChangeHSV(double angleH, double factorS, double factorV)
|
|||
|
||||
wxASSERT(angleH >= -1.0 && angleH <= 1.0 && factorS >= -1.0 &&
|
||||
factorS <= 1.0 && factorV >= -1.0 && factorV <= 1.0);
|
||||
ApplyToAllPixels(&DoChangeHSV, HSVValue(angleH, factorS, factorV));
|
||||
ApplyToAllPixels([angleH, factorS, factorV](unsigned char *rgb)
|
||||
{
|
||||
if ( !wxIsNullDouble(angleH) )
|
||||
DoRotateHue(rgb, angleH);
|
||||
|
||||
if ( !wxIsNullDouble(factorS) )
|
||||
DoChangeSaturation(rgb, factorS);
|
||||
|
||||
if ( !wxIsNullDouble(factorV) )
|
||||
DoChangeBrightness(rgb, factorV);
|
||||
});
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -3895,8 +3869,8 @@ wxImage wxImage::Rotate(double angle,
|
|||
}
|
||||
|
||||
// Helper function used internally by wxImage class only.
|
||||
template <typename T>
|
||||
void wxImage::ApplyToAllPixels(void (*filter)(wxImage *, unsigned char *, T), T value)
|
||||
template <typename F>
|
||||
void wxImage::ApplyToAllPixels(const F& func)
|
||||
{
|
||||
AllocExclusive();
|
||||
|
||||
|
|
@ -3905,7 +3879,7 @@ void wxImage::ApplyToAllPixels(void (*filter)(wxImage *, unsigned char *, T), T
|
|||
|
||||
for ( size_t i = 0; i < size; i++, data += 3 )
|
||||
{
|
||||
(*filter)(this, data, value);
|
||||
func(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,9 +144,8 @@ bool wxSpinCtrlImpl::IsBaseCompatibleWithRange(int minVal, int maxVal, int base)
|
|||
|
||||
unsigned wxSpinCtrlImpl::DetermineDigits(double inc)
|
||||
{
|
||||
// TODO-C++11: Use std::modf() to get the fractional part.
|
||||
inc = fabs(inc);
|
||||
inc -= static_cast<int>(inc);
|
||||
double ipart;
|
||||
inc = std::abs(std::modf(inc, &ipart));
|
||||
if ( inc > 0.0 )
|
||||
{
|
||||
return wxMin(SPINCTRLDBL_MAX_DIGITS, -static_cast<int>(floor(log10(inc))));
|
||||
|
|
|
|||
|
|
@ -165,28 +165,6 @@ wxFileOffset wxWebRequestImpl::GetBytesExpectedToReceive() const
|
|||
namespace
|
||||
{
|
||||
|
||||
// Functor used with CallAfter() below.
|
||||
//
|
||||
// TODO-C++11: Replace with a lambda.
|
||||
struct StateEventProcessor
|
||||
{
|
||||
StateEventProcessor(wxWebRequestImpl& request,
|
||||
wxWebRequest::State state,
|
||||
const wxString& failMsg)
|
||||
: m_request(request), m_state(state), m_failMsg(failMsg)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
m_request.ProcessStateEvent(m_state, m_failMsg);
|
||||
}
|
||||
|
||||
wxWebRequestImpl& m_request;
|
||||
const wxWebRequest::State m_state;
|
||||
const wxString m_failMsg;
|
||||
};
|
||||
|
||||
#if wxUSE_LOG_TRACE
|
||||
|
||||
// Tiny helper to log states as strings rather than meaningless numbers.
|
||||
|
|
@ -242,7 +220,10 @@ void wxWebRequestImpl::SetState(wxWebRequest::State state, const wxString & fail
|
|||
}
|
||||
else
|
||||
{
|
||||
m_handler->CallAfter(StateEventProcessor(*this, state, failMsg));
|
||||
m_handler->CallAfter([this, state, failMsg]()
|
||||
{
|
||||
ProcessStateEvent(state, failMsg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue