|
|
@@ -5703,7 +5703,6 @@ void _create_gamma_table (float gamma, unsigned short *original_red_table, unsig
|
|
|
// Access: Public, Static
|
|
|
// Description: Static function for getting the original gamma.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
bool DXGraphicsStateGuardian9::
|
|
|
get_gamma_table(void) {
|
|
|
bool get;
|
|
|
@@ -5732,7 +5731,7 @@ get_gamma_table(void) {
|
|
|
// for atexit.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
bool DXGraphicsStateGuardian9::
|
|
|
-static_set_gamma(float gamma) {
|
|
|
+static_set_gamma(bool restore, float gamma) {
|
|
|
bool set;
|
|
|
HDC hdc = GetDC(NULL);
|
|
|
|
|
|
@@ -5740,7 +5739,7 @@ static_set_gamma(float gamma) {
|
|
|
if (hdc) {
|
|
|
unsigned short ramp [256 * 3];
|
|
|
|
|
|
- if (_gamma_table_initialized) {
|
|
|
+ if (restore && _gamma_table_initialized) {
|
|
|
_create_gamma_table (gamma, &_orignial_gamma_table [0], &_orignial_gamma_table [256], &_orignial_gamma_table [512], &ramp [0], &ramp [256], &ramp [512]);
|
|
|
}
|
|
|
else {
|
|
|
@@ -5767,7 +5766,7 @@ bool DXGraphicsStateGuardian9::
|
|
|
set_gamma(float gamma) {
|
|
|
bool set;
|
|
|
|
|
|
- set = static_set_gamma(gamma);
|
|
|
+ set = static_set_gamma(false, gamma);
|
|
|
if (set) {
|
|
|
_gamma = gamma;
|
|
|
}
|
|
|
@@ -5775,6 +5774,16 @@ set_gamma(float gamma) {
|
|
|
return set;
|
|
|
}
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: DXGraphicsStateGuardian9::restore_gamma
|
|
|
+// Access: Published
|
|
|
+// Description: Restore original gamma.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+void DXGraphicsStateGuardian9::
|
|
|
+restore_gamma() {
|
|
|
+ static_set_gamma(true, 1.0f);
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: DXGraphicsStateGuardian9::atexit_function
|
|
|
// Access: Public, Static
|
|
|
@@ -5782,5 +5791,5 @@ set_gamma(float gamma) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void DXGraphicsStateGuardian9::
|
|
|
atexit_function(void) {
|
|
|
- static_set_gamma(1.0);
|
|
|
+ static_set_gamma(true, 1.0f);
|
|
|
}
|