diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 11:09:44 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 11:09:44 -0700 |
commit | fbf266fc0ea4be2523cbb901a641aa33f0035662 (patch) | |
tree | d0e5eda4d3c220818903eca76bc2ca835a1851d0 /core/src/fxge/ge | |
parent | 3c949d5d2b0d680839766ea99c86b263230b263d (diff) | |
download | pdfium-fbf266fc0ea4be2523cbb901a641aa33f0035662.tar.xz |
Remove typdefs for pointer types in fx_system.h.
This involves fixing some multiple variable per line
declarations, as the textually-substituted "*" applies
only to the first one.
This involves moving some consts around following the
substitution.
This involves replacing some typedefs used as constructors
with better code.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1171733003
Diffstat (limited to 'core/src/fxge/ge')
-rw-r--r-- | core/src/fxge/ge/fx_ge.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_device.cpp | 6 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_font.cpp | 10 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 94 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_linux.cpp | 32 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_path.cpp | 10 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_ps.cpp | 54 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 56 |
8 files changed, 132 insertions, 132 deletions
diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index dffc98962f..734d0d4eb7 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -65,7 +65,7 @@ void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) i++; } } -FX_LPCBYTE CFX_GEModule::GetTextGammaTable() +const uint8_t* CFX_GEModule::GetTextGammaTable() { return m_GammaValue; } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 0b4ffd5f4c..8461396c1f 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -390,16 +390,16 @@ FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int left, return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, dest_height, &clip_box, flags, alpha_flag, pIccTransform); } FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_mode) { return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, flags, handle, alpha_flag, pIccTransform, blend_mode); } -FX_BOOL CFX_RenderDevice::ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause) +FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { return m_pDeviceDriver->ContinueDIBits(handle, pPause); } -void CFX_RenderDevice::CancelDIBits(FX_LPVOID handle) +void CFX_RenderDevice::CancelDIBits(void* handle) { m_pDeviceDriver->CancelDIBits(handle); } diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 8928d25d4c..21c1081480 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -8,7 +8,7 @@ #include "../../../include/fxge/fx_freetype.h" #include "text_int.h" #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em) -extern void _FPDFAPI_GetInternalFontData(int id1, FX_LPCBYTE& data, FX_DWORD& size); +extern void _FPDFAPI_GetInternalFontData(int id1, const uint8_t*& data, FX_DWORD& size); CFX_Font::CFX_Font() { m_pSubstFont = NULL; @@ -153,7 +153,7 @@ int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriAdvance(m_Face)); return width; } -static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) +static FXFT_Face FT_LoadFont(uint8_t* pData, int size) { FXFT_Library library; if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { @@ -171,12 +171,12 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } return face; } -FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) +FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size) { m_pFontDataAllocation = FX_Alloc(uint8_t, size); FXSYS_memcpy32(m_pFontDataAllocation, data, size); - m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); - m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; + m_Face = FT_LoadFont((uint8_t*)m_pFontDataAllocation, size); + m_pFontData = (uint8_t*)m_pFontDataAllocation; m_bEmbedded = TRUE; m_dwSize = size; return m_Face != NULL; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 9bb53c638f..afa9918690 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -117,7 +117,7 @@ FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bT CharsetCP, pSubstFont); } FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE& pFontData) + int weight, FX_BOOL bItalic, uint8_t*& pFontData) { CFX_ByteString key(face_name); key += ','; @@ -133,7 +133,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, return NULL; } FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index) + int weight, FX_BOOL bItalic, uint8_t* pData, FX_DWORD size, int face_index) { CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 1; @@ -164,7 +164,7 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, m_FaceMap.SetAt(key, pFontDesc); return pFontDesc->m_SingleFace.m_pFace; } -const FX_LPCSTR g_Base14FontNames[14] = { +const FX_CHAR* const g_Base14FontNames[14] = { "Courier", "Courier-Bold", "Courier-BoldOblique", @@ -278,7 +278,7 @@ g_AltFontNames[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontName*)element)->m_pName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_AltFontName*)element)->m_pName); } } int _PDF_GetStandardFontName(CFX_ByteString& name) @@ -291,10 +291,10 @@ int _PDF_GetStandardFontName(CFX_ByteString& name) name = g_Base14FontNames[found->m_Index]; return found->m_Index; } -int GetTTCIndex(FX_LPCBYTE pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) +int GetTTCIndex(const uint8_t* pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) { int face_index = 0; - FX_LPCBYTE p = pFontData + 8; + const uint8_t* p = pFontData + 8; FX_DWORD nfont = GET_TT_LONG(p); FX_DWORD index; for (index = 0; index < nfont; index ++) { @@ -311,7 +311,7 @@ int GetTTCIndex(FX_LPCBYTE pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) return face_index; } FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, FX_DWORD checksum, - int font_offset, FX_LPBYTE& pFontData) + int font_offset, uint8_t*& pFontData) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); @@ -329,7 +329,7 @@ FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, FX_DWORD checksum, return pFontDesc->m_TTCFace.m_pFaces[face_index]; } FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, - FX_LPBYTE pData, FX_DWORD size, int font_offset) + uint8_t* pData, FX_DWORD size, int font_offset) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); @@ -346,7 +346,7 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, pFontDesc->m_TTCFace.m_pFaces[face_index] = GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); return pFontDesc->m_TTCFace.m_pFaces[face_index]; } -FXFT_Face CFX_FontMgr::GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_index) +FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index) { FXFT_Library library; if (m_FTLibrary == NULL) { @@ -364,7 +364,7 @@ FXFT_Face CFX_FontMgr::GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_in } return face; } -FXFT_Face CFX_FontMgr::GetFileFace(FX_LPCSTR filename, int face_index) +FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) { FXFT_Library library; if (m_FTLibrary == NULL) { @@ -431,11 +431,11 @@ const FoxitFonts g_FoxitFonts[14] = { {g_FoxitSymbolFontData, 16729}, {g_FoxitDingbatsFontData, 29513}, }; -void _FPDFAPI_GetInternalFontData(int id, FX_LPCBYTE& data, FX_DWORD& size) +void _FPDFAPI_GetInternalFontData(int id, const uint8_t*& data, FX_DWORD& size) { CFX_GEModule::Get()->GetFontMgr()->GetStandardFont(data, size, id); } -FX_BOOL CFX_FontMgr::GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index) +FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index) { if (index > 15 || index < 0) { return FALSE; @@ -490,7 +490,7 @@ void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) } m_pFontInfo = pFontInfo; } -static CFX_ByteString _TT_NormalizeName(FX_LPCSTR family) +static CFX_ByteString _TT_NormalizeName(const FX_CHAR* family) { CFX_ByteString norm(family, -1); norm.Remove(' '); @@ -503,12 +503,12 @@ static CFX_ByteString _TT_NormalizeName(FX_LPCSTR family) norm.MakeLower(); return norm; } -CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name_id) +CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table, FX_DWORD name_id) { - FX_LPCBYTE ptr = name_table + 2; + const uint8_t* ptr = name_table + 2; int name_count = GET_TT_SHORT(ptr); int string_offset = GET_TT_SHORT(ptr + 2); - FX_LPCBYTE string_ptr = name_table + string_offset; + const uint8_t* string_ptr = name_table + string_offset; ptr += 4; for (int i = 0; i < name_count; i ++) { if (GET_TT_SHORT(ptr + 6) == name_id && GET_TT_SHORT(ptr) == 1 && GET_TT_SHORT(ptr + 2) == 0) { @@ -527,10 +527,10 @@ static CFX_ByteString _FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size) buffer.ReleaseBuffer(size); return buffer; } -CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag) +CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, const uint8_t* pTables, FX_DWORD nTables, FX_DWORD tag) { for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = pTables + i * 16; + const uint8_t* p = pTables + i * 16; if (GET_TT_LONG(p) == tag) { FX_DWORD offset = GET_TT_LONG(p + 8); FX_DWORD size = GET_TT_LONG(p + 12); @@ -540,10 +540,10 @@ CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, FX_LPCBYTE pTables, FX_D } return CFX_ByteString(); } -CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag) +CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, const uint8_t* pTables, FX_DWORD nTables, FX_DWORD tag) { for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = pTables + i * 16; + const uint8_t* p = pTables + i * 16; if (GET_TT_LONG(p) == tag) { FX_DWORD offset = GET_TT_LONG(p + 8); FX_DWORD size = GET_TT_LONG(p + 12); @@ -565,7 +565,7 @@ CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) CFX_ByteString result; FX_DWORD size = m_pFontInfo->GetFontData(hFont, 0x6e616d65, NULL, 0); if (size) { - FX_LPBYTE buffer = FX_Alloc(uint8_t, size); + uint8_t* buffer = FX_Alloc(uint8_t, size); m_pFontInfo->GetFontData(hFont, 0x6e616d65, buffer, size); result = _FPDF_GetNameFromTT(buffer, 6); FX_Free(buffer); @@ -584,7 +584,7 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) if (name == m_LastFamily) { return; } - FX_LPCBYTE ptr = name; + const uint8_t* ptr = name; FX_BOOL bLocalized = FALSE; for (int i = 0; i < name.GetLength(); i ++) if (ptr[i] > 0x80) { @@ -744,7 +744,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_FoxitFaces[iBaseFont]) { return m_FoxitFaces[iBaseFont]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; if (m_pFontMgr->GetStandardFont(pFontData, size, iBaseFont)) { m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -762,7 +762,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_MMFaces[1]) { return m_MMFaces[1]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size; m_pFontMgr->GetStandardFont(pFontData, size, 14); m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -772,15 +772,15 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_MMFaces[0]) { return m_MMFaces[0]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 15); m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_MMFaces[0]; } const struct _AltFontFamily { - FX_LPCSTR m_pFontName; - FX_LPCSTR m_pFontFamily; + const FX_CHAR* m_pFontName; + const FX_CHAR* m_pFontFamily; } g_AltFontFamilies[] = { {"AGaramondPro", "Adobe Garamond Pro"}, @@ -790,11 +790,11 @@ g_AltFontFamilies[] = { extern "C" { static int compareFontFamilyString(const void* key, const void* element) { - CFX_ByteString str_key((FX_LPCSTR)key); + CFX_ByteString str_key((const FX_CHAR*)key); if (str_key.Find(((_AltFontFamily*)element)->m_pFontName) != -1) { return 0; } - return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontFamily*)element)->m_pFontName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_AltFontFamily*)element)->m_pFontName); } } #define FX_FONT_STYLE_None 0x00 @@ -823,7 +823,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) return found->m_pFontFamily; }; typedef struct _FX_FontStyle { - FX_LPCSTR style; + const FX_CHAR* style; int32_t len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { @@ -833,7 +833,7 @@ const FX_FontStyle g_FontStyles[] = { { "Reg", 3 }, { "Regular", 7 }, }; -CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) +CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { CFX_ByteTextBuf buf; if (!iLen || iLen <= iIndex) { @@ -903,7 +903,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[12]) { return m_FoxitFaces[12]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -916,7 +916,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[13]) { return m_FoxitFaces[13]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 13); m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -994,7 +994,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (!style.IsEmpty()) { int nLen = style.GetLength(); - FX_LPCSTR pStyle = style; + const FX_CHAR* pStyle = style; int i = 0; FX_BOOL bFirstItem = TRUE; CFX_ByteString buf; @@ -1156,7 +1156,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[12]) { return m_FoxitFaces[12]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -1204,7 +1204,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru for (int i = 0; i < 256; i ++) { checksum += ((FX_DWORD*)temp)[i]; } - FX_LPBYTE pFontData; + uint8_t* pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData); if (face == NULL) { pFontData = FX_Alloc(uint8_t, ttc_size); @@ -1213,7 +1213,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru ttc_size - font_size); } } else { - FX_LPBYTE pFontData; + uint8_t* pFontData; face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); if (face == NULL) { pFontData = FX_Alloc(uint8_t, font_size); @@ -1293,7 +1293,7 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() FX_POSITION pos = m_FontList.GetStartPosition(); while (pos) { CFX_ByteString key; - FX_LPVOID value; + void* value; m_FontList.GetNextAssoc(pos, key, value); delete (CFontFaceInfo*)value; } @@ -1372,7 +1372,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } FX_DWORD face_bytes = nFaces * 4; - FX_LPBYTE offsets = FX_Alloc(uint8_t, face_bytes); + uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { FX_Free(offsets); @@ -1380,7 +1380,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } for (FX_DWORD i = 0; i < nFaces; i ++) { - FX_LPBYTE p = offsets + i * 4; + uint8_t* p = offsets + i * 4; ReportFace(path, pFile, filesize, GET_TT_LONG(p)); } FX_Free(offsets); @@ -1407,7 +1407,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ if (style != "Regular") { facename += " " + style; } - FX_LPVOID p; + void* p; if (m_FontList.Lookup(facename, p)) { return; } @@ -1420,7 +1420,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ pInfo->m_Charsets = 0; CFX_ByteString os2 = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); if (os2.GetLength() >= 86) { - FX_LPCBYTE p = (FX_LPCBYTE)os2 + 78; + const uint8_t* p = (const uint8_t*)os2 + 78; FX_DWORD codepages = GET_TT_LONG(p); if (codepages & (1 << 17)) { m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET); @@ -1457,19 +1457,19 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ } m_FontList.SetAt(facename, pInfo); } -void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact) +void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact) { return NULL; } -void* CFX_FolderFontInfo::GetFont(FX_LPCSTR face) +void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { - FX_LPVOID p; + void* p; if (!m_FontList.Lookup(face, p)) { return NULL; } return p; } -FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { if (hFont == NULL) { return 0; @@ -1493,7 +1493,7 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE } else { FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16; for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = (FX_LPCBYTE)pFont->m_FontTables + i * 16; + const uint8_t* p = (const uint8_t*)pFont->m_FontTables + i * 16; if (GET_TT_LONG(p) == table) { offset = GET_TT_LONG(p + 8); datasize = GET_TT_LONG(p + 12); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index e2ed84e081..027c519fea 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -9,8 +9,8 @@ #include "text_int.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pSubstName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, @@ -29,13 +29,13 @@ Base14Substs[] = { class CFX_LinuxFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); FX_BOOL ParseFontCfg(); - void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL bMatchName); + void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName); }; #define LINUX_GPNAMESIZE 6 static const struct { - FX_LPCSTR NameArr[LINUX_GPNAMESIZE]; + const FX_CHAR* NameArr[LINUX_GPNAMESIZE]; } LinuxGpFontList[] = { {{"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic", "VL Gothic regular"}}, @@ -43,20 +43,20 @@ LinuxGpFontList[] = { {{"TakaoPMincho", "IPAPMincho", "VL Gothic", "Kochi Mincho", NULL, "VL Gothic regular"}}, {{"TakaoMincho", "IPAMincho", "VL Gothic", "Kochi Mincho", NULL, "VL Gothic regular"}}, }; -static const FX_LPCSTR g_LinuxGbFontList[] = { +static const FX_CHAR* const g_LinuxGbFontList[] = { "AR PL UMing CN Light", "WenQuanYi Micro Hei", "AR PL UKai CN", }; -static const FX_LPCSTR g_LinuxB5FontList[] = { +static const FX_CHAR* const g_LinuxB5FontList[] = { "AR PL UMing TW Light", "WenQuanYi Micro Hei", "AR PL UKai TW", }; -static const FX_LPCSTR g_LinuxHGFontList[] = { +static const FX_CHAR* const g_LinuxHGFontList[] = { "UnDotum", }; -static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) +static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int picth_family) { CFX_ByteString face = facearr; if (face.Find("Gothic") >= 0 || face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { @@ -77,7 +77,7 @@ static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_fa } return 2; } -void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -90,7 +90,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p if (iBaseFont < 12) { return GetFont(face); } - FX_LPVOID p = NULL; + void* p = NULL; FX_BOOL bCJK = TRUE; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { @@ -105,7 +105,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_GB2312_CHARSET: { - static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); + static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_gbCount; i++) if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) { return p; @@ -113,7 +113,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_CHINESEBIG5_CHARSET: { - static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); + static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_b5Count; i++) if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) { return p; @@ -121,7 +121,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_HANGEUL_CHARSET: { - static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); + static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_hgCount; i++) if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) { return p; @@ -177,7 +177,7 @@ static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_fami } return iSimilarValue; } -void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL bMatchName) +void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName) { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); @@ -186,7 +186,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int while (pos) { CFX_ByteString bsName; CFontFaceInfo* pFont = NULL; - m_FontList.GetNextAssoc(pos, bsName, (FX_LPVOID&)pFont); + m_FontList.GetNextAssoc(pos, bsName, (void*&)pFont); if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) { continue; } diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index 51d5908a81..4ae7b42b39 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -65,8 +65,8 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma } new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); for (int row = m_Box.top; row < m_Box.bottom; row ++) { - FX_LPBYTE dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); - FX_LPBYTE src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); + uint8_t* dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); + uint8_t* src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); for (int col = m_Box.left; col < m_Box.right; col ++) { dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; } @@ -98,9 +98,9 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); const CFX_DIBitmap* old_dib = m_Mask; for (int row = new_box.top; row < new_box.bottom; row ++) { - FX_LPBYTE old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); - FX_LPBYTE mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); - FX_LPBYTE new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); + uint8_t* old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); + uint8_t* mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); + uint8_t* new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); for (int col = new_box.left; col < new_box.right; col ++) { new_scan[col - new_box.left] = old_scan[col - m_Box.left] * mask_scan[col - left] / 255; } diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 1829386755..c8e56ada85 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -131,7 +131,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM } } } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, @@ -163,7 +163,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm "); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } OutputPath(pPathData, NULL); CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, pGraphState->m_MiterLimit); @@ -204,7 +204,7 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm "); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } OutputPath(pPathData, stroke_alpha ? NULL : pObject2Device); @@ -261,10 +261,10 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) m_CurGraphState.Copy(*pGraphState); m_bGraphStateSet = TRUE; if (buf.GetSize()) { - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } -static void FaxCompressData(FX_LPBYTE src_buf, int width, int height, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +static void FaxCompressData(uint8_t* src_buf, int width, int height, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (width * height > 128 && pEncoders && pEncoders->GetFaxModule()->Encode(src_buf, width, height, (width + 7) / 8, dest_buf, dest_size)) { @@ -274,8 +274,8 @@ static void FaxCompressData(FX_LPBYTE src_buf, int width, int height, FX_LPBYTE& dest_size = (width + 7) / 8 * height; } } -static void PSCompressData(int PSLevel, FX_LPBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE& output_buf, FX_DWORD& output_size, FX_LPCSTR& filter) +static void PSCompressData(int PSLevel, uint8_t* src_buf, FX_DWORD src_size, + uint8_t*& output_buf, FX_DWORD& output_size, const FX_CHAR*& filter) { output_buf = src_buf; output_size = src_size; @@ -284,7 +284,7 @@ static void PSCompressData(int PSLevel, FX_LPBYTE src_buf, FX_DWORD src_size, return; } CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); - FX_LPBYTE dest_buf = NULL; + uint8_t* dest_buf = NULL; FX_DWORD dest_size = src_size; if (PSLevel >= 3) { if (pEncoders && pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size)) { @@ -348,12 +348,12 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) { int pitch = (width + 7) / 8; FX_DWORD src_size = height * pitch; - FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); + uint8_t* src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row ++) { - FX_LPCBYTE src_scan = pSource->GetScanline(row); + const uint8_t* src_scan = pSource->GetScanline(row); FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); } - FX_LPBYTE output_buf; + uint8_t* output_buf; FX_DWORD output_size; FaxCompressData(src_buf, width, height, output_buf, output_size); if (pSource->IsAlphaMask()) { @@ -373,7 +373,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } else { buf << FX_BSTRC("false 1 colorimage\n"); } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } else { @@ -409,9 +409,9 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, return FALSE; } int Bpp = pConverted->GetBPP() / 8; - FX_LPBYTE output_buf = NULL; + uint8_t* output_buf = NULL; FX_STRSIZE output_size = 0; - FX_LPCSTR filter = NULL; + const FX_CHAR* filter = NULL; if (flags & FXRENDER_IMAGE_LOSSY) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, output_buf, output_size)) { @@ -423,8 +423,8 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, output_size = height * src_pitch; output_buf = FX_Alloc(uint8_t, output_size); for (int row = 0; row < height; row ++) { - FX_LPCBYTE src_scan = pConverted->GetScanline(row); - FX_LPBYTE dest_scan = output_buf + row * src_pitch; + const uint8_t* src_scan = pConverted->GetScanline(row); + uint8_t* dest_scan = output_buf + row * src_pitch; if (Bpp == 3) { for (int col = 0; col < width; col ++) { *dest_scan++ = src_scan[2]; @@ -436,7 +436,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, FXSYS_memcpy32(dest_scan, src_scan, src_pitch); } } - FX_LPBYTE compressed_buf; + uint8_t* compressed_buf; FX_DWORD compressed_size; PSCompressData(m_PSLevel, output_buf, output_size, compressed_buf, compressed_size, filter); if (output_buf != compressed_buf) { @@ -457,7 +457,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } buf << FX_BSTRC("false ") << Bpp; buf << FX_BSTRC(" colorimage\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } @@ -473,7 +473,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - FX_LPBYTE pColor = (FX_LPBYTE)&color; + uint8_t* pColor = (uint8_t*)&color; pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1); color = m_bCmykOutput ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); bCMYK = m_bCmykOutput; @@ -493,7 +493,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor m_bColorSet = TRUE; m_LastColor = color; } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, const FXTEXT_CHARPOS& charpos, @@ -527,7 +527,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get exec}bind def\n" "currentdict end\n"); buf << FX_BSTRC("/X") << m_PSFontList.GetSize() - 1 << FX_BSTRC(" exch definefont pop\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); buf.Clear(); } ps_fontnum = m_PSFontList.GetSize() - 1; @@ -586,7 +586,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, buf << FX_BSTRC("}bind def end\n"); buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/Encoding get ") << ps_glyphindex << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, @@ -627,18 +627,18 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX buf << hex << FX_BSTRC("Tj\n"); } buf << FX_BSTRC("Q\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); return TRUE; } -void CFX_PSRenderer::WritePSBinary(FX_LPCBYTE data, int len) +void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { - FX_LPBYTE dest_buf; + uint8_t* dest_buf; FX_DWORD dest_size; CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf, dest_size)) { - m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); + m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); FX_Free(dest_buf); } else { - m_pOutput->OutputPS((FX_LPCSTR)data, len); + m_pOutput->OutputPS((const FX_CHAR*)data, len); } } diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index f3a720397b..1cdf5b2ef3 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -111,7 +111,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, bgra, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color, 1); bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) ? (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(color); @@ -298,7 +298,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar } } int dest_width = pixel_width; - FX_LPBYTE dest_buf = bitmap.GetBuffer(); + uint8_t* dest_buf = bitmap.GetBuffer(); int dest_pitch = bitmap.GetPitch(); int Bpp = bitmap.GetBPP() / 8; int a, r, g, b; @@ -330,7 +330,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar FX_BOOL bBGRStripe = text_flags & FXTEXT_BGR_STRIPE; ncols /= 3; int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; - FX_LPBYTE src_buf = pGlyph->GetBuffer(); + uint8_t* src_buf = pGlyph->GetBuffer(); int src_pitch = pGlyph->GetPitch(); int start_col = left; if (start_col < 0) { @@ -349,8 +349,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (dest_row < 0 || dest_row >= bitmap.GetHeight()) { continue; } - FX_LPBYTE src_scan = src_buf + row * src_pitch + (start_col - left) * 3; - FX_LPBYTE dest_scan = dest_buf + dest_row * dest_pitch + (start_col << 2); + uint8_t* src_scan = src_buf + row * src_pitch + (start_col - left) * 3; + uint8_t* dest_scan = dest_buf + dest_row * dest_pitch + (start_col << 2); if (bBGRStripe) { if (x_subpixel == 0) { for (int col = start_col; col < end_col; col ++) { @@ -662,8 +662,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (dest_row < 0 || dest_row >= bitmap.GetHeight()) { continue; } - FX_LPBYTE src_scan = src_buf + row * src_pitch + (start_col - left) * 3; - FX_LPBYTE dest_scan = dest_buf + dest_row * dest_pitch + start_col * Bpp; + uint8_t* src_scan = src_buf + row * src_pitch + (start_col - left) * 3; + uint8_t* dest_scan = dest_buf + dest_row * dest_pitch + start_col * Bpp; if (bBGRStripe) { if (x_subpixel == 0) { for (int col = start_col; col < end_col; col ++) { @@ -1045,10 +1045,10 @@ CFX_FaceCache::~CFX_FaceCache() } m_SizeMap.RemoveAll(); pos = m_PathMap.GetStartPosition(); - FX_LPVOID key1; + void* key1; CFX_PathData* pPath; while (pos) { - m_PathMap.GetNextAssoc(pos, key1, (FX_LPVOID&)pPath); + m_PathMap.GetNextAssoc(pos, key1, (void*&)pPath); delete pPath; } if (m_pBitmap) { @@ -1071,14 +1071,14 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap = NULL; - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_width, anti_alias); if (pGlyphBitmap == NULL) { return NULL; } - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, @@ -1125,12 +1125,12 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_GlyphBitmap* pGlyphBitmap; CFX_SizeGlyphCache* pSizeCache = NULL; if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); if (pGlyphBitmap) { - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } else { @@ -1138,7 +1138,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD if (pGlyphBitmap) { pSizeCache = new CFX_SizeGlyphCache; m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } @@ -1158,7 +1158,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { FX_POSITION pos = m_GlyphMap.GetStartPosition(); - FX_LPVOID Key; + void* Key; CFX_GlyphBitmap* pGlyphBitmap = NULL; while(pos) { m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); @@ -1232,20 +1232,20 @@ static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, }; -static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_LPCBYTE gammaTable) +static void _GammaAdjust(uint8_t* pData, int nWid, int nHei, int src_pitch, const uint8_t* gammaTable) { int count = nHei * src_pitch; for(int i = 0; i < count; i++) { pData[i] = gammaTable[pData[i]]; } } -static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int nHei, int nSrcRowBytes, int nDstRowBytes) +static void _ContrastAdjust(uint8_t* pDataIn, uint8_t* pDataOut, int nWid, int nHei, int nSrcRowBytes, int nDstRowBytes) { int col, row, temp; int max = 0, min = 255; FX_FLOAT rate; for (row = 0; row < nHei; row ++) { - FX_LPBYTE pRow = pDataIn + row * nSrcRowBytes; + uint8_t* pRow = pDataIn + row * nSrcRowBytes; for (col = 0; col < nWid; col++) { temp = *pRow ++; if (temp > max) { @@ -1266,8 +1266,8 @@ static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int } rate = 255.f / temp; for (row = 0; row < nHei; row ++) { - FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes; - FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes; + uint8_t* pSrcRow = pDataIn + row * nSrcRowBytes; + uint8_t* pDstRow = pDataOut + row * nDstRowBytes; for (col = 0; col < nWid; col ++) { temp = (int)((*(pSrcRow++) - min) * rate + 0.5); if (temp > 255) { @@ -1407,15 +1407,15 @@ FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(face)); int left = FXFT_Get_Glyph_BitmapLeft(face); int top = FXFT_Get_Glyph_BitmapTop(face); - FX_LPCBYTE src_buf = (FX_LPCBYTE)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); + const uint8_t* src_buf = (const uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(face)); CFX_DIBitmap mask; mask.Create(bmwidth, bmheight, FXDIB_8bppMask); - FX_LPBYTE dest_buf = mask.GetBuffer(); + uint8_t* dest_buf = mask.GetBuffer(); int dest_pitch = mask.GetPitch(); for (int row = 0; row < bmheight; row ++) { - FX_LPCBYTE src_scan = src_buf + row * src_pitch; - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = src_buf + row * src_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memcpy32(dest_scan, src_scan, dest_pitch); } pDib->CompositeMask(x + left, y - top, bmwidth, bmheight, &mask, argb, 0, 0); @@ -1483,15 +1483,15 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph return NULL; } CFX_PathData* pGlyphPath = NULL; - FX_LPVOID key; + void* key; if (pFont->GetSubstFont()) - key = (FX_LPVOID)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + + key = (void*)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + ((pFont->GetSubstFont()->m_ItalicAngle / 2) << 21) + ((dest_width / 16) << 25) + (pFont->IsVertical() << 31)); else { - key = (FX_LPVOID)(uintptr_t)glyph_index; + key = (void*)(uintptr_t)glyph_index; } - if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { + if (m_PathMap.Lookup(key, (void*&)pGlyphPath)) { return pGlyphPath; } pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width); |