From 098fdf2981bbcf120cb32efeb600ebca98028a69 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 31 Aug 2021 21:19:54 +0100 Subject: [PATCH] Performance fixes. --- common/dialogs/dialog_color_picker.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/common/dialogs/dialog_color_picker.cpp b/common/dialogs/dialog_color_picker.cpp index 201e8341be..d99b01c8fb 100644 --- a/common/dialogs/dialog_color_picker.cpp +++ b/common/dialogs/dialog_color_picker.cpp @@ -253,10 +253,15 @@ void DIALOG_COLOR_PICKER::createRGBBitmap() // clear background (set the window bg color) wxColor bg = GetBackgroundColour(); + // Don't do standard-color lookups on OSX each time through the loop + wxColourBase::ChannelType bgR = bg.Red(); + wxColourBase::ChannelType bgG = bg.Green(); + wxColourBase::ChannelType bgB = bg.Blue(); + for( int xx = 0; xx < bmsize.x; xx++ ) // blue axis { for( int yy = 0; yy < bmsize.y; yy++ ) // Red axis - img.SetRGB( xx, yy, bg.Red(), bg.Green(), bg.Blue() ); + img.SetRGB( xx, yy, bgR, bgG, bgB ); } // Build the palette @@ -328,10 +333,15 @@ void DIALOG_COLOR_PICKER::createHSVBitmap() // clear background (set the window bg color) wxColor bg = GetBackgroundColour(); + // Don't do standard-color lookups on OSX each time through the loop + wxColourBase::ChannelType bgR = bg.Red(); + wxColourBase::ChannelType bgG = bg.Green(); + wxColourBase::ChannelType bgB = bg.Blue(); + for( int xx = 0; xx < bmsize.x; xx++ ) // blue axis { for( int yy = 0; yy < bmsize.y; yy++ ) // Red axis - img.SetRGB( xx, yy, bg.Red(), bg.Green(), bg.Blue() ); + img.SetRGB( xx, yy, bgR, bgG, bgB ); } // Reserve room to draw cursors inside the bitmap