xf86RandR12: Move calculating of shift inside init_one_component
This is a preparation patch to allow easier usage of init_one_component outside of xf86RandR12CrtcInitGamma. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
299cbb9267
commit
a58dd678bf
|
@ -1325,9 +1325,12 @@ xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_one_component(CARD16 *comp, unsigned size, unsigned shift, float gamma)
|
init_one_component(CARD16 *comp, unsigned size, float gamma)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
unsigned shift;
|
||||||
|
|
||||||
|
for (shift = 0; (size << shift) < (1 << 16); shift++);
|
||||||
|
|
||||||
if (gamma == 1.0) {
|
if (gamma == 1.0) {
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
|
@ -1344,7 +1347,7 @@ static Bool
|
||||||
xf86RandR12CrtcInitGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
|
xf86RandR12CrtcInitGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
|
||||||
float gamma_blue)
|
float gamma_blue)
|
||||||
{
|
{
|
||||||
unsigned size = crtc->randr_crtc->gammaSize, shift;
|
unsigned size = crtc->randr_crtc->gammaSize;
|
||||||
CARD16 *red, *green, *blue;
|
CARD16 *red, *green, *blue;
|
||||||
|
|
||||||
if (!crtc->funcs->gamma_set &&
|
if (!crtc->funcs->gamma_set &&
|
||||||
|
@ -1358,11 +1361,9 @@ xf86RandR12CrtcInitGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
|
||||||
green = red + size;
|
green = red + size;
|
||||||
blue = green + size;
|
blue = green + size;
|
||||||
|
|
||||||
for (shift = 0; (size << shift) < (1 << 16); shift++);
|
init_one_component(red, size, gamma_red);
|
||||||
|
init_one_component(green, size, gamma_green);
|
||||||
init_one_component(red, size, shift, gamma_red);
|
init_one_component(blue, size, gamma_blue);
|
||||||
init_one_component(green, size, shift, gamma_green);
|
|
||||||
init_one_component(blue, size, shift, gamma_blue);
|
|
||||||
|
|
||||||
RRCrtcGammaSet(crtc->randr_crtc, red, green, blue);
|
RRCrtcGammaSet(crtc->randr_crtc, red, green, blue);
|
||||||
free(red);
|
free(red);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user