diff --git a/headers/os/interface/ColorControl.h b/headers/os/interface/ColorControl.h index 647a30aae3..83900982ef 100644 --- a/headers/os/interface/ColorControl.h +++ b/headers/os/interface/ColorControl.h @@ -102,7 +102,8 @@ private: uint8 shade) const; BRect _PaletteSelectorFrame(uint8 colorIndex) const; BRect _RampFrame(uint8 rampIndex) const; - + void _SetCellSize(float size); + private: BRect fPaletteFrame; int16 fSelectedPaletteColorIndex; diff --git a/src/kits/interface/ColorControl.cpp b/src/kits/interface/ColorControl.cpp index c9edb40269..ad450cca22 100644 --- a/src/kits/interface/ColorControl.cpp +++ b/src/kits/interface/ColorControl.cpp @@ -84,7 +84,8 @@ BColorControl::_InitData(color_control_layout layout, float size, // so we take the main_screen colorspace at startup fColumns = layout; fRows = 256 / fColumns; - fCellSize = ceil(max_c(kMinCellSize, size)); + + _SetCellSize(size); fSelectedPaletteColorIndex = -1; fPreviousSelectedPaletteColorIndex = -1; @@ -611,6 +612,13 @@ BColorControl::_RampFrame(uint8 rampIndex) const } +void +BColorControl::_SetCellSize(float size) +{ + fCellSize = ceilf(max_c(kMinCellSize, size)); +} + + BRect BColorControl::_PaletteSelectorFrame(uint8 colorIndex) const { @@ -635,9 +643,9 @@ BColorControl::_InitOffscreen() void -BColorControl::SetCellSize(float cellSide) +BColorControl::SetCellSize(float size) { - fCellSize = ceil(max_c(kMinCellSize, cellSide)); + _SetCellSize(size); _LayoutView(); ResizeToPreferred(); }