mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Modify static_set_gamma() method, due to code merge error.
This commit is contained in:
parent
c09217cd1c
commit
5eeb1fbbcf
@ -389,7 +389,7 @@ describe_pixel_format(FrameBufferProperties &fb_props) {
|
|||||||
bool osxGraphicsStateGuardian::
|
bool osxGraphicsStateGuardian::
|
||||||
static_set_gamma(float gamma) {
|
static_set_gamma(float gamma) {
|
||||||
bool set;
|
bool set;
|
||||||
|
CGDisplayRestoreColorSyncSettings();
|
||||||
set = false;
|
set = false;
|
||||||
|
|
||||||
CGGammaValue gOriginalRedTable[ 256 ];
|
CGGammaValue gOriginalRedTable[ 256 ];
|
||||||
@ -408,16 +408,23 @@ static_set_gamma(float gamma) {
|
|||||||
short j, i;
|
short j, i;
|
||||||
short y[3];
|
short y[3];
|
||||||
|
|
||||||
|
for (j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
y[j] = 255;
|
||||||
|
};
|
||||||
|
|
||||||
gamma = (2 * gamma) + 1.0;
|
gamma = (2 * gamma) + 1.0;
|
||||||
|
|
||||||
y[0] = 256 * gamma;
|
y[0] = 256 * gamma;
|
||||||
y[1] = 256 * gamma;
|
y[1] = 256 * gamma;
|
||||||
y[2] = 256 * gamma;
|
y[2] = 256 * gamma;
|
||||||
|
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
redTable[i] = gOriginalRedTable[ i ] * (y[ 0 ] ) / 256;
|
redTable[i] = gOriginalRedTable[ i ] * (y[ 0 ] ) / 256;
|
||||||
greenTable[ i ] = gOriginalGreenTable[ i ] * (y[ 1 ] ) / 256;
|
greenTable[ i ] = gOriginalGreenTable[ i ] * (y[ 1 ] ) / 256;
|
||||||
blueTable[ i ] = gOriginalBlueTable[ i ] * (y[ 2 ] ) / 256;
|
blueTable[ i ] = gOriginalBlueTable[ i ] * (y[ 2 ] ) / 256;
|
||||||
|
};
|
||||||
cgErr = CGSetDisplayTransferByTable( 0, 256, redTable, greenTable, blueTable);
|
cgErr = CGSetDisplayTransferByTable( 0, 256, redTable, greenTable, blueTable);
|
||||||
|
|
||||||
if (cgErr == 0){
|
if (cgErr == 0){
|
||||||
@ -425,6 +432,7 @@ static_set_gamma(float gamma) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user