Skip to content

Commit

Permalink
Remove "using namespace".
Browse files Browse the repository at this point in the history
Use "gdipp" namespace to prevent name collision.
Remove gdipp_ prefix from type names.
Rename "setting" type names to "config".
  • Loading branch information
Crend King authored and Crend King committed Aug 6, 2011
1 parent ac1fc5c commit e9712b2
Show file tree
Hide file tree
Showing 94 changed files with 1,873 additions and 2,098 deletions.
4 changes: 0 additions & 4 deletions MurmurHash/MurmurHash.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\bigint.h"
>
</File>
<File
RelativePath=".\MurmurHash3.h"
>
Expand Down
18 changes: 9 additions & 9 deletions MurmurHash/MurmurHash3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ void MurmurHash3_x86_32 ( const void * key, int len,

const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);

for(int i = -nblocks; i; ++i)
for(int i = -nblocks; i; i++)
{
uint32_t k1 = getblock(blocks,i);

k1 *= c1;
k1 = ROTL32(k1,15);
k1 *= c2;

h1 ^= k1;
h1 = ROTL32(h1,13);
h1 = ROTL32(h1,13);
h1 = h1*5+0xe6546b64;
}

Expand All @@ -132,7 +132,7 @@ void MurmurHash3_x86_32 ( const void * key, int len,
case 3: k1 ^= tail[2] << 16;
case 2: k1 ^= tail[1] << 8;
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1,16); k1 *= c2; h1 ^= k1;
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
};

//----------
Expand All @@ -143,7 +143,7 @@ void MurmurHash3_x86_32 ( const void * key, int len,
h1 = fmix(h1);

*(uint32_t*)out = h1;
}
}

//-----------------------------------------------------------------------------

Expand All @@ -158,17 +158,17 @@ void MurmurHash3_x86_128 ( const void * key, const int len,
uint32_t h3 = seed;
uint32_t h4 = seed;

uint32_t c1 = 0x239b961b;
uint32_t c1 = 0x239b961b;
uint32_t c2 = 0xab0e9789;
uint32_t c3 = 0x38b34ae5;
uint32_t c3 = 0x38b34ae5;
uint32_t c4 = 0xa1e38b93;

//----------
// body

const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);

for(int i = -nblocks; i; ++i)
for(int i = -nblocks; i; i++)
{
uint32_t k1 = getblock(blocks,i*4+0);
uint32_t k2 = getblock(blocks,i*4+1);
Expand Down Expand Up @@ -269,7 +269,7 @@ void MurmurHash3_x64_128 ( const void * key, const int len,

const uint64_t * blocks = (const uint64_t *)(data);

for(int i = 0; i < nblocks; ++i)
for(int i = 0; i < nblocks; i++)
{
uint64_t k1 = getblock(blocks,i*2+0);
uint64_t k2 = getblock(blocks,i*2+1);
Expand Down
15 changes: 0 additions & 15 deletions MurmurHash/bigint.h

This file was deleted.

14 changes: 6 additions & 8 deletions gdimm/api_override.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
#include "helper_func.h"
#include "gdipp_rpc/gdipp_rpc.h"

//using std::;

#ifdef _DEBUG
const wchar_t *debug_text = L"";
#endif // _DEBUG

set<HDC> hdc_in_path;
std::set<HDC> hdc_in_path;

bool is_valid_dc(HDC hdc)
{
Expand All @@ -21,7 +19,7 @@ bool is_valid_dc(HDC hdc)
if (GetDeviceCaps(hdc, TECHNOLOGY) != DT_RASDISPLAY)
return false;

// the DC use another map mode, which transform the GDI coordination space
// the DC use another std::map mode, which transform the GDI coordination space
// we tried to implement MM_ANISOTROPIC, and found that the text looks worse than the native API
if (GetMapMode(hdc) != MM_TEXT)
return false;
Expand Down Expand Up @@ -178,7 +176,7 @@ BOOL WINAPI ExtTextOutW_hook(HDC hdc, int x, int y, UINT options, CONST RECT * l

RpcTryExcept
{
const GDIPP_RPC_SESSION_HANDLE h_session = gdipp_rpc_begin_session(h_gdipp_rpc, &context.log_font, sizeof(context.log_font));
const rpc_session_HANDLE h_session = gdipp_rpc_begin_session(h_gdipp_rpc, &context.log_font, sizeof(context.log_font));
const GDIPP_RPC_GLYPH_RUN_HANDLE h_glyph_run = gdipp_rpc_make_glyph_run(h_gdipp_rpc, h_session, lpString, c, is_glyph_index);
const unsigned long glyph_run_size = gdipp_rpc_get_glyph_run_size(h_gdipp_rpc, h_glyph_run);
BYTE *glyph_run_buf = new BYTE[glyph_run_size];
Expand Down Expand Up @@ -289,7 +287,7 @@ bool get_text_extent(HDC hdc, LPCWSTR lpString, int count, LPSIZE lpSize, bool i
// for GetTextExtentExPoint series
if (lpnFit != NULL || lpnDx != NULL)
{
list<RECT>::const_iterator box_iter;
std::list<RECT>::const_iterator box_iter;
INT curr_index;
for (box_iter = a_glyph_run.ctrl_boxes.begin(), curr_index = 0; box_iter != a_glyph_run.ctrl_boxes.end(); ++box_iter, ++curr_index)
{
Expand All @@ -306,7 +304,7 @@ bool get_text_extent(HDC hdc, LPCWSTR lpString, int count, LPSIZE lpSize, bool i

BOOL APIENTRY GetTextExtentPoint32A_hook(HDC hdc, LPCSTR lpString, int c, LPSIZE lpSize)
{
wstring wide_char_str;
std::wstring wide_char_str;
if (mb_to_wc(lpString, c, wide_char_str))
{
if (get_text_extent(hdc, wide_char_str.c_str(), static_cast<int>(wide_char_str.size()), lpSize, false))
Expand Down Expand Up @@ -334,7 +332,7 @@ BOOL WINAPI GetTextExtentPointI_hook(HDC hdc, LPWORD pgiIn, int cgi, LPSIZE lpSi

BOOL APIENTRY GetTextExtentExPointA_hook(HDC hdc, LPCSTR lpszString, int cchString, int nMaxExtent, LPINT lpnFit, LPINT lpnDx, LPSIZE lpSize)
{
wstring wide_char_str;
std::wstring wide_char_str;
if (mb_to_wc(lpszString, cchString, wide_char_str))
{
if (get_text_extent(hdc, wide_char_str.c_str(), static_cast<int>(wide_char_str.size()), lpSize, false, nMaxExtent, lpnFit, lpnDx))
Expand Down
4 changes: 2 additions & 2 deletions gdimm/font_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gdimm_font_store::~gdimm_font_store()
{
BOOL b_ret;

for (map<long, font_info>::const_iterator iter = _id_to_info.begin(); iter != _id_to_info.upper_bound(-1); iter++)
for (std::map<long, font_info>::const_iterator iter = _id_to_info.begin(); iter != _id_to_info.upper_bound(-1); ++iter)
{
// unregister linked fonts
//DeleteObject(iter->second.linked_hfont);
Expand All @@ -25,7 +25,7 @@ gdimm_font_store::~gdimm_font_store()

font_info *gdimm_font_store::lookup_font(long font_id)
{
map<long, font_info>::iterator iter = _id_to_info.find(font_id);
std::map<long, font_info>::iterator iter = _id_to_info.find(font_id);
if (iter == _id_to_info.end())
return NULL;

Expand Down
2 changes: 0 additions & 2 deletions gdimm/font_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "font_man.h"
#include "helper_def.h"

//using std::;

class gdimm_font_store
{
public:
Expand Down
24 changes: 12 additions & 12 deletions gdimm/gamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,13 @@

gdimm_gamma::~gdimm_gamma()
{
for (map<double, BYTE *>::const_iterator iter = _gamma_ramps.begin(); iter != _gamma_ramps.end(); ++iter)
for (std::map<double, BYTE *>::const_iterator iter = _gamma_ramps.begin(); iter != _gamma_ramps.end(); ++iter)
delete[] iter->second;
}

void gdimm_gamma::init_ramp(double gamma)
{
BYTE *new_ramp = new BYTE[256];

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

_gamma_ramps[gamma] = new_ramp;
}

const BYTE *gdimm_gamma::get_ramp(double gamma)
{
map<double, BYTE *>::const_iterator iter = _gamma_ramps.find(gamma);
std::map<double, BYTE *>::const_iterator iter = _gamma_ramps.find(gamma);
if (iter == _gamma_ramps.end())
{
// double-check lock
Expand All @@ -32,3 +22,13 @@ const BYTE *gdimm_gamma::get_ramp(double gamma)

return _gamma_ramps[gamma];
}

void gdimm_gamma::init_ramp(double gamma)
{
BYTE *new_ramp = new BYTE[256];

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

_gamma_ramps[gamma] = new_ramp;
}
4 changes: 1 addition & 3 deletions gdimm/gamma.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

//using std::;

class gdimm_gamma
{
public:
Expand All @@ -12,5 +10,5 @@ class gdimm_gamma
private:
void init_ramp(double gamma);

map<double, BYTE *> _gamma_ramps;
std::map<double, BYTE *> _gamma_ramps;
};
Loading

0 comments on commit e9712b2

Please sign in to comment.