From bb17868d736f698d5217c30d52c5bbfed62c5936 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 11:30:25 -0700 Subject: Use stdint.h types throughout PDFium. It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002 --- core/src/fxge/ge/fx_ge.cpp | 2 +- core/src/fxge/ge/fx_ge_device.cpp | 2 +- core/src/fxge/ge/fx_ge_font.cpp | 4 +-- core/src/fxge/ge/fx_ge_fontmap.cpp | 30 ++++++++++----------- core/src/fxge/ge/fx_ge_linux.cpp | 28 ++++++++++---------- core/src/fxge/ge/fx_ge_ps.cpp | 6 ++--- core/src/fxge/ge/fx_ge_text.cpp | 54 +++++++++++++++++++------------------- core/src/fxge/ge/text_int.h | 2 +- 8 files changed, 64 insertions(+), 64 deletions(-) (limited to 'core/src/fxge/ge') diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index 755aad565e..dffc98962f 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -61,7 +61,7 @@ void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) gammaValue /= 2.2f; int i = 0; while (i < 256) { - m_GammaValue[i] = (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); + m_GammaValue[i] = (uint8_t)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); i++; } } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 9c268b5606..0b4ffd5f4c 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -125,7 +125,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, FX_DWORD fill_color, FX_DWORD stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) { - FX_BYTE fill_alpha, stroke_alpha; + uint8_t fill_alpha, stroke_alpha; if (FXGETFLAG_COLORTYPE(alpha_flag)) { fill_alpha = FXGETFLAG_ALPHA_FILL(alpha_flag); stroke_alpha = FXGETFLAG_ALPHA_STROKE(alpha_flag); diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 1896218cbf..8928d25d4c 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -103,7 +103,7 @@ extern "C" { }; FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream) { - FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(FX_BYTE, sizeof (FXFT_StreamRec)); + FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof (FXFT_StreamRec)); stream1->base = NULL; stream1->size = (unsigned long)pFile->GetSize(); stream1->pos = 0; @@ -173,7 +173,7 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) { - m_pFontDataAllocation = FX_Alloc(FX_BYTE, 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; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index c1ea5906ff..9bb53c638f 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -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(FX_BYTE, size); + FX_LPBYTE buffer = FX_Alloc(uint8_t, size); m_pFontInfo->GetFontData(hFont, 0x6e616d65, buffer, size); result = _FPDF_GetNameFromTT(buffer, 6); FX_Free(buffer); @@ -644,7 +644,7 @@ CFX_ByteString CFX_FontMapper::MatchInstalledFonts(const CFX_ByteString& norm_na return match; } typedef struct _CHARSET_MAP_ { - FX_BYTE charset; + uint8_t charset; FX_WORD codepage; } CHARSET_MAP; static const CHARSET_MAP g_Codepage2CharsetTable[] = { @@ -680,11 +680,11 @@ static const CHARSET_MAP g_Codepage2CharsetTable[] = { { 88, 10029 }, { 89, 10007 }, }; -FX_BYTE _GetCharsetFromCodePage(FX_WORD codepage) +uint8_t _GetCharsetFromCodePage(FX_WORD codepage) { - FX_INT32 iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; + int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; FXSYS_assert(iEnd >= 0); - FX_INT32 iStart = 0, iMid; + int32_t iStart = 0, iMid; do { iMid = (iStart + iEnd) / 2; const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; @@ -824,7 +824,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) }; typedef struct _FX_FontStyle { FX_LPCSTR style; - FX_INT32 len; + int32_t len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { { "Bold", 4 }, @@ -848,9 +848,9 @@ CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) } return buf.GetByteString(); } -FX_INT32 GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) +int32_t GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) { - FX_INT32 iLen = bsStyle.GetLength(); + int32_t iLen = bsStyle.GetLength(); if (!iLen) { return -1; } @@ -968,7 +968,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (!bHasHypen) { int nLen = family.GetLength(); - FX_INT32 nRet = GetStyleType(family, TRUE); + int32_t nRet = GetStyleType(family, TRUE); if (nRet > -1) { family = family.Left(nLen - g_FontStyles[nRet].len); if (nRet == 0) { @@ -1000,7 +1000,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru CFX_ByteString buf; while (i < nLen) { buf = ParseStyle(pStyle, nLen, i); - FX_INT32 nRet = GetStyleType(buf, FALSE); + int32_t nRet = GetStyleType(buf, FALSE); if ((i && !bStyleAvail) || (!i && nRet < 0)) { family = SubstName; iBaseFont = 12; @@ -1198,7 +1198,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } FXFT_Face face = NULL; if (ttc_size) { - FX_BYTE temp[1024]; + uint8_t temp[1024]; m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024); FX_DWORD checksum = 0; for (int i = 0; i < 256; i ++) { @@ -1207,7 +1207,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru FX_LPBYTE pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData); if (face == NULL) { - pFontData = FX_Alloc(FX_BYTE, ttc_size); + pFontData = FX_Alloc(uint8_t, ttc_size); m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size); face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, ttc_size, ttc_size - font_size); @@ -1216,7 +1216,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru FX_LPBYTE pFontData; face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); if (face == NULL) { - pFontData = FX_Alloc(FX_BYTE, font_size); + pFontData = FX_Alloc(uint8_t, font_size); m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, font_size, m_pFontInfo->GetFaceIndex(hFont)); } @@ -1357,7 +1357,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) } FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); FX_DWORD filesize = FXSYS_ftell(pFile); - FX_BYTE buffer[16]; + uint8_t buffer[16]; FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); if (readCnt != 1) { @@ -1372,7 +1372,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } FX_DWORD face_bytes = nFaces * 4; - FX_LPBYTE offsets = FX_Alloc(FX_BYTE, face_bytes); + FX_LPBYTE offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { FX_Free(offsets); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index b9cfc8ef54..e2ed84e081 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -56,7 +56,7 @@ static const FX_LPCSTR g_LinuxB5FontList[] = { static const FX_LPCSTR g_LinuxHGFontList[] = { "UnDotum", }; -static FX_INT32 GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) +static int32_t GetJapanesePreference(FX_LPCSTR 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) { @@ -94,35 +94,35 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p FX_BOOL bCJK = TRUE; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { - FX_INT32 index = GetJapanesePreference(cstr_face, weight, pitch_family); + int32_t index = GetJapanesePreference(cstr_face, weight, pitch_family); if (index < 0) { break; } - for (FX_INT32 i = 0; i < LINUX_GPNAMESIZE; i++) + for (int32_t i = 0; i < LINUX_GPNAMESIZE; i++) if (m_FontList.Lookup(LinuxGpFontList[index].NameArr[i], p)) { return p; } } break; case FXFONT_GB2312_CHARSET: { - static FX_INT32 s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_gbCount; i++) + static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_gbCount; i++) if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) { return p; } } break; case FXFONT_CHINESEBIG5_CHARSET: { - static FX_INT32 s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_b5Count; i++) + static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_b5Count; i++) if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) { return p; } } break; case FXFONT_HANGEUL_CHARSET: { - static FX_INT32 s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_hgCount; i++) + static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_hgCount; i++) if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) { return p; } @@ -157,9 +157,9 @@ static FX_DWORD _LinuxGetCharset(int charset) } return 0; } -static FX_INT32 _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) +static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) { - FX_INT32 iSimilarValue = 0; + int32_t iSimilarValue = 0; if ((style & FXFONT_BOLD) == (weight > 400)) { iSimilarValue += 16; } @@ -181,7 +181,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); - FX_INT32 iBestSimilar = 0; + int32_t iBestSimilar = 0; FX_POSITION pos = m_FontList.GetStartPosition(); while (pos) { CFX_ByteString bsName; @@ -190,8 +190,8 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) { continue; } - FX_INT32 iSimilarValue = 0; - FX_INT32 index = bsName.Find(family); + int32_t iSimilarValue = 0; + int32_t index = bsName.Find(family); if (bMatchName && index < 0) { continue; } diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index e81b6bf362..1829386755 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -93,7 +93,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM CFX_ByteTextBuf buf; buf.EstimateSize(nPoints * 10); for (int i = 0; i < nPoints; i ++) { - FX_BYTE flag = pPathData->GetFlag(i); + uint8_t flag = pPathData->GetFlag(i); FX_FLOAT x = pPathData->GetPointX(i); FX_FLOAT y = pPathData->GetPointY(i); if (pObject2Device) { @@ -348,7 +348,7 @@ 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(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row ++) { FX_LPCBYTE src_scan = pSource->GetScanline(row); FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); @@ -421,7 +421,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, if (filter == NULL) { int src_pitch = width * Bpp; output_size = height * src_pitch; - output_buf = FX_Alloc(FX_BYTE, output_size); + 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; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index f6d2fa510f..0d9e985a8e 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -78,7 +78,7 @@ static void _AdjustGlyphSpace(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars) next_origin_f = this_origin_f; } } -static const FX_BYTE g_TextGammaAdjust[256] = { +static const uint8_t g_TextGammaAdjust[256] = { 0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, @@ -97,7 +97,7 @@ static const FX_BYTE g_TextGammaAdjust[256] = { 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 255, }; #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ - src_alpha = g_TextGammaAdjust[(FX_BYTE)src_alpha]; + src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) { @@ -107,7 +107,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; } - FX_BYTE bgra[4]; + uint8_t bgra[4]; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); @@ -445,7 +445,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[0] + src_scan[1] + src_scan[2]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -457,7 +457,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -492,11 +492,11 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar dest_scan += 4; src_scan += 3; } else { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); } else { - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -530,7 +530,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[-1] + src_scan[0] + src_scan[1]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -542,7 +542,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -577,11 +577,11 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar dest_scan += 4; src_scan += 3; } else { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); } else { - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -615,7 +615,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[-2] + src_scan[-1] + src_scan[0]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -627,7 +627,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -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)(FX_UINTPTR)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(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)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(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)(FX_UINTPTR)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(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)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(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)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } @@ -1209,7 +1209,7 @@ static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = { 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, }; static const size_t WEIGHTPOW_ARRAY_SIZE = 100; -static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, @@ -1217,7 +1217,7 @@ static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, }; -static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, @@ -1225,7 +1225,7 @@ static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, }; -static const FX_BYTE g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, @@ -1275,7 +1275,7 @@ static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int } else if (temp < 0) { temp = 0; } - *pDstRow ++ = (FX_BYTE)temp; + *pDstRow ++ = (uint8_t)temp; } } } @@ -1365,13 +1365,13 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); - FX_BYTE* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); - FX_BYTE* pSrcBuf = (FX_BYTE*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); + uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); + uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1; for(int i = 0; i < bmheight; i++) for(int n = 0; n < bmwidth; n++) { - FX_BYTE data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8))) ? 255 : 0; + uint8_t data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8))) ? 255 : 0; for (int b = 0; b < bytes; b ++) { pDestBuf[i * dest_pitch + n * bytes + b] = data; } @@ -1485,11 +1485,11 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph CFX_PathData* pGlyphPath = NULL; FX_LPVOID key; if (pFont->GetSubstFont()) - key = (FX_LPVOID)(FX_UINTPTR)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + + key = (FX_LPVOID)(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)(FX_UINTPTR)glyph_index; + key = (FX_LPVOID)(uintptr_t)glyph_index; } if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { return pGlyphPath; diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h index 34496e8b13..32e1cd53f7 100644 --- a/core/src/fxge/ge/text_int.h +++ b/core/src/fxge/ge/text_int.h @@ -44,7 +44,7 @@ public: FXFT_Face m_pFaces[16]; } m_TTCFace; }; - FX_BYTE* m_pFontData; + uint8_t* m_pFontData; int m_RefCount; }; class CFX_UnicodeEncoding : public IFX_FontEncoding -- cgit v1.2.3