Commit 2370e7b9 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

gdi32: Share font_gamma_ramp structure between all DCs.

parent 94db5c87
...@@ -168,7 +168,6 @@ static void free_dc_state( DC *dc ) ...@@ -168,7 +168,6 @@ static void free_dc_state( DC *dc )
if (dc->hVisRgn) DeleteObject( dc->hVisRgn ); if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
if (dc->region) DeleteObject( dc->region ); if (dc->region) DeleteObject( dc->region );
if (dc->path) free_gdi_path( dc->path ); if (dc->path) free_gdi_path( dc->path );
HeapFree( GetProcessHeap(), 0, dc->font_gamma_ramp );
HeapFree( GetProcessHeap(), 0, dc ); HeapFree( GetProcessHeap(), 0, dc );
} }
......
...@@ -88,7 +88,7 @@ struct intensity_range ...@@ -88,7 +88,7 @@ struct intensity_range
struct font_intensities struct font_intensities
{ {
struct intensity_range ranges[17]; struct intensity_range ranges[17];
struct font_gamma_ramp *gamma_ramp; const struct font_gamma_ramp *gamma_ramp;
}; };
typedef struct dibdrv_physdev typedef struct dibdrv_physdev
......
...@@ -730,20 +730,17 @@ static void update_font_code_page( DC *dc, HANDLE font ) ...@@ -730,20 +730,17 @@ static void update_font_code_page( DC *dc, HANDLE font )
TRACE("charset %d => cp %d\n", charset, dc->font_code_page); TRACE("charset %d => cp %d\n", charset, dc->font_code_page);
} }
static struct font_gamma_ramp *get_font_gamma_ramp( void ) static BOOL WINAPI fill_font_gamma_ramp( INIT_ONCE *once, void *param, void **context )
{ {
static const WCHAR desktopW[] = { 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\', static const WCHAR desktopW[] = { 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
'D','e','s','k','t','o','p',0 }; 'D','e','s','k','t','o','p',0 };
static const WCHAR smoothing_gamma[] = { 'F','o','n','t','S','m','o','o','t','h','i','n','g', static const WCHAR smoothing_gamma[] = { 'F','o','n','t','S','m','o','o','t','h','i','n','g',
'G','a','m','m','a',0 }; 'G','a','m','m','a',0 };
struct font_gamma_ramp *ramp = param;
const DWORD gamma_default = 1400; const DWORD gamma_default = 1400;
struct font_gamma_ramp *ramp;
DWORD i, gamma; DWORD i, gamma;
HKEY key; HKEY key;
ramp = HeapAlloc( GetProcessHeap(), 0, sizeof(*ramp) );
if ( ramp == NULL) return NULL;
gamma = gamma_default; gamma = gamma_default;
if (RegOpenKeyW( HKEY_CURRENT_USER, desktopW, &key ) == ERROR_SUCCESS) if (RegOpenKeyW( HKEY_CURRENT_USER, desktopW, &key ) == ERROR_SUCCESS)
{ {
...@@ -768,7 +765,16 @@ static struct font_gamma_ramp *get_font_gamma_ramp( void ) ...@@ -768,7 +765,16 @@ static struct font_gamma_ramp *get_font_gamma_ramp( void )
ramp->gamma = gamma; ramp->gamma = gamma;
TRACE("gamma %d\n", ramp->gamma); TRACE("gamma %d\n", ramp->gamma);
return ramp; return TRUE;
}
static struct font_gamma_ramp *get_font_gamma_ramp( void )
{
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
static struct font_gamma_ramp ramp;
InitOnceExecuteOnce( &init_once, fill_font_gamma_ramp, &ramp, NULL );
return &ramp;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -99,7 +99,7 @@ typedef struct tagDC ...@@ -99,7 +99,7 @@ typedef struct tagDC
struct gdi_path *path; struct gdi_path *path;
struct font_gamma_ramp *font_gamma_ramp; const struct font_gamma_ramp *font_gamma_ramp;
UINT font_code_page; UINT font_code_page;
WORD ROPmode; WORD ROPmode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment