Skip to content

Commit

Permalink
Add generic "cache_size" configuration instead of specific FreeType p…
Browse files Browse the repository at this point in the history
…arameters.

Restructure configuration files (server, client).
Fix bug of gamma ramp in client.
Fix bug of pixel mode in RPC.
Disable warning C4251 (DLL).
Update version information.
  • Loading branch information
Crend King authored and Crend King committed Dec 24, 2011
1 parent 575aaf4 commit 8cdb153
Show file tree
Hide file tree
Showing 41 changed files with 516 additions and 238 deletions.
4 changes: 2 additions & 2 deletions gdipp_client/api_override.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ BOOL WINAPI ExtTextOutW_hook(HDC hdc, int x, int y, UINT options, CONST RECT * l
error_status_t e;
GDIPP_RPC_SESSION_HANDLE h_session = NULL;
e = gdipp_rpc_begin_session(h_gdipp_rpc, reinterpret_cast<const byte *>(&context.log_font), sizeof(context.log_font), context.bmp_header.biBitCount, &h_session);
if (e != 0)
if (e != 0 || h_session == NULL)
goto fail_safe_text_out;

e = gdipp_rpc_make_bitmap_glyph_run(h_gdipp_rpc, h_session, lpString, c, is_glyph_index, &glyph_run);
Expand All @@ -190,7 +190,7 @@ BOOL WINAPI ExtTextOutW_hook(HDC hdc, int x, int y, UINT options, CONST RECT * l
{
case client_config::PAINTER_D2D:
//painter = new gdimm_wic_painter;
break;
//break;
default:
painter = new gdi_painter;
break;
Expand Down
6 changes: 5 additions & 1 deletion gdipp_client/gamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ const BYTE *gamma::get_ramp(double gamma)
void gamma::init_ramp(double gamma)
{
BYTE *new_ramp = new BYTE[256];
const double gamma_inv = 1 / gamma;

for (int i = 0; i < 256; ++i)
new_ramp[i] = static_cast<BYTE>((pow(i / 255.0, gamma) * 255));
{
double a = pow(i / 255.0, gamma);
new_ramp[i] = static_cast<BYTE>((pow(i / 255.0, gamma_inv) * 255));
}

_gamma_ramps[gamma] = new_ramp;
}
Expand Down
9 changes: 5 additions & 4 deletions gdipp_client/gdi_painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,14 @@ BOOL gdi_painter::paint_glyph_run(UINT options, CONST RECT *lprect, const gdipp_
if (options & ETO_CLIPPED && !IntersectRect(&grm.visible_rect, &grm.visible_rect, lprect))
return FALSE;

switch (glyph_run.glyphs[0].pixel_mode)
switch (glyph_run.render_mode)
{
case FT_PIXEL_MODE_LCD:
case FT_RENDER_MODE_LCD:
return paint_lcd(options, lprect, glyph_run, grm);
case FT_PIXEL_MODE_GRAY:
case FT_RENDER_MODE_NORMAL:
case FT_RENDER_MODE_LIGHT:
return paint_gray(options, lprect, glyph_run, grm);
case FT_PIXEL_MODE_MONO:
case FT_RENDER_MODE_MONO:
return paint_mono(options, lprect, glyph_run, grm);
default:
return FALSE;
Expand Down
8 changes: 4 additions & 4 deletions gdipp_client/gdipp_client.rc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,2,0
PRODUCTVERSION 0,9,2,0
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -71,12 +71,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "gdipp Project"
VALUE "FileDescription", "gdipp Client"
VALUE "FileVersion", "0, 9, 2, 0"
VALUE "FileVersion", "1, 0, 0, 0"
VALUE "InternalName", "gdipp_client"
VALUE "LegalCopyright", "Copyright (C) gdipp Project 2010"
VALUE "OriginalFilename", "gdipp_client.dll"
VALUE "ProductName", "gdipp Client"
VALUE "ProductVersion", "0, 9, 2, 0"
VALUE "ProductVersion", "1, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
Expand Down
120 changes: 114 additions & 6 deletions gdipp_client/gdipp_client.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
Expand Down Expand Up @@ -135,6 +136,7 @@
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
Expand Down Expand Up @@ -215,6 +217,7 @@
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
Expand Down Expand Up @@ -297,6 +300,7 @@
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
Expand Down Expand Up @@ -368,6 +372,42 @@
RelativePath=".\com_override.cpp"
>
</File>
<File
RelativePath=".\font_store.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\gamma.cpp"
>
Expand All @@ -381,10 +421,11 @@
>
</File>
<File
RelativePath="..\gdipp_rpc\Win32\gdipp_rpc_c.c"
RelativePath="..\gdipp_rpc\x64\gdipp_rpc_c.c"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -393,7 +434,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -402,6 +442,7 @@
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -410,7 +451,6 @@
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -419,11 +459,10 @@
</FileConfiguration>
</File>
<File
RelativePath="..\gdipp_rpc\x64\gdipp_rpc_c.c"
RelativePath="..\gdipp_rpc\Win32\gdipp_rpc_c.c"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -432,6 +471,7 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -440,7 +480,6 @@
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -449,6 +488,7 @@
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Expand Down Expand Up @@ -515,6 +555,74 @@
<File
RelativePath=".\wic_dib.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\wic_painter.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Expand Down
2 changes: 1 addition & 1 deletion gdipp_client/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ client_config_static client_config_instance;
gamma gamma_instance;
hook hook_instance;
mem_man mem_man_instance;
render_config_delta_cache render_config_delta_cache_instance(config_file_instance);
//render_config_delta_cache render_config_delta_cache_instance(config_file_instance);

}
2 changes: 1 addition & 1 deletion gdipp_client/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ extern client_config_static client_config_instance;
extern gamma gamma_instance;
extern hook hook_instance;
extern mem_man mem_man_instance;
extern render_config_delta_cache render_config_delta_cache_instance;
//extern render_config_delta_cache render_config_delta_cache_instance;

}
16 changes: 8 additions & 8 deletions gdipp_config/client_config_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ client_config_static::client_config_static()

void client_config_static::parse(const config &cfg)
{
gamma.red = cfg.get_number(L"/gdipp/paint/gamma/red/text()", gamma.red);
gamma.green = cfg.get_number(L"/gdipp/paint/gamma/green/text()", gamma.green);
gamma.blue = cfg.get_number(L"/gdipp/paint/gamma/blue/text()", gamma.blue);
painter = static_cast<client_config::PAINTER_TYPE>(cfg.get_number(L"/gdipp/paint/painter/text()", static_cast<int>(painter)));
pixel_geometry = static_cast<client_config::PIXEL_GEOMETRY_TYPE>(cfg.get_number(L"/gdipp/paint/pixel_geometry/text()", static_cast<int>(pixel_geometry)));
shadow.offset_x = cfg.get_number(L"/gdipp/paint/shadow/offset_x/text()", shadow.offset_x);
shadow.offset_y = cfg.get_number(L"/gdipp/paint/shadow/offset_y/text()", shadow.offset_y);
shadow.alpha = cfg.get_number(L"/gdipp/paint/shadow/alpha/text()", static_cast<int>(shadow.alpha));
gamma.red = cfg.get_number(L"/gdipp/client/paint/gamma/red/text()", gamma.red);
gamma.green = cfg.get_number(L"/gdipp/client/paint/gamma/green/text()", gamma.green);
gamma.blue = cfg.get_number(L"/gdipp/client/paint/gamma/blue/text()", gamma.blue);
painter = static_cast<client_config::PAINTER_TYPE>(cfg.get_number(L"/gdipp/client/paint/painter/text()", static_cast<int>(painter)));
pixel_geometry = static_cast<client_config::PIXEL_GEOMETRY_TYPE>(cfg.get_number(L"/gdipp/client/paint/pixel_geometry/text()", static_cast<int>(pixel_geometry)));
shadow.offset_x = cfg.get_number(L"/gdipp/client/paint/shadow/offset_x/text()", shadow.offset_x);
shadow.offset_y = cfg.get_number(L"/gdipp/client/paint/shadow/offset_y/text()", shadow.offset_y);
shadow.alpha = cfg.get_number(L"/gdipp/client/paint/shadow/alpha/text()", static_cast<int>(shadow.alpha));
}

}
18 changes: 0 additions & 18 deletions gdipp_config/config_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,5 @@ bool config_file::empty() const
pugi::xml_document *config_xml_doc = reinterpret_cast<pugi::xml_document *>(_config_xml);
return config_xml_doc->empty();
}
/*
render_config config_file::get_font_render_config(bool bold, bool italic, LONG height, const wchar_t *font_name)
{
if (_cache == NULL)
{
render_config render_conf;
if (_config_xml == NULL)
return render_conf;
pugi::xml_document *config_xml_doc = reinterpret_cast<pugi::xml_document *>(_config_xml);

const pugi::xpath_node_set render_font_nodes = config_xml_doc->select_nodes(L"/gdipp/render/font");
_cache = new render_config_cache(&render_font_nodes);
}
return _cache->get_render_config(bold, italic, height, font_name);
}
*/
}
14 changes: 0 additions & 14 deletions gdipp_config/constant_freetype.h

This file was deleted.

Loading

0 comments on commit 8cdb153

Please sign in to comment.