Skip to content

Commit

Permalink
fixup! ColorChooser : Optimize slider redraws
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Oct 25, 2024
1 parent 7712b4e commit dd5aad0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/GafferUI/ColorChooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def __init__( self, color, component, dynamicColors = False, **kw ) :
self.component = component
self.__dynamicColors = dynamicColors
self.__gradientToDraw = None
self.__size = self.size()

# Sets the slider color in RGB space for RGBA channels,
# HSV space for HSV channels and TMI space for TMI channels.
Expand Down Expand Up @@ -161,7 +162,7 @@ def _drawBackground( self, painter ) :

size = self.size()

if self.__gradientToDraw is None :
if self.__gradientToDraw is None or size != self.__size :
self.__gradientToDraw = QtGui.QLinearGradient( 0, 0, size.x, 0 )

displayTransform = self.displayTransform()
Expand Down Expand Up @@ -199,6 +200,7 @@ def _drawBackground( self, painter ) :

brush = QtGui.QBrush( self.__gradientToDraw )
painter.fillRect( 0, 0, size.x, size.y, brush )
self.__size = size

def _drawValue( self, painter, value, position, state ) :

Expand Down

0 comments on commit dd5aad0

Please sign in to comment.