From 0dcea9014929406f6befb41a27ba99358e7ceff1 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Sun, 31 Mar 2024 10:33:52 +0200 Subject: [PATCH] dont call .disabled behaviour in a hard loop --- haxe/ui/components/ColorPicker.hx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/haxe/ui/components/ColorPicker.hx b/haxe/ui/components/ColorPicker.hx index 2a7db5fc5..b08b0b135 100644 --- a/haxe/ui/components/ColorPicker.hx +++ b/haxe/ui/components/ColorPicker.hx @@ -252,13 +252,14 @@ private class HSVColorPickerImpl extends ColorPickerImpl { _saturationValueGraphBytes = Bytes.alloc(bytesSize); } + var isDisabled = picker.disabled; var stepX = 100 / cx; var stepY = 100 / cy; for (y in 0...Std.int(cy)) { for (x in 0...Std.int(cx)) { var i:Int = Std.int(y * (cx * 4) + x * 4); var pixel = ColorUtil.hsvToRGBF(_currentColorHSV.h - 1, (x + 1) * stepX, 100 - (y * stepY)); - if (picker.disabled) { + if (isDisabled) { var greypixel = ColorUtil.rgbToGray(Math.round(pixel.r), Math.round(pixel.g), Math.round(pixel.b)); _saturationValueGraphBytes.set(i + 0, greypixel); _saturationValueGraphBytes.set(i + 1, greypixel); @@ -304,12 +305,13 @@ private class HSVColorPickerImpl extends ColorPickerImpl { _hueGraphBytes = Bytes.alloc(bytesSize); } + var isDisabled = picker.disabled; var step = 360 / cx; for (y in 0...Std.int(cy)) { for (x in 0...Std.int(cx)) { var i:Int = Std.int(y * (cx * 4) + x * 4); var c = ColorUtil.hsvToRGBF(x * step, 100, 100); - if (picker.disabled) { + if (isDisabled) { var greypixel = ColorUtil.rgbToGray(Math.round(c.r), Math.round(c.g), Math.round(c.b)); _hueGraphBytes.set(i + 0, greypixel); _hueGraphBytes.set(i + 1, greypixel);