diff options
author | Lei Zhang <thestig@chromium.org> | 2018-08-17 19:29:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-17 19:29:51 +0000 |
commit | e13a068f29061b9c6d24189bc4dc87a9111cdb1b (patch) | |
tree | 0ee44a6d076ce7fb4db75e04ef5a1ae5cf58cd46 /core/fxge/android | |
parent | 3a6d058740a9908a06efb9e9362df01acdee6ff8 (diff) | |
download | pdfium-e13a068f29061b9c6d24189bc4dc87a9111cdb1b.tar.xz |
Remove CFPF_SkiaBufferFont and CFPF_SkiaFileFont.
The classes are never instantiated.
Change-Id: I108d3c397464e50b337bc46702d4adbc263e8814
Reviewed-on: https://pdfium-review.googlesource.com/40550
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxge/android')
-rw-r--r-- | core/fxge/android/cfpf_skiabufferfont.cpp | 16 | ||||
-rw-r--r-- | core/fxge/android/cfpf_skiabufferfont.h | 26 | ||||
-rw-r--r-- | core/fxge/android/cfpf_skiafilefont.cpp | 17 | ||||
-rw-r--r-- | core/fxge/android/cfpf_skiafilefont.h | 28 | ||||
-rw-r--r-- | core/fxge/android/cfpf_skiafont.cpp | 13 | ||||
-rw-r--r-- | core/fxge/android/cfpf_skiafontmgr.cpp | 66 | ||||
-rw-r--r-- | core/fxge/android/cfpf_skiafontmgr.h | 6 |
7 files changed, 1 insertions, 171 deletions
diff --git a/core/fxge/android/cfpf_skiabufferfont.cpp b/core/fxge/android/cfpf_skiabufferfont.cpp deleted file mode 100644 index 3fce483bdc..0000000000 --- a/core/fxge/android/cfpf_skiabufferfont.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fxge/android/cfpf_skiabufferfont.h" - -CFPF_SkiaBufferFont::CFPF_SkiaBufferFont() - : m_pBuffer(nullptr), m_szBuffer(0) {} - -CFPF_SkiaBufferFont::~CFPF_SkiaBufferFont() = default; - -int32_t CFPF_SkiaBufferFont::GetType() const { - return FPF_SKIAFONTTYPE_Buffer; -} diff --git a/core/fxge/android/cfpf_skiabufferfont.h b/core/fxge/android/cfpf_skiabufferfont.h deleted file mode 100644 index 3a94a51b6a..0000000000 --- a/core/fxge/android/cfpf_skiabufferfont.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_ANDROID_CFPF_SKIABUFFERFONT_H_ -#define CORE_FXGE_ANDROID_CFPF_SKIABUFFERFONT_H_ - -#include "core/fxge/android/cfpf_skiafontdescriptor.h" - -#define FPF_SKIAFONTTYPE_Buffer 3 - -class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { - public: - CFPF_SkiaBufferFont(); - ~CFPF_SkiaBufferFont() override; - - // CFPF_SkiaFontDescriptor - int32_t GetType() const override; - - void* m_pBuffer; - size_t m_szBuffer; -}; - -#endif // CORE_FXGE_ANDROID_CFPF_SKIABUFFERFONT_H_ diff --git a/core/fxge/android/cfpf_skiafilefont.cpp b/core/fxge/android/cfpf_skiafilefont.cpp deleted file mode 100644 index 2cdf58a4ce..0000000000 --- a/core/fxge/android/cfpf_skiafilefont.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fxge/android/cfpf_skiafilefont.h" - -#include "core/fxcrt/fx_stream.h" - -CFPF_SkiaFileFont::CFPF_SkiaFileFont() = default; - -CFPF_SkiaFileFont::~CFPF_SkiaFileFont() = default; - -int32_t CFPF_SkiaFileFont::GetType() const { - return FPF_SKIAFONTTYPE_File; -} diff --git a/core/fxge/android/cfpf_skiafilefont.h b/core/fxge/android/cfpf_skiafilefont.h deleted file mode 100644 index 5e2ebbc529..0000000000 --- a/core/fxge/android/cfpf_skiafilefont.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_ -#define CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_ - -#include "core/fxcrt/retain_ptr.h" -#include "core/fxge/android/cfpf_skiafontdescriptor.h" - -class IFX_SeekableReadStream; - -#define FPF_SKIAFONTTYPE_File 2 - -class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { - public: - CFPF_SkiaFileFont(); - ~CFPF_SkiaFileFont() override; - - // CFPF_SkiaFontDescriptor - int32_t GetType() const override; - - RetainPtr<IFX_SeekableReadStream> m_pFile; -}; - -#endif // CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_ diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp index 1ca0f576be..6431f14c57 100644 --- a/core/fxge/android/cfpf_skiafont.cpp +++ b/core/fxge/android/cfpf_skiafont.cpp @@ -9,8 +9,6 @@ #include <algorithm> #include "core/fxcrt/fx_system.h" -#include "core/fxge/android/cfpf_skiabufferfont.h" -#include "core/fxge/android/cfpf_skiafilefont.h" #include "core/fxge/android/cfpf_skiafontdescriptor.h" #include "core/fxge/android/cfpf_skiafontmgr.h" #include "core/fxge/android/cfpf_skiapathfont.h" @@ -193,17 +191,6 @@ bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr, m_Face = pFontMgr->GetFontFace(pFont->m_pPath, pFont->m_iFaceIndex); break; } - case FPF_SKIAFONTTYPE_File: { - CFPF_SkiaFileFont* pFont = (CFPF_SkiaFileFont*)pFontDes; - m_Face = pFontMgr->GetFontFace(pFont->m_pFile, pFont->m_iFaceIndex); - break; - } - case FPF_SKIAFONTTYPE_Buffer: { - CFPF_SkiaBufferFont* pFont = (CFPF_SkiaBufferFont*)pFontDes; - m_Face = pFontMgr->GetFontFace((const uint8_t*)pFont->m_pBuffer, - pFont->m_szBuffer, pFont->m_iFaceIndex); - break; - } default: return false; } diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 880de6bc01..32fe498882 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -16,6 +16,7 @@ #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/fx_stream.h" #include "core/fxcrt/fx_system.h" #include "core/fxge/android/cfpf_skiafont.h" #include "core/fxge/android/cfpf_skiafontdescriptor.h" @@ -24,28 +25,6 @@ namespace { -unsigned long FPF_SkiaStream_Read(FXFT_Stream stream, - unsigned long offset, - unsigned char* buffer, - unsigned long count) { - if (count == 0) - return 0; - - IFX_SeekableReadStream* pFileRead = - static_cast<IFX_SeekableReadStream*>(stream->descriptor.pointer); - if (!pFileRead) - return 0; - - if (!pFileRead->ReadBlock(buffer, static_cast<FX_FILESIZE>(offset), - static_cast<size_t>(count))) { - return 0; - } - - return count; -} - -void FPF_SkiaStream_Close(FXFT_Stream stream) {} - struct FPF_SKIAFONTMAP { uint32_t dwFamily; uint32_t dwSubSt; @@ -356,31 +335,6 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname, return nullptr; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace( - const RetainPtr<IFX_SeekableReadStream>& pFileRead, - int32_t iFaceIndex) { - if (!pFileRead) - return nullptr; - if (pFileRead->GetSize() == 0) - return nullptr; - if (iFaceIndex < 0) - return nullptr; - FXFT_StreamRec streamRec; - memset(&streamRec, 0, sizeof(FXFT_StreamRec)); - streamRec.size = pFileRead->GetSize(); - streamRec.descriptor.pointer = static_cast<void*>(pFileRead.Get()); - streamRec.read = FPF_SkiaStream_Read; - streamRec.close = FPF_SkiaStream_Close; - FXFT_Open_Args args; - args.flags = FT_OPEN_STREAM; - args.stream = &streamRec; - FXFT_Face face; - if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) - return nullptr; - FXFT_Set_Pixel_Sizes(face, 0, 64); - return face; -} - FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex) { if (bsFile.IsEmpty()) @@ -397,24 +351,6 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const ByteStringView& bsFile, return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, - size_t szBuffer, - int32_t iFaceIndex) { - if (!pBuffer || szBuffer < 1) - return nullptr; - if (iFaceIndex < 0) - return nullptr; - FXFT_Open_Args args; - args.flags = FT_OPEN_MEMORY; - args.memory_base = pBuffer; - args.memory_size = szBuffer; - FXFT_Face face; - if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) - return nullptr; - FXFT_Set_Pixel_Sizes(face, 0, 64); - return face; -} - void CFPF_SkiaFontMgr::ScanPath(const ByteString& path) { DIR* handle = FX_OpenFolder(path.c_str()); if (!handle) diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h index 5e0bce2d78..3152a3592e 100644 --- a/core/fxge/android/cfpf_skiafontmgr.h +++ b/core/fxge/android/cfpf_skiafontmgr.h @@ -10,7 +10,6 @@ #include <map> #include <vector> -#include "core/fxcrt/fx_stream.h" #include "core/fxcrt/fx_string.h" #include "core/fxge/fx_font.h" @@ -31,12 +30,7 @@ class CFPF_SkiaFontMgr { uint32_t dwMatch); bool InitFTLibrary(); - FXFT_Face GetFontFace(const RetainPtr<IFX_SeekableReadStream>& pFileRead, - int32_t iFaceIndex); FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex); - FXFT_Face GetFontFace(const uint8_t* pBuffer, - size_t szBuffer, - int32_t iFaceIndex); private: void ScanPath(const ByteString& path); |