diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-07-12 14:07:37 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-07-17 10:29:26 +0000 |
commit | ec02ee4181c49b61fce1c8fb99292dbb8139cc90 (patch) | |
tree | 25cde714b2b71eb639d1cd53f5a22e9ba76e14ef /chromium/third_party/pdfium/core/fxge/ge | |
parent | bb09965444b5bb20b096a291445170876225268d (diff) | |
download | qtwebengine-chromium-ec02ee4181c49b61fce1c8fb99292dbb8139cc90.tar.gz |
BASELINE: Update Chromium to 59.0.3071.134
Change-Id: Id02ef6fb2204c5fd21668a1c3e6911c83b17585a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/pdfium/core/fxge/ge')
18 files changed, 313 insertions, 287 deletions
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp index ea3eb51f182..d2f065dba76 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp @@ -6,6 +6,10 @@ #include "core/fxge/ge/cfx_cliprgn.h" +#include <utility> + +#include "core/fxge/dib/cfx_dibitmap.h" + CFX_ClipRgn::CFX_ClipRgn(int width, int height) : m_Type(RectI), m_Box(0, 0, width, height) {} @@ -20,7 +24,7 @@ CFX_ClipRgn::~CFX_ClipRgn() {} void CFX_ClipRgn::Reset(const FX_RECT& rect) { m_Type = RectI; m_Box = rect; - m_Mask.SetNull(); + m_Mask = nullptr; } void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { @@ -36,8 +40,7 @@ void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, - CFX_DIBitmapRef Mask) { - const CFX_DIBitmap* mask_dib = Mask.GetObject(); + const CFX_RetainPtr<CFX_DIBitmap>& pMask) { m_Type = MaskF; m_Box = rect; m_Box.Intersect(mask_rect); @@ -46,28 +49,30 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, return; } if (m_Box == mask_rect) { - m_Mask = Mask; + m_Mask = pMask; return; } - CFX_DIBitmap* new_dib = m_Mask.Emplace(); - new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); + CFX_RetainPtr<CFX_DIBitmap> pOldMask(pMask); + m_Mask = pdfium::MakeRetain<CFX_DIBitmap>(); + m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); for (int row = m_Box.top; row < m_Box.bottom; row++) { uint8_t* dest_scan = - new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); + m_Mask->GetBuffer() + m_Mask->GetPitch() * (row - m_Box.top); uint8_t* src_scan = - mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); + pOldMask->GetBuffer() + pOldMask->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]; } } -void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { - const CFX_DIBitmap* mask_dib = Mask.GetObject(); - ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask); - FX_RECT mask_box(left, top, left + mask_dib->GetWidth(), - top + mask_dib->GetHeight()); +void CFX_ClipRgn::IntersectMaskF(int left, + int top, + const CFX_RetainPtr<CFX_DIBitmap>& pMask) { + ASSERT(pMask->GetFormat() == FXDIB_8bppMask); + FX_RECT mask_box(left, top, left + pMask->GetWidth(), + top + pMask->GetHeight()); if (m_Type == RectI) { - IntersectMaskRect(m_Box, mask_box, Mask); + IntersectMaskRect(m_Box, mask_box, pMask); return; } if (m_Type == MaskF) { @@ -75,19 +80,16 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { new_box.Intersect(mask_box); if (new_box.IsEmpty()) { m_Type = RectI; - m_Mask.SetNull(); + m_Mask = nullptr; m_Box = new_box; return; } - CFX_DIBitmapRef new_mask; - CFX_DIBitmap* new_dib = new_mask.Emplace(); + auto new_dib = pdfium::MakeRetain<CFX_DIBitmap>(); new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); - const CFX_DIBitmap* old_dib = m_Mask.GetObject(); for (int row = new_box.top; row < new_box.bottom; row++) { 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(); + m_Mask->GetBuffer() + (row - m_Box.top) * m_Mask->GetPitch(); + uint8_t* mask_scan = pMask->GetBuffer() + (row - top) * pMask->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++) { @@ -96,7 +98,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { } } m_Box = new_box; - m_Mask = new_mask; + m_Mask = std::move(new_dib); return; } ASSERT(false); diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h index f3fd5856b6e..800e6ddbeef 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h @@ -7,7 +7,9 @@ #ifndef CORE_FXGE_GE_CFX_CLIPRGN_H_ #define CORE_FXGE_GE_CFX_CLIPRGN_H_ -#include "core/fxge/fx_dib.h" +#include "core/fxcrt/fx_coordinates.h" + +class CFX_DIBitmap; class CFX_ClipRgn { public: @@ -19,18 +21,22 @@ class CFX_ClipRgn { ClipType GetType() const { return m_Type; } const FX_RECT& GetBox() const { return m_Box; } - CFX_DIBitmapRef GetMask() const { return m_Mask; } + CFX_RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; } void Reset(const FX_RECT& rect); void IntersectRect(const FX_RECT& rect); - void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask); + void IntersectMaskF(int left, + int top, + const CFX_RetainPtr<CFX_DIBitmap>& Mask); private: - void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); + void IntersectMaskRect(FX_RECT rect, + FX_RECT mask_box, + const CFX_RetainPtr<CFX_DIBitmap>& Mask); ClipType m_Type; FX_RECT m_Box; - CFX_DIBitmapRef m_Mask; + CFX_RetainPtr<CFX_DIBitmap> m_Mask; }; #endif // CORE_FXGE_GE_CFX_CLIPRGN_H_ diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp index 314c95b8b20..2a8e71acf53 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp @@ -21,6 +21,11 @@ #if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" + +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#include "third_party/skia/include/ports/SkFontMgr.h" +#include "third_party/skia/include/ports/SkFontMgr_empty.h" +#endif #endif namespace { @@ -44,7 +49,7 @@ void ContrastAdjust(uint8_t* pDataIn, int nDstRowBytes) { int col, row, temp; int max = 0, min = 255; - FX_FLOAT rate; + float rate; for (row = 0; row < nHeight; row++) { uint8_t* pRow = pDataIn + row * nSrcRowBytes; for (col = 0; col < nWidth; col++) { @@ -55,10 +60,10 @@ void ContrastAdjust(uint8_t* pDataIn, } temp = max - min; if (temp == 0 || temp == 255) { - int rowbytes = std::min(FXSYS_abs(nSrcRowBytes), nDstRowBytes); + int rowbytes = std::min(abs(nSrcRowBytes), nDstRowBytes); for (row = 0; row < nHeight; row++) { - FXSYS_memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes, - rowbytes); + memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes, + rowbytes); } return; } @@ -165,8 +170,9 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, else level = CFX_Font::s_WeightPow_11[index]; - level = level * (FXSYS_abs(static_cast<int>(ft_matrix.xx)) + - FXSYS_abs(static_cast<int>(ft_matrix.xy))) / + level = level * + (abs(static_cast<int>(ft_matrix.xx)) + + abs(static_cast<int>(ft_matrix.xy))) / 36655; FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level.ValueOrDefault(0)); @@ -182,14 +188,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, return nullptr; int dib_width = bmwidth; CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; - pGlyphBitmap->m_Bitmap.Create( + pGlyphBitmap->m_pBitmap->Create( dib_width, bmheight, anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask); pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); - int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); + int dest_pitch = pGlyphBitmap->m_pBitmap->GetPitch(); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); - uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); + uint8_t* pDestBuf = pGlyphBitmap->m_pBitmap->GetBuffer(); uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); if (anti_alias != FXFT_RENDER_MODE_MONO && @@ -205,15 +211,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, } } } else { - FXSYS_memset(pDestBuf, 0, dest_pitch * bmheight); + memset(pDestBuf, 0, dest_pitch * bmheight); if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { - int rowbytes = - FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSYS_abs(src_pitch); + int rowbytes = abs(src_pitch) > dest_pitch ? dest_pitch : abs(src_pitch); for (int row = 0; row < bmheight; row++) { - FXSYS_memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, - rowbytes); + memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, + rowbytes); } } else { ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch, @@ -359,6 +364,13 @@ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) { new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())) .release(); } +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ + if (!m_pTypeface) { + sk_sp<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty()); + m_pTypeface = customMgr->createFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); + } +#endif return m_pTypeface; } #endif diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp index 776a37319b3..ff8cc4c29f0 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp @@ -16,8 +16,8 @@ namespace { const struct { - const FX_CHAR* m_pName; - const FX_CHAR* m_pSubstName; + const char* m_pName; + const char* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, {"Courier-Bold", "Courier New Bold"}, @@ -33,15 +33,15 @@ const struct { {"Times-Italic", "Times New Roman Italic"}, }; -CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, uint32_t size) { +CFX_ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) { CFX_ByteString buffer; - if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile)) + if (!fread(buffer.GetBuffer(size), size, 1, pFile)) return CFX_ByteString(); buffer.ReleaseBuffer(size); return buffer; } -CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile, +CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile, const uint8_t* pTables, uint32_t nTables, uint32_t tag) { @@ -50,7 +50,7 @@ CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile, if (GET_TT_LONG(p) == tag) { uint32_t offset = GET_TT_LONG(p + 8); uint32_t size = GET_TT_LONG(p + 12); - FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); + fseek(pFile, offset, SEEK_SET); return FPDF_ReadStringFromFile(pFile, size); } } @@ -149,34 +149,34 @@ void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) { } void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { - FXSYS_FILE* pFile = FXSYS_fopen(path.c_str(), "rb"); + FILE* pFile = fopen(path.c_str(), "rb"); if (!pFile) return; - FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); + fseek(pFile, 0, SEEK_END); - uint32_t filesize = FXSYS_ftell(pFile); + uint32_t filesize = ftell(pFile); uint8_t buffer[16]; - FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); + fseek(pFile, 0, SEEK_SET); - size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); + size_t readCnt = fread(buffer, 12, 1, pFile); if (readCnt != 1) { - FXSYS_fclose(pFile); + fclose(pFile); return; } if (GET_TT_LONG(buffer) == kTableTTCF) { uint32_t nFaces = GET_TT_LONG(buffer + 8); if (nFaces > std::numeric_limits<uint32_t>::max() / 4) { - FXSYS_fclose(pFile); + fclose(pFile); return; } uint32_t face_bytes = nFaces * 4; uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); - readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile); + readCnt = fread(offsets, 1, face_bytes, pFile); if (readCnt != face_bytes) { FX_Free(offsets); - FXSYS_fclose(pFile); + fclose(pFile); return; } for (uint32_t i = 0; i < nFaces; i++) { @@ -187,16 +187,16 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { } else { ReportFace(path, pFile, filesize, 0); } - FXSYS_fclose(pFile); + fclose(pFile); } void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path, - FXSYS_FILE* pFile, + FILE* pFile, uint32_t filesize, uint32_t offset) { - FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); + fseek(pFile, offset, SEEK_SET); char buffer[16]; - if (!FXSYS_fread(buffer, 12, 1, pFile)) + if (!fread(buffer, 12, 1, pFile)) return; uint32_t nTables = GET_TT_SHORT(buffer + 4); @@ -275,7 +275,7 @@ void* CFX_FolderFontInfo::FindFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, bool bMatchName) { CFX_FontFaceInfo* pFind = nullptr; if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) @@ -306,7 +306,7 @@ void* CFX_FolderFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) { return nullptr; } @@ -320,7 +320,7 @@ void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode, } #endif // PDF_ENABLE_XFA -void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { +void* CFX_FolderFontInfo::GetFont(const char* face) { auto it = m_FontList.find(face); return it != m_FontList.end() ? it->second : nullptr; } @@ -353,27 +353,27 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont, if (!datasize || size < datasize) return datasize; - FXSYS_FILE* pFile = FXSYS_fopen(pFont->m_FilePath.c_str(), "rb"); + FILE* pFile = fopen(pFont->m_FilePath.c_str(), "rb"); if (!pFile) return 0; - if (FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET) < 0 || - FXSYS_fread(buffer, datasize, 1, pFile) != 1) { + if (fseek(pFile, offset, SEEK_SET) < 0 || + fread(buffer, datasize, 1, pFile) != 1) { datasize = 0; } - FXSYS_fclose(pFile); + fclose(pFile); return datasize; } void CFX_FolderFontInfo::DeleteFont(void* hFont) {} -bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { + +bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) { if (!hFont) return false; - CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; - name = pFont->m_FaceName; + *name = static_cast<CFX_FontFaceInfo*>(hFont)->m_FaceName; return true; } -bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { +bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int* charset) { return false; } diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h index d031eef3d06..ab2468ade0b 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h @@ -27,7 +27,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* face, + const char* face, int& bExact) override; #ifdef PDF_ENABLE_XFA void* MapFontByUnicode(uint32_t dwUnicode, @@ -35,20 +35,20 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool bItalic, int pitch_family) override; #endif // PDF_ENABLE_XFA - void* GetFont(const FX_CHAR* face) override; + void* GetFont(const char* face) override; uint32_t GetFontData(void* hFont, uint32_t table, uint8_t* buffer, uint32_t size) override; void DeleteFont(void* hFont) override; - bool GetFaceName(void* hFont, CFX_ByteString& name) override; - bool GetFontCharset(void* hFont, int& charset) override; + bool GetFaceName(void* hFont, CFX_ByteString* name) override; + bool GetFontCharset(void* hFont, int* charset) override; protected: void ScanPath(const CFX_ByteString& path); void ScanFile(const CFX_ByteString& path); void ReportFace(const CFX_ByteString& path, - FXSYS_FILE* pFile, + FILE* pFile, uint32_t filesize, uint32_t offset); void* GetSubstFont(const CFX_ByteString& face); @@ -56,7 +56,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, bool bMatchName); std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp index 87157b01011..068f0b032ca 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp @@ -31,7 +31,7 @@ typedef struct { CFX_PathData* m_pPath; int m_CurX; int m_CurY; - FX_FLOAT m_CoordUnit; + float m_CoordUnit; } OUTLINE_PARAMS; #ifdef PDF_ENABLE_XFA diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp index 58cee06d42c..1599c30b933 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp @@ -12,6 +12,7 @@ #include "core/fxge/cfx_facecache.h" #include "core/fxge/fx_font.h" #include "core/fxge/fx_freetype.h" +#include "third_party/base/ptr_util.h" CFX_FontCache::CountedFaceCache::CountedFaceCache() {} @@ -35,7 +36,7 @@ CFX_FaceCache* CFX_FontCache::GetCachedFace(const CFX_Font* pFont) { return counted_face_cache->m_Obj.get(); } - std::unique_ptr<CountedFaceCache> counted_face_cache(new CountedFaceCache); + auto counted_face_cache = pdfium::MakeUnique<CountedFaceCache>(); counted_face_cache->m_nCount = 2; CFX_FaceCache* face_cache = new CFX_FaceCache(bExternal ? nullptr : face); counted_face_cache->m_Obj.reset(face_cache); diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp index 064fc9610aa..0cff3445991 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp @@ -25,7 +25,7 @@ namespace { const int kNumStandardFonts = 14; -const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = { +const char* const g_Base14FontNames[kNumStandardFonts] = { "Courier", "Courier-Bold", "Courier-BoldOblique", @@ -43,7 +43,7 @@ const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = { }; const struct AltFontName { - const FX_CHAR* m_pName; + const char* m_pName; int m_Index; } g_AltFontNames[] = { {"Arial", 4}, @@ -138,8 +138,8 @@ const struct AltFontName { }; const struct AltFontFamily { - const FX_CHAR* m_pFontName; - const FX_CHAR* m_pFontFamily; + const char* m_pFontName; + const char* m_pFontFamily; } g_AltFontFamilies[] = { {"AGaramondPro", "Adobe Garamond Pro"}, {"BankGothicBT-Medium", "BankGothic Md BT"}, @@ -147,7 +147,7 @@ const struct AltFontFamily { }; const struct FX_FontStyle { - const FX_CHAR* style; + const char* style; int32_t len; } g_FontStyles[] = { {"Bold", 4}, {"Italic", 6}, {"BoldItalic", 10}, {"Reg", 3}, {"Regular", 7}, @@ -167,20 +167,19 @@ const struct CODEPAGE_MAP { }; int CompareFontFamilyString(const void* key, const void* element) { - CFX_ByteString str_key((const FX_CHAR*)key); + CFX_ByteString str_key((const char*)key); const AltFontFamily* family = reinterpret_cast<const AltFontFamily*>(element); if (str_key.Find(family->m_pFontName) != -1) return 0; - return FXSYS_stricmp(reinterpret_cast<const FX_CHAR*>(key), - family->m_pFontName); + return FXSYS_stricmp(reinterpret_cast<const char*>(key), family->m_pFontName); } int CompareString(const void* key, const void* element) { - return FXSYS_stricmp(reinterpret_cast<const FX_CHAR*>(key), + return FXSYS_stricmp(reinterpret_cast<const char*>(key), reinterpret_cast<const AltFontName*>(element)->m_pName); } -CFX_ByteString TT_NormalizeName(const FX_CHAR* family) { +CFX_ByteString TT_NormalizeName(const char* family) { CFX_ByteString norm(family); norm.Remove(' '); norm.Remove('-'); @@ -217,13 +216,13 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) { fontName = "FreeStyleScript"; return fontName; } - AltFontFamily* found = reinterpret_cast<AltFontFamily*>(FXSYS_bsearch( + AltFontFamily* found = reinterpret_cast<AltFontFamily*>(bsearch( fontName.c_str(), g_AltFontFamilies, FX_ArraySize(g_AltFontFamilies), sizeof(AltFontFamily), CompareFontFamilyString)); return found ? CFX_ByteString(found->m_pFontFamily) : fontName; } -CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { +CFX_ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) { CFX_ByteTextBuf buf; if (!iLen || iLen <= iIndex) return buf.MakeString(); @@ -281,7 +280,7 @@ CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr) : m_bListLoaded(false), m_pFontMgr(mgr) { m_MMFaces[0] = nullptr; m_MMFaces[1] = nullptr; - FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces)); + memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces)); } CFX_FontMapper::~CFX_FontMapper() { @@ -505,7 +504,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, } if (!style.IsEmpty()) { int nLen = style.GetLength(); - const FX_CHAR* pStyle = style.c_str(); + const char* pStyle = style.c_str(); int i = 0; bool bFirstItem = true; CFX_ByteString buf; @@ -678,9 +677,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, if (!hFont) return nullptr; - m_pFontInfo->GetFaceName(hFont, SubstName); + m_pFontInfo->GetFaceName(hFont, &SubstName); if (Charset == FXFONT_DEFAULT_CHARSET) - m_pFontInfo->GetFontCharset(hFont, Charset); + m_pFontInfo->GetFontCharset(hFont, &Charset); uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0); uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0); if (font_size == 0 && ttc_size == 0) { @@ -708,7 +707,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, if (bItalic && !FXFT_Is_Face_Italic(face)) { if (italic_angle == 0) italic_angle = -12; - else if (FXSYS_abs(italic_angle) < 5) + else if (abs(italic_angle) < 5) italic_angle = 0; pSubstFont->m_ItalicAngle = italic_angle; } @@ -743,7 +742,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode, face = GetCachedTTCFace(hFont, 0x74746366, ttc_size, font_size); } else { CFX_ByteString SubstName; - m_pFontInfo->GetFaceName(hFont, SubstName); + m_pFontInfo->GetFaceName(hFont, &SubstName); face = GetCachedFace(hFont, SubstName, weight, bItalic, font_size); } m_pFontInfo->DeleteFont(hFont); @@ -810,8 +809,8 @@ FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont, int PDF_GetStandardFontName(CFX_ByteString* name) { AltFontName* found = static_cast<AltFontName*>( - FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), - sizeof(AltFontName), CompareString)); + bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), + sizeof(AltFontName), CompareString)); if (!found) return -1; diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp index 64f647e3f60..97d143804ba 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp @@ -215,7 +215,7 @@ FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face; } -FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) { +FXFT_Face CFX_FontMgr::GetFileFace(const char* filename, int face_index) { InitFTLibrary(); FXFT_Library library = m_FTLibrary; FXFT_Face face = nullptr; diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp index ed6d6cb32e6..790b670e4f5 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp @@ -59,11 +59,11 @@ CFX_FontCache* CFX_GEModule::GetFontCache() { return m_pFontCache; } -void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) { +void CFX_GEModule::SetTextGamma(float gammaValue) { gammaValue /= 2.2f; for (int i = 0; i < 256; ++i) { m_GammaValue[i] = static_cast<uint8_t>( - FXSYS_pow(static_cast<FX_FLOAT>(i) / 255, gammaValue) * 255.0f + 0.5f); + FXSYS_pow(static_cast<float>(i) / 255, gammaValue) * 255.0f + 0.5f); } } diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp index 6357aa51a41..54443b96365 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp @@ -19,9 +19,7 @@ void CFX_GraphState::Emplace() { m_Ref.Emplace(); } -void CFX_GraphState::SetLineDash(CPDF_Array* pArray, - FX_FLOAT phase, - FX_FLOAT scale) { +void CFX_GraphState::SetLineDash(CPDF_Array* pArray, float phase, float scale) { CFX_GraphStateData* pData = m_Ref.GetPrivateCopy(); pData->m_DashPhase = phase * scale; pData->SetDashCount(static_cast<int>(pArray->GetCount())); @@ -29,11 +27,11 @@ void CFX_GraphState::SetLineDash(CPDF_Array* pArray, pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; } -FX_FLOAT CFX_GraphState::GetLineWidth() const { +float CFX_GraphState::GetLineWidth() const { return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineWidth : 1.f; } -void CFX_GraphState::SetLineWidth(FX_FLOAT width) { +void CFX_GraphState::SetLineWidth(float width) { m_Ref.GetPrivateCopy()->m_LineWidth = width; } @@ -52,10 +50,10 @@ void CFX_GraphState::SetLineJoin(CFX_GraphStateData::LineJoin join) { m_Ref.GetPrivateCopy()->m_LineJoin = join; } -FX_FLOAT CFX_GraphState::GetMiterLimit() const { +float CFX_GraphState::GetMiterLimit() const { return m_Ref.GetObject() ? m_Ref.GetObject()->m_MiterLimit : 10.f; } -void CFX_GraphState::SetMiterLimit(FX_FLOAT limit) { +void CFX_GraphState::SetMiterLimit(float limit) { m_Ref.GetPrivateCopy()->m_MiterLimit = limit; } diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp index 03798a63200..82fede176a5 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp @@ -33,8 +33,8 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { m_MiterLimit = src.m_MiterLimit; m_LineWidth = src.m_LineWidth; if (m_DashCount) { - m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount); - FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT)); + m_DashArray = FX_Alloc(float, m_DashCount); + memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float)); } } @@ -48,5 +48,5 @@ void CFX_GraphStateData::SetDashCount(int count) { m_DashCount = count; if (count == 0) return; - m_DashArray = FX_Alloc(FX_FLOAT, count); + m_DashArray = FX_Alloc(float, count); } diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp index 9fa2cd2aacf..75e4faf0ef2 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp @@ -14,7 +14,7 @@ namespace { void UpdateLineEndPoints(CFX_FloatRect* rect, const CFX_PointF& start_pos, const CFX_PointF& end_pos, - FX_FLOAT hw) { + float hw) { if (start_pos.x == end_pos.x) { if (start_pos.y == end_pos.y) { rect->UpdateRect(end_pos.x + hw, end_pos.y + hw); @@ -22,7 +22,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, return; } - FX_FLOAT point_y; + float point_y; if (end_pos.y < start_pos.y) point_y = end_pos.y - hw; else @@ -34,7 +34,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, } if (start_pos.y == end_pos.y) { - FX_FLOAT point_x; + float point_x; if (end_pos.x < start_pos.x) point_x = end_pos.x - hw; else @@ -46,11 +46,11 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, } CFX_PointF diff = end_pos - start_pos; - FX_FLOAT ll = FXSYS_sqrt2(diff.x, diff.y); - FX_FLOAT mx = end_pos.x + hw * diff.x / ll; - FX_FLOAT my = end_pos.y + hw * diff.y / ll; - FX_FLOAT dx1 = hw * diff.y / ll; - FX_FLOAT dy1 = hw * diff.x / ll; + float ll = FXSYS_sqrt2(diff.x, diff.y); + float mx = end_pos.x + hw * diff.x / ll; + float my = end_pos.y + hw * diff.y / ll; + float dx1 = hw * diff.y / ll; + float dy1 = hw * diff.x / ll; rect->UpdateRect(mx - dx1, my + dy1); rect->UpdateRect(mx + dx1, my - dy1); } @@ -59,23 +59,23 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, const CFX_PointF& start_pos, const CFX_PointF& mid_pos, const CFX_PointF& end_pos, - FX_FLOAT half_width, - FX_FLOAT miter_limit) { - FX_FLOAT start_k = 0; - FX_FLOAT start_c = 0; - FX_FLOAT end_k = 0; - FX_FLOAT end_c = 0; - FX_FLOAT start_len = 0; - FX_FLOAT start_dc = 0; - FX_FLOAT end_len = 0; - FX_FLOAT end_dc = 0; - FX_FLOAT one_twentieth = 1.0f / 20; - - bool bStartVert = FXSYS_fabs(start_pos.x - mid_pos.x) < one_twentieth; - bool bEndVert = FXSYS_fabs(mid_pos.x - end_pos.x) < one_twentieth; + float half_width, + float miter_limit) { + float start_k = 0; + float start_c = 0; + float end_k = 0; + float end_c = 0; + float start_len = 0; + float start_dc = 0; + float end_len = 0; + float end_dc = 0; + float one_twentieth = 1.0f / 20; + + bool bStartVert = fabs(start_pos.x - mid_pos.x) < one_twentieth; + bool bEndVert = fabs(mid_pos.x - end_pos.x) < one_twentieth; if (bStartVert && bEndVert) { int start_dir = mid_pos.y > start_pos.y ? 1 : -1; - FX_FLOAT point_y = mid_pos.y + half_width * start_dir; + float point_y = mid_pos.y + half_width * start_dir; rect->UpdateRect(mid_pos.x + half_width, point_y); rect->UpdateRect(mid_pos.x - half_width, point_y); return; @@ -86,16 +86,15 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, start_k = (mid_pos.y - start_pos.y) / (mid_pos.x - start_pos.x); start_c = mid_pos.y - (start_k * mid_pos.x); start_len = FXSYS_sqrt2(start_to_mid.x, start_to_mid.y); - start_dc = static_cast<FX_FLOAT>( - FXSYS_fabs(half_width * start_len / start_to_mid.x)); + start_dc = + static_cast<float>(fabs(half_width * start_len / start_to_mid.x)); } if (!bEndVert) { CFX_PointF end_to_mid = end_pos - mid_pos; end_k = end_to_mid.y / end_to_mid.x; end_c = mid_pos.y - (end_k * mid_pos.x); end_len = FXSYS_sqrt2(end_to_mid.x, end_to_mid.y); - end_dc = - static_cast<FX_FLOAT>(FXSYS_fabs(half_width * end_len / end_to_mid.x)); + end_dc = static_cast<float>(fabs(half_width * end_len / end_to_mid.x)); } if (bStartVert) { CFX_PointF outside(start_pos.x, 0); @@ -129,7 +128,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, return; } - if (FXSYS_fabs(start_k - end_k) < one_twentieth) { + if (fabs(start_k - end_k) < one_twentieth) { int start_dir = mid_pos.x > start_pos.x ? 1 : -1; int end_dir = end_pos.x > mid_pos.x ? 1 : -1; if (start_dir == end_dir) @@ -139,20 +138,20 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, return; } - FX_FLOAT start_outside_c = start_c; + float start_outside_c = start_c; if (end_pos.y < (start_k * end_pos.x) + start_c) start_outside_c += start_dc; else start_outside_c -= start_dc; - FX_FLOAT end_outside_c = end_c; + float end_outside_c = end_c; if (start_pos.y < (end_k * start_pos.x) + end_c) end_outside_c += end_dc; else end_outside_c -= end_dc; - FX_FLOAT join_x = (end_outside_c - start_outside_c) / (start_k - end_k); - FX_FLOAT join_y = start_k * join_x + start_outside_c; + float join_x = (end_outside_c - start_outside_c) / (start_k - end_k); + float join_y = start_k * join_x + start_outside_c; rect->UpdateRect(join_x, join_y); } @@ -203,10 +202,10 @@ void CFX_PathData::AppendPoint(const CFX_PointF& point, m_Points.push_back(FX_PATHPOINT(point, type, closeFigure)); } -void CFX_PathData::AppendRect(FX_FLOAT left, - FX_FLOAT bottom, - FX_FLOAT right, - FX_FLOAT top) { +void CFX_PathData::AppendRect(float left, + float bottom, + float right, + float top) { m_Points.push_back( FX_PATHPOINT(CFX_PointF(left, bottom), FXPT_TYPE::MoveTo, false)); m_Points.push_back( @@ -230,11 +229,11 @@ CFX_FloatRect CFX_PathData::GetBoundingBox() const { return rect; } -CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, - FX_FLOAT miter_limit) const { +CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width, + float miter_limit) const { CFX_FloatRect rect(100000.0f, 100000.0f, -100000.0f, -100000.0f); size_t iPoint = 0; - FX_FLOAT half_width = line_width; + float half_width = line_width; int iStartPoint = 0; int iEndPoint = 0; int iMiddlePoint = 0; @@ -360,8 +359,8 @@ bool CFX_PathData::GetZeroAreaPath(const CFX_Matrix* pMatrix, (m_Points[i].m_Point.y - m_Points[next].m_Point.y) > 0)) { int pre = i; - if (FXSYS_fabs(m_Points[i].m_Point.y - m_Points[i - 1].m_Point.y) < - FXSYS_fabs(m_Points[i].m_Point.y - m_Points[next].m_Point.y)) { + if (fabs(m_Points[i].m_Point.y - m_Points[i - 1].m_Point.y) < + fabs(m_Points[i].m_Point.y - m_Points[next].m_Point.y)) { pre--; next--; } @@ -375,8 +374,8 @@ bool CFX_PathData::GetZeroAreaPath(const CFX_Matrix* pMatrix, (m_Points[i].m_Point.x - m_Points[next].m_Point.x) > 0)) { int pre = i; - if (FXSYS_fabs(m_Points[i].m_Point.x - m_Points[i - 1].m_Point.x) < - FXSYS_fabs(m_Points[i].m_Point.x - m_Points[next].m_Point.x)) { + if (fabs(m_Points[i].m_Point.x - m_Points[i - 1].m_Point.x) < + fabs(m_Points[i].m_Point.x - m_Points[next].m_Point.x)) { pre--; next--; } diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp index daa67ccc91b..46127ccb07a 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp @@ -16,6 +16,7 @@ #include "core/fxge/cfx_fxgedevice.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" +#include "core/fxge/dib/cfx_imagerenderer.h" #include "core/fxge/ifx_renderdevicedriver.h" #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ @@ -34,17 +35,16 @@ void AdjustGlyphSpace(std::vector<FXTEXT_GLYPHPOS>* pGlyphAndPos) { for (size_t i = glyphs.size() - 1; i > 1; --i) { FXTEXT_GLYPHPOS& next = glyphs[i]; int next_origin = bVertical ? next.m_Origin.y : next.m_Origin.x; - FX_FLOAT next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x; + float next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x; FXTEXT_GLYPHPOS& current = glyphs[i - 1]; int& current_origin = bVertical ? current.m_Origin.y : current.m_Origin.x; - FX_FLOAT current_origin_f = + float current_origin_f = bVertical ? current.m_fOrigin.y : current.m_fOrigin.x; int space = next_origin - current_origin; - FX_FLOAT space_f = next_origin_f - current_origin_f; - FX_FLOAT error = - FXSYS_fabs(space_f) - FXSYS_fabs(static_cast<FX_FLOAT>(space)); + float space_f = next_origin_f - current_origin_f; + float error = fabs(space_f) - fabs(static_cast<float>(space)); if (error > 0.5f) current_origin += space > 0 ? -1 : 1; } @@ -195,8 +195,8 @@ void SetAlpha(uint8_t* alpha) { void SetAlphaDoNothing(uint8_t* alpha) {} -void DrawNormalTextHelper(CFX_DIBitmap* bitmap, - const CFX_DIBitmap* pGlyph, +void DrawNormalTextHelper(const CFX_RetainPtr<CFX_DIBitmap>& bitmap, + const CFX_RetainPtr<CFX_DIBitmap>& pGlyph, int nrows, int left, int top, @@ -417,9 +417,10 @@ CFX_Matrix CFX_RenderDevice::GetCTM() const { return m_pDeviceDriver->GetCTM(); } -bool CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB, - int width, - int height) const { +bool CFX_RenderDevice::CreateCompatibleBitmap( + const CFX_RetainPtr<CFX_DIBitmap>& pDIB, + int width, + int height) const { if (m_RenderCaps & FXRC_CMYK_OUTPUT) { return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Cmyka @@ -513,29 +514,29 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, if (!rect_i.Valid()) return false; - int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); + int width = (int)ceil(rect_f.right - rect_f.left); if (width < 1) { width = 1; if (rect_i.left == rect_i.right) rect_i.right++; } - int height = (int)FXSYS_ceil(rect_f.top - rect_f.bottom); + int height = (int)ceil(rect_f.top - rect_f.bottom); if (height < 1) { height = 1; if (rect_i.bottom == rect_i.top) rect_i.bottom++; } if (rect_i.Width() >= width + 1) { - if (rect_f.left - (FX_FLOAT)(rect_i.left) > - (FX_FLOAT)(rect_i.right) - rect_f.right) { + if (rect_f.left - (float)(rect_i.left) > + (float)(rect_i.right) - rect_f.right) { rect_i.left++; } else { rect_i.right--; } } if (rect_i.Height() >= height + 1) { - if (rect_f.top - (FX_FLOAT)(rect_i.top) > - (FX_FLOAT)(rect_i.bottom) - rect_f.bottom) { + if (rect_f.top - (float)(rect_i.top) > + (float)(rect_i.bottom) - rect_f.bottom) { rect_i.top++; } else { rect_i.bottom--; @@ -608,24 +609,26 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, pObject2Device->TransformRect(bbox); CFX_Matrix ctm = GetCTM(); - FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); - FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); + float fScaleX = fabs(ctm.a); + float fScaleY = fabs(ctm.d); FX_RECT rect = bbox.GetOuterRect(); - CFX_DIBitmap bitmap, Backdrop; - if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), + auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); + auto Backdrop = pdfium::MakeRetain<CFX_DIBitmap>(); + if (!CreateCompatibleBitmap(bitmap, FXSYS_round(rect.Width() * fScaleX), FXSYS_round(rect.Height() * fScaleY))) { return false; } - if (bitmap.HasAlpha()) { - bitmap.Clear(0); - Backdrop.Copy(&bitmap); + if (bitmap->HasAlpha()) { + bitmap->Clear(0); + Backdrop->Copy(bitmap); } else { - if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top)) + if (!m_pDeviceDriver->GetDIBits(bitmap, rect.left, rect.top)) return false; - Backdrop.Copy(&bitmap); + Backdrop->Copy(bitmap); } CFX_FxgeDevice bitmap_device; - bitmap_device.Attach(&bitmap, false, &Backdrop, true); + bitmap_device.Attach(bitmap, false, Backdrop, true); + CFX_Matrix matrix; if (pObject2Device) matrix = *pObject2Device; @@ -641,7 +644,7 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, #endif FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), FXSYS_round(rect.Height() * fScaleY)); - return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, rect.top, + return m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, rect.left, rect.top, FXDIB_BLEND_NORMAL); } @@ -662,27 +665,27 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect, if (!(m_RenderCaps & FXRC_GET_BITS)) return false; - CFX_DIBitmap bitmap; - if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height())) + auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); + if (!CreateCompatibleBitmap(bitmap, pRect->Width(), pRect->Height())) return false; - if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top)) + if (!m_pDeviceDriver->GetDIBits(bitmap, pRect->left, pRect->top)) return false; - if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color, - 0, nullptr)) { + if (!bitmap->CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color, + 0)) { return false; } FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height()); - m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, pRect->left, pRect->top, + m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, pRect->left, pRect->top, FXDIB_BLEND_NORMAL); return true; } -bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, +bool CFX_RenderDevice::DrawCosmeticLine(float x1, + float y1, + float x2, + float y2, uint32_t color, int fill_mode, int blend_type) { @@ -698,30 +701,34 @@ bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, fill_mode, blend_type); } -bool CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { +bool CFX_RenderDevice::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + int left, + int top) { if (!(m_RenderCaps & FXRC_GET_BITS)) return false; return m_pDeviceDriver->GetDIBits(pBitmap, left, top); } -CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() { +CFX_RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() { return m_pDeviceDriver->GetBackDrop(); } -bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, - int left, - int top, - int blend_mode) { +bool CFX_RenderDevice::SetDIBitsWithBlend( + const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + int left, + int top, + int blend_mode) { ASSERT(!pBitmap->IsAlphaMask()); CFX_Matrix ctm = GetCTM(); - FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); - FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); + float fScaleX = fabs(ctm.a); + float fScaleY = fabs(ctm.d); FX_RECT dest_rect(left, top, FXSYS_round(left + pBitmap->GetWidth() / fScaleX), FXSYS_round(top + pBitmap->GetHeight() / fScaleY)); dest_rect.Intersect(m_ClipBox); if (dest_rect.IsEmpty()) return true; + FX_RECT src_rect(dest_rect.left - left, dest_rect.top - top, dest_rect.left - left + dest_rect.Width(), dest_rect.top - top + dest_rect.Height()); @@ -733,25 +740,26 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, (pBitmap->HasAlpha() && !(m_RenderCaps & FXRC_ALPHA_IMAGE))) { if (!(m_RenderCaps & FXRC_GET_BITS)) return false; + int bg_pixel_width = FXSYS_round(dest_rect.Width() * fScaleX); int bg_pixel_height = FXSYS_round(dest_rect.Height() * fScaleY); - CFX_DIBitmap background; - if (!background.Create( + auto background = pdfium::MakeRetain<CFX_DIBitmap>(); + if (!background->Create( bg_pixel_width, bg_pixel_height, (m_RenderCaps & FXRC_CMYK_OUTPUT) ? FXDIB_Cmyk : FXDIB_Rgb32)) { return false; } - if (!m_pDeviceDriver->GetDIBits(&background, dest_rect.left, + if (!m_pDeviceDriver->GetDIBits(background, dest_rect.left, dest_rect.top)) { return false; } - if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, - pBitmap, src_rect.left, src_rect.top, - blend_mode, nullptr, false, nullptr)) { + if (!background->CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, + pBitmap, src_rect.left, src_rect.top, + blend_mode, nullptr, false)) { return false; } FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height); - return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left, + return m_pDeviceDriver->SetDIBits(background, 0, &rect, dest_rect.left, dest_rect.top, FXDIB_BLEND_NORMAL); } return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, @@ -759,7 +767,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, } bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( - const CFX_DIBSource* pBitmap, + const CFX_RetainPtr<CFX_DIBSource>& pBitmap, int left, int top, int dest_width, @@ -776,7 +784,7 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( blend_mode); } -bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, +bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, int left, int top, uint32_t argb) { @@ -785,23 +793,25 @@ bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, FXDIB_BLEND_NORMAL); } -bool CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t color) { +bool CFX_RenderDevice::StretchBitMask( + const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t color) { return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height, color, 0); } -bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t argb, - uint32_t flags) { +bool CFX_RenderDevice::StretchBitMaskWithFlags( + const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t argb, + uint32_t flags) { FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); FX_RECT clip_box = m_ClipBox; clip_box.Intersect(dest_rect); @@ -810,36 +820,35 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, FXDIB_BLEND_NORMAL); } -bool CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t argb, - const CFX_Matrix* pMatrix, - uint32_t flags, - void*& handle, - int blend_mode) { +bool CFX_RenderDevice::StartDIBitsWithBlend( + const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + int bitmap_alpha, + uint32_t argb, + const CFX_Matrix* pMatrix, + uint32_t flags, + std::unique_ptr<CFX_ImageRenderer>* handle, + int blend_mode) { return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, flags, handle, blend_mode); } -bool CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { +bool CFX_RenderDevice::ContinueDIBits(CFX_ImageRenderer* handle, + IFX_Pause* pPause) { return m_pDeviceDriver->ContinueDIBits(handle, pPause); } -void CFX_RenderDevice::CancelDIBits(void* handle) { - m_pDeviceDriver->CancelDIBits(handle); -} - #ifdef _SKIA_SUPPORT_ void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { SkASSERT(0); } -bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap, - const CFX_DIBSource* pMask, - int left, - int top, - int bitmap_alpha, - int blend_type) { +bool CFX_RenderDevice::SetBitsWithMask( + const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + const CFX_RetainPtr<CFX_DIBSource>& pMask, + int left, + int top, + int bitmap_alpha, + int blend_type) { return m_pDeviceDriver->SetBitsWithMask(pBitmap, pMask, left, top, bitmap_alpha, blend_type); } @@ -848,7 +857,7 @@ bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap, bool CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2Device, uint32_t fill_color, uint32_t text_flags) { @@ -878,7 +887,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, } char2device.Scale(font_size, -font_size); - if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f || + if (fabs(char2device.a) + fabs(char2device.b) > 50 * 1.0f || ((m_DeviceClass == FXDC_PRINTER) && !(text_flags & FXTEXT_PRINTIMAGETEXT))) { if (pFont->GetFace()) { @@ -916,8 +925,8 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, } std::vector<FXTEXT_GLYPHPOS> glyphs(nChars); CFX_Matrix matrixCTM = GetCTM(); - FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a); - FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d); + float scale_x = fabs(matrixCTM.a); + float scale_y = fabs(matrixCTM.d); CFX_Matrix deviceCtm = char2device; CFX_Matrix m(scale_x, 0, 0, scale_y, 0, 0); deviceCtm.Concat(m); @@ -931,7 +940,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (anti_alias < FXFT_RENDER_MODE_LCD) glyph.m_Origin.x = FXSYS_round(glyph.m_fOrigin.x); else - glyph.m_Origin.x = static_cast<int>(FXSYS_floor(glyph.m_fOrigin.x)); + glyph.m_Origin.x = static_cast<int>(floor(glyph.m_fOrigin.x)); glyph.m_Origin.y = FXSYS_round(glyph.m_fOrigin.y); if (charpos.m_bGlyphAdjust) { @@ -958,49 +967,50 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, bmp_rect1.right++; bmp_rect1.bottom++; } - FX_RECT bmp_rect(FXSYS_round((FX_FLOAT)(bmp_rect1.left) / scale_x), - FXSYS_round((FX_FLOAT)(bmp_rect1.top) / scale_y), - FXSYS_round((FX_FLOAT)bmp_rect1.right / scale_x), - FXSYS_round((FX_FLOAT)bmp_rect1.bottom / scale_y)); + FX_RECT bmp_rect(FXSYS_round((float)(bmp_rect1.left) / scale_x), + FXSYS_round((float)(bmp_rect1.top) / scale_y), + FXSYS_round((float)bmp_rect1.right / scale_x), + FXSYS_round((float)bmp_rect1.bottom / scale_y)); bmp_rect.Intersect(m_ClipBox); if (bmp_rect.IsEmpty()) return true; + int pixel_width = FXSYS_round(bmp_rect.Width() * scale_x); int pixel_height = FXSYS_round(bmp_rect.Height() * scale_y); int pixel_left = FXSYS_round(bmp_rect.left * scale_x); int pixel_top = FXSYS_round(bmp_rect.top * scale_y); if (anti_alias == FXFT_RENDER_MODE_MONO) { - CFX_DIBitmap bitmap; - if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask)) + auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); + if (!bitmap->Create(pixel_width, pixel_height, FXDIB_1bppMask)) return false; - bitmap.Clear(0); + bitmap->Clear(0); for (const FXTEXT_GLYPHPOS& glyph : glyphs) { if (!glyph.m_pGlyph) continue; - const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; - bitmap.TransferBitmap( + CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap; + bitmap->TransferBitmap( glyph.m_Origin.x + glyph.m_pGlyph->m_Left - pixel_left, glyph.m_Origin.y - glyph.m_pGlyph->m_Top - pixel_top, pGlyph->GetWidth(), pGlyph->GetHeight(), pGlyph, 0, 0); } - return SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); + return SetBitMask(bitmap, bmp_rect.left, bmp_rect.top, fill_color); } - CFX_DIBitmap bitmap; + auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); if (m_bpp == 8) { - if (!bitmap.Create(pixel_width, pixel_height, FXDIB_8bppMask)) + if (!bitmap->Create(pixel_width, pixel_height, FXDIB_8bppMask)) return false; } else { - if (!CreateCompatibleBitmap(&bitmap, pixel_width, pixel_height)) + if (!CreateCompatibleBitmap(bitmap, pixel_width, pixel_height)) return false; } - if (!bitmap.HasAlpha() && !bitmap.IsAlphaMask()) { - bitmap.Clear(0xFFFFFFFF); - if (!GetDIBits(&bitmap, bmp_rect.left, bmp_rect.top)) + if (!bitmap->HasAlpha() && !bitmap->IsAlphaMask()) { + bitmap->Clear(0xFFFFFFFF); + if (!GetDIBits(bitmap, bmp_rect.left, bmp_rect.top)) return false; } else { - bitmap.Clear(0); - if (bitmap.m_pAlphaMask) - bitmap.m_pAlphaMask->Clear(0); + bitmap->Clear(0); + if (bitmap->m_pAlphaMask) + bitmap->m_pAlphaMask->Clear(0); } int dest_width = pixel_width; int a = 0; @@ -1026,14 +1036,13 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (!top.IsValid()) return false; - const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; + CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap; int ncols = pGlyph->GetWidth(); int nrows = pGlyph->GetHeight(); if (anti_alias == FXFT_RENDER_MODE_NORMAL) { - if (!bitmap.CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols, - nrows, pGlyph, fill_color, 0, 0, - FXDIB_BLEND_NORMAL, nullptr, false, 0, - nullptr)) { + if (!bitmap->CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols, + nrows, pGlyph, fill_color, 0, 0, + FXDIB_BLEND_NORMAL, nullptr, false, 0)) { return false; } continue; @@ -1053,21 +1062,21 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (start_col >= end_col) continue; - DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(), + DrawNormalTextHelper(bitmap, pGlyph, nrows, left.ValueOrDie(), top.ValueOrDie(), start_col, end_col, bNormal, bBGRStripe, x_subpixel, a, r, g, b); } - if (bitmap.IsAlphaMask()) - SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); + if (bitmap->IsAlphaMask()) + SetBitMask(bitmap, bmp_rect.left, bmp_rect.top, fill_color); else - SetDIBits(&bitmap, bmp_rect.left, bmp_rect.top); + SetDIBits(bitmap, bmp_rect.left, bmp_rect.top); return true; } bool CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - FX_FLOAT font_size, + float font_size, const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp index c7e3303f026..cd7625fb17d 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp @@ -62,7 +62,7 @@ uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) { return 0; } -uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const { +uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(wchar_t Unicode) const { if (m_nEncodingID == FXFM_ENCODING_UNICODE || m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) { return Unicode; diff --git a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp index e7086bb4e0a..502a3674aba 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp @@ -15,7 +15,7 @@ namespace { const size_t kLinuxGpNameSize = 6; -const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = { +const char* const g_LinuxGpFontList[][kLinuxGpNameSize] = { {"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic", "VL Gothic regular"}, {"TakaoGothic", "VL Gothic", "IPAGothic", "Kochi Gothic", nullptr, @@ -26,19 +26,19 @@ const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = { "VL Gothic regular"}, }; -const FX_CHAR* const g_LinuxGbFontList[] = { +const char* const g_LinuxGbFontList[] = { "AR PL UMing CN Light", "WenQuanYi Micro Hei", "AR PL UKai CN", }; -const FX_CHAR* const g_LinuxB5FontList[] = { +const char* const g_LinuxB5FontList[] = { "AR PL UMing TW Light", "WenQuanYi Micro Hei", "AR PL UKai TW", }; -const FX_CHAR* const g_LinuxHGFontList[] = { +const char* const g_LinuxHGFontList[] = { "UnDotum", }; -size_t GetJapanesePreference(const FX_CHAR* facearr, +size_t GetJapanesePreference(const char* facearr, int weight, int pitch_family) { CFX_ByteString face = facearr; @@ -72,7 +72,7 @@ class CFX_LinuxFontInfo : public CFX_FolderFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) override; bool ParseFontCfg(const char** pUserPaths); }; @@ -81,7 +81,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* cstr_face, + const char* cstr_face, int& iExact) { void* font = GetSubstFont(cstr_face); if (font) { diff --git a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp index 669969db0bc..b451b543fcd 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp +++ b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp @@ -45,8 +45,8 @@ ScopedFontTransform::~ScopedFontTransform() { FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, int anti_alias, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY) { + float retinaScaleX, + float retinaScaleY) { FX_RECT rect(0, 0, 0, 0); bool bStarted = false; for (const FXTEXT_GLYPHPOS& glyph : glyphs) { @@ -59,7 +59,7 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, if (!char_left.IsValid()) continue; - FX_SAFE_INT32 char_width = pGlyph->m_Bitmap.GetWidth(); + FX_SAFE_INT32 char_width = pGlyph->m_pBitmap->GetWidth(); char_width /= retinaScaleX; if (anti_alias == FXFT_RENDER_MODE_LCD) char_width /= 3; @@ -75,7 +75,7 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, if (!char_top.IsValid()) continue; - FX_SAFE_INT32 char_height = pGlyph->m_Bitmap.GetHeight(); + FX_SAFE_INT32 char_height = pGlyph->m_pBitmap->GetHeight(); char_height /= retinaScaleY; if (!char_height.IsValid()) continue; diff --git a/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h b/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h index 4de6587d411..8ea01f91d67 100644 --- a/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h +++ b/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h @@ -14,7 +14,7 @@ struct _CFX_UniqueKeyGen { void Generate(int count, ...); - FX_CHAR m_Key[128]; + char m_Key[128]; int m_KeyLen; }; |