static int w32gdi_get_temperature(void){ gamma_ramp_s ramp=gamma_get_ramps(GAMMA_RAMP_SIZE); float rb_ratio; HDC hdc; hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL); if( (!hdc)||(!ramp.all) ){ LOG(LOGERR,_("No device context or ramp.")); (void)DeleteDC(hdc); return RET_FUN_FAILED; } if( !GetDeviceGammaRamp(hdc,ramp.all) ){ LOG(LOGERR,_("Unable to get gamma ramps.")); (void)DeleteDC(hdc); return RET_FUN_FAILED; } if( (!ramp.r)||(!ramp.b) ){ LOG(LOGERR,_("No ramps found.")); (void)DeleteDC(hdc); return RET_FUN_FAILED; } (void)DeleteDC(hdc); rb_ratio = (float)ramp.r[255]/(float)ramp.b[255]; return gamma_find_temp(rb_ratio); }
static int w32gdi_get_temperature(void){ gamma_ramp_s ramp=gamma_get_ramps(GAMMA_RAMP_SIZE); float rb_ratio; if( (!state.hDC)||(!ramp.all) ){ LOG(LOGERR,_("No device context or ramp.")); return RET_FUN_FAILED; } if( !GetDeviceGammaRamp(state.hDC,ramp.all) ){ LOG(LOGERR,_("Unable to get gamma ramps.")); return RET_FUN_FAILED; } if( (!ramp.r)||(!ramp.b) ){ LOG(LOGERR,_("No ramps found.")); return RET_FUN_FAILED; } rb_ratio = (float)ramp.r[255]/(float)ramp.b[255]; return gamma_find_temp(rb_ratio); }