Patch by cl21 (I really hope this isn't your real name :P ) which fixes
the BColorControl flickering reported in bug #503. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23192 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -222,26 +222,46 @@ BColorControl::SetValue(int32 value)
|
||||
c2.blue = (value & 0x0000FF00) >> 8;
|
||||
char string[4];
|
||||
|
||||
// values for calculating the selector rectangles for invalidation
|
||||
// analogous to selector drawing in _DrawColorArea
|
||||
float rampXGradient = (ceil(fColumns * fCellSize) - 4 - 7) / 255;
|
||||
float rampSize = (Bounds().bottom - 2) / 4.0;
|
||||
float x, y;
|
||||
|
||||
if (c1.red != c2.red) {
|
||||
sprintf(string, "%d", c2.red);
|
||||
fRedText->SetText(string);
|
||||
|
||||
y = rampSize * 1.5;
|
||||
x = 2 + c1.red * rampXGradient;
|
||||
Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
|
||||
x = 2 + c2.red * rampXGradient;
|
||||
Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
|
||||
}
|
||||
|
||||
if (c1.green != c2.green) {
|
||||
sprintf(string, "%d", c2.green);
|
||||
fGreenText->SetText(string);
|
||||
}
|
||||
|
||||
y = rampSize * 2.5;
|
||||
x = 2 + c1.green * rampXGradient;
|
||||
Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
|
||||
x = 2 + c2.green * rampXGradient;
|
||||
Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
|
||||
}
|
||||
if (c1.blue != c2.blue) {
|
||||
sprintf(string, "%d", c2.blue);
|
||||
fBlueText->SetText(string);
|
||||
|
||||
y = rampSize * 3.5;
|
||||
x = 2 + c1.blue * rampXGradient;
|
||||
Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
|
||||
x = 2 + c2.blue * rampXGradient;
|
||||
Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
|
||||
}
|
||||
|
||||
BControl::SetValueNoUpdate(value);
|
||||
|
||||
// TODO: This causes lot of flickering
|
||||
Invalidate();
|
||||
|
||||
if (LockLooper()) {
|
||||
Window()->UpdateIfNeeded();
|
||||
UnlockLooper();
|
||||
|
||||
Reference in New Issue
Block a user