From 48baa5f230a886b0579a9626711e7d71376b085e Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 6 Apr 2016 10:00:40 -0700 Subject: Move core/include/fxge to core/fxge/include. This CL is a straight move of the fxge includes into core/fxge/include. Review URL: https://codereview.chromium.org/1868533002 --- BUILD.gn | 14 +- core/fpdfapi/fpdf_font/cpdf_font.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp | 6 +- core/fpdfapi/fpdf_font/cpdf_simplefont.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_type1font.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_type3char.cpp | 2 +- core/fpdfapi/fpdf_font/fpdf_font.cpp | 2 +- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 4 +- core/fpdfapi/fpdf_font/include/cpdf_font.h | 2 +- core/fpdfapi/fpdf_font/ttgsubtable.cpp | 4 +- core/fpdfapi/fpdf_font/ttgsubtable.h | 4 +- core/fpdfapi/fpdf_page/cpdf_colorstate.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_graphstate.h | 2 +- core/fpdfapi/fpdf_page/cpdf_image.cpp | 12 +- .../fpdf_page/include/cpdf_generalstatedata.h | 2 +- core/fpdfapi/fpdf_page/include/cpdf_path.h | 2 +- core/fpdfapi/fpdf_page/pageint.h | 2 +- core/fpdfapi/fpdf_parser/cpdf_document.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 2 +- .../fpdf_render/include/cpdf_renderoptions.h | 2 +- .../fpdf_render/include/cpdf_textrenderer.h | 2 +- core/fpdfdoc/doc_annot.cpp | 2 +- core/fpdfdoc/doc_utils.cpp | 2 +- core/fpdfdoc/include/cpvt_wordprops.h | 2 +- core/fxcodec/codec/fx_codec_bmp.cpp | 2 +- core/fxcodec/codec/fx_codec_gif.cpp | 2 +- core/fxcodec/codec/fx_codec_jpeg.cpp | 2 +- core/fxcodec/codec/fx_codec_png.cpp | 2 +- core/fxcodec/codec/fx_codec_progress.cpp | 2 +- core/fxcodec/codec/fx_codec_progress.h | 2 +- core/fxcodec/codec/fx_codec_tiff.cpp | 2 +- core/fxge/agg/fx_agg_driver.cpp | 2 +- core/fxge/agg/fx_agg_driver.h | 2 +- core/fxge/android/fpf_skiafont.cpp | 2 +- core/fxge/android/fpf_skiafont.h | 4 +- core/fxge/android/fpf_skiafontmgr.cpp | 2 +- core/fxge/android/fpf_skiafontmgr.h | 4 +- core/fxge/android/fpf_skiamodule.h | 2 +- core/fxge/android/fx_android_font.cpp | 2 +- core/fxge/android/fx_android_font.h | 2 +- core/fxge/android/fx_android_imp.cpp | 4 +- core/fxge/apple/apple_int.h | 2 +- core/fxge/apple/fx_apple_platform.cpp | 6 +- core/fxge/apple/fx_mac_imp.cpp | 2 +- core/fxge/apple/fx_quartz_device.cpp | 6 +- core/fxge/dib/dib_int.h | 2 +- core/fxge/dib/fx_dib_composite.cpp | 2 +- core/fxge/dib/fx_dib_convert.cpp | 4 +- core/fxge/dib/fx_dib_engine.cpp | 4 +- core/fxge/dib/fx_dib_main.cpp | 4 +- core/fxge/dib/fx_dib_transform.cpp | 2 +- core/fxge/freetype/fx_freetype.cpp | 2 +- core/fxge/ge/fx_ge.cpp | 2 +- core/fxge/ge/fx_ge_device.cpp | 2 +- core/fxge/ge/fx_ge_font.cpp | 4 +- core/fxge/ge/fx_ge_fontmap.cpp | 4 +- core/fxge/ge/fx_ge_linux.cpp | 2 +- core/fxge/ge/fx_ge_path.cpp | 2 +- core/fxge/ge/fx_ge_ps.cpp | 2 +- core/fxge/ge/fx_ge_text.cpp | 4 +- core/fxge/ge/fx_text_int.h | 4 +- core/fxge/include/fpf.h | 70 ++ core/fxge/include/fx_dib.h | 669 +++++++++++++++++++ core/fxge/include/fx_font.h | 566 ++++++++++++++++ core/fxge/include/fx_freetype.h | 180 +++++ core/fxge/include/fx_ge.h | 733 +++++++++++++++++++++ core/fxge/include/fx_ge_apple.h | 27 + core/fxge/include/fx_ge_win32.h | 98 +++ core/fxge/skia/fx_skia_device.cpp | 2 +- core/fxge/win32/fx_win32_device.cpp | 6 +- core/fxge/win32/fx_win32_dib.cpp | 4 +- core/fxge/win32/fx_win32_dwrite.cpp | 4 +- core/fxge/win32/fx_win32_gdipext.cpp | 4 +- core/fxge/win32/fx_win32_print.cpp | 6 +- core/fxge/win32/win32_int.h | 2 +- core/include/fpdfdoc/fpdf_doc.h | 2 +- core/include/fpdfdoc/fpdf_tagged.h | 2 +- core/include/fxge/fpf.h | 70 -- core/include/fxge/fx_dib.h | 669 ------------------- core/include/fxge/fx_font.h | 566 ---------------- core/include/fxge/fx_freetype.h | 180 ----- core/include/fxge/fx_ge.h | 733 --------------------- core/include/fxge/fx_ge_apple.h | 27 - core/include/fxge/fx_ge_win32.h | 98 --- fpdfsdk/DEPS | 1 + fpdfsdk/fxedit/fxet_pageobjs.cpp | 2 +- fpdfsdk/include/fsdk_baseform.h | 2 +- fpdfsdk/include/fsdk_define.h | 4 +- fpdfsdk/include/fxedit/fx_edit.h | 2 +- fpdfsdk/pdfwindow/PWL_Caret.cpp | 2 +- fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Edit.cpp | 2 +- fpdfsdk/pdfwindow/PWL_ListCtrl.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Note.cpp | 2 +- fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Signature.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Utils.cpp | 2 +- pdfium.gyp | 14 +- testing/DEPS | 1 + testing/libfuzzer/pdf_jpx_fuzzer.cc | 2 +- xfa/DEPS | 1 + xfa/fde/css/fde_css.h | 2 +- xfa/fde/fde_brush.h | 2 +- xfa/fde/fde_geobject.h | 2 +- xfa/fde/fde_object.h | 2 +- xfa/fde/fde_renderdevice.h | 4 +- xfa/fde/fde_visualset.h | 4 +- xfa/fde/tto/fde_textout.h | 4 +- xfa/fee/ifde_txtedtengine.h | 2 +- xfa/fee/ifde_txtedtpage.h | 2 +- xfa/fgas/font/fgas_font.h | 2 +- xfa/fgas/font/fgas_stdfontmgr.h | 4 +- xfa/fgas/layout/fgas_rtfbreak.h | 2 +- xfa/fgas/layout/fgas_textbreak.h | 2 +- xfa/fwl/basewidget/ifx_barcode.h | 2 +- xfa/fwl/core/cfwl_themebackground.h | 2 +- xfa/fwl/lightwidget/cfwl_theme.h | 2 +- xfa/fxbarcode/BC_BufferedImageLuminanceSource.h | 2 +- xfa/fxbarcode/BC_TwoDimWriter.h | 2 +- xfa/fxbarcode/BC_Writer.h | 2 +- xfa/fxbarcode/cbc_codabar.h | 2 +- xfa/fxbarcode/cbc_code128.h | 2 +- xfa/fxbarcode/cbc_code39.h | 2 +- xfa/fxbarcode/cbc_codebase.h | 2 +- xfa/fxbarcode/cbc_datamatrix.h | 2 +- xfa/fxbarcode/cbc_ean13.h | 2 +- xfa/fxbarcode/cbc_ean8.h | 2 +- xfa/fxbarcode/cbc_pdf417i.h | 2 +- xfa/fxbarcode/cbc_qrcode.h | 2 +- xfa/fxbarcode/cbc_upca.h | 2 +- xfa/fxbarcode/oned/BC_OneDimWriter.h | 2 +- xfa/fxfa/parser/xfa_localemgr.cpp | 2 +- xfa/fxgraphics/cagg_graphics.h | 2 +- xfa/fxgraphics/cfx_color.h | 2 +- xfa/fxgraphics/cfx_path_generator.h | 2 +- xfa/fxgraphics/cfx_shading.h | 2 +- xfa/fxgraphics/include/cfx_graphics.h | 4 +- xfa/include/fxfa/fxfa_objectacc.h | 2 +- xfa/include/fxfa/xfa_ffwidget.h | 2 +- 145 files changed, 2523 insertions(+), 2520 deletions(-) create mode 100644 core/fxge/include/fpf.h create mode 100644 core/fxge/include/fx_dib.h create mode 100644 core/fxge/include/fx_font.h create mode 100644 core/fxge/include/fx_freetype.h create mode 100644 core/fxge/include/fx_ge.h create mode 100644 core/fxge/include/fx_ge_apple.h create mode 100644 core/fxge/include/fx_ge_win32.h delete mode 100644 core/include/fxge/fpf.h delete mode 100644 core/include/fxge/fx_dib.h delete mode 100644 core/include/fxge/fx_font.h delete mode 100644 core/include/fxge/fx_freetype.h delete mode 100644 core/include/fxge/fx_ge.h delete mode 100644 core/include/fxge/fx_ge_apple.h delete mode 100644 core/include/fxge/fx_ge_win32.h diff --git a/BUILD.gn b/BUILD.gn index 32d7886b98..711ab98e08 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -696,13 +696,13 @@ static_library("fxge") { "core/fxge/ge/fx_ge_ps.cpp", "core/fxge/ge/fx_ge_text.cpp", "core/fxge/ge/fx_text_int.h", - "core/include/fxge/fpf.h", - "core/include/fxge/fx_dib.h", - "core/include/fxge/fx_font.h", - "core/include/fxge/fx_freetype.h", - "core/include/fxge/fx_ge.h", - "core/include/fxge/fx_ge_apple.h", - "core/include/fxge/fx_ge_win32.h", + "core/fxge/include/fpf.h", + "core/fxge/include/fx_dib.h", + "core/fxge/include/fx_font.h", + "core/fxge/include/fx_freetype.h", + "core/fxge/include/fx_ge.h", + "core/fxge/include/fx_ge_apple.h", + "core/fxge/include/fx_ge_win32.h", ] configs += [ diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index fd6a9c9814..7a6043ad87 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -18,7 +18,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" namespace { diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp index 3fc16a2c43..8a280e6ba0 100644 --- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp @@ -6,12 +6,12 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fxge/include/fx_freetype.h" namespace { diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp index 53bbd93d6c..0b4199aac0 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp @@ -9,7 +9,7 @@ #include "core/fpdfapi/fpdf_font/font_int.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" CPDF_SimpleFont::CPDF_SimpleFont() : m_pCharNames(nullptr), m_BaseEncoding(PDFFONT_ENCODING_BUILTIN) { diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp index 032fa00e96..576b00550e 100644 --- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_font/font_int.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fx_font.h" CPDF_TrueTypeFont::CPDF_TrueTypeFont() {} diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp index 5119624611..5fbc520ae5 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_font/font_int.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ #include "core/fxge/apple/apple_int.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_type3char.cpp b/core/fpdfapi/fpdf_font/cpdf_type3char.cpp index c9d44435a3..44219ee02d 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type3char.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type3char.cpp @@ -10,7 +10,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index 9670aa8e7f..a3adecc764 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -17,7 +17,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_ext.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" #include "third_party/base/stl_util.h" FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) { diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index fb3707f498..78c72a7fef 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -13,8 +13,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_ext.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" namespace { diff --git a/core/fpdfapi/fpdf_font/include/cpdf_font.h b/core/fpdfapi/fpdf_font/include/cpdf_font.h index 79456aa7a5..81518408e7 100644 --- a/core/fpdfapi/fpdf_font/include/cpdf_font.h +++ b/core/fpdfapi/fpdf_font/include/cpdf_font.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fx_font.h" #define PDFFONT_FIXEDPITCH 1 #define PDFFONT_SERIF 2 diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/fpdfapi/fpdf_font/ttgsubtable.cpp index bb1a6f9f22..321419346d 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -8,8 +8,8 @@ #include -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" #include "third_party/base/stl_util.h" CFX_GlyphMap::CFX_GlyphMap() {} diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.h b/core/fpdfapi/fpdf_font/ttgsubtable.h index 56f3fc01ea..7a6c66cc2a 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/fpdfapi/fpdf_font/ttgsubtable.h @@ -12,8 +12,8 @@ #include #include "core/fxcrt/include/fx_basic.h" -#include "core/include/fxge/fx_font.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_font.h" +#include "core/fxge/include/fx_freetype.h" class CFX_GlyphMap { public: diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp index 5c73b28e67..580b58a06a 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, diff --git a/core/fpdfapi/fpdf_page/cpdf_graphstate.h b/core/fpdfapi/fpdf_page/cpdf_graphstate.h index d44d32d31c..038ed15580 100644 --- a/core/fpdfapi/fpdf_page/cpdf_graphstate.h +++ b/core/fpdfapi/fpdf_page/cpdf_graphstate.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_GRAPHSTATE_H_ #define CORE_FPDFAPI_FPDF_PAGE_CPDF_GRAPHSTATE_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" class CPDF_GraphState : public CFX_CountRef {}; diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp index d5c97807e9..2b662e1074 100644 --- a/core/fpdfapi/fpdf_page/cpdf_image.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp @@ -6,17 +6,17 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fxcodec/fx_codec.h" #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/render_int.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fxge/include/fx_dib.h" +#include "core/include/fxcodec/fx_codec.h" CPDF_Image::CPDF_Image(CPDF_Document* pDoc) : m_pDIBSource(nullptr), diff --git a/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h b/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h index df7560289c..a4577a6cb0 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h @@ -10,7 +10,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class CPDF_TransferFunc; class CPDF_Object; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_path.h b/core/fpdfapi/fpdf_page/include/cpdf_path.h index f13b2719b9..d9f3ead88c 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_path.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_path.h @@ -8,7 +8,7 @@ #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" class CPDF_Path : public CFX_CountRef { public: diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h index 0909125ab0..e6496cfd20 100644 --- a/core/fpdfapi/fpdf_page/pageint.h +++ b/core/fpdfapi/fpdf_page/pageint.h @@ -16,7 +16,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" #include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" class CPDF_AllStates; class CPDF_ColorSpace; diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index 9058ed6767..d48edd056b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -16,7 +16,7 @@ #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fpdfapi/ipdf_rendermodule.h" -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fx_font.h" #include "third_party/base/stl_util.h" namespace { diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 52f29477a9..066d4eb2a4 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -29,7 +29,7 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fpdfapi/ipdf_rendermodule.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) : m_pPDFDoc(pPDFDoc), m_pFontCache(new CFX_FontCache) {} diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp index a2592004e7..d95edd7bb7 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/render_int.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" struct CACHEINFO { uint32_t time; diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index ef2109a02f..167570ba92 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -25,8 +25,8 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fxcrt/include/fx_safe_types.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_ge.h" FX_BOOL CPDF_RenderStatus::ProcessImage(const CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device) { diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 7a4a36e1cf..61e47036fa 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -20,8 +20,8 @@ #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_safe_types.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_ge.h" namespace { diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index d3081da26f..3f98279dbf 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -20,7 +20,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #define SHADING_STEPS 256 static void DrawAxialShading(CFX_DIBitmap* pBitmap, diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index 0165e8a7d7..264abe9a53 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -21,7 +21,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" namespace { diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h index a78838ac58..6935d695be 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h @@ -8,7 +8,7 @@ #define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_ #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class IPDF_OCContext; diff --git a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h index 2d3ce44e46..d532196675 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h @@ -10,7 +10,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class CFX_RenderDevice; class CFX_GraphStateData; diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index ca900acb9a..0e3d2a56bd 100644 --- a/core/fpdfdoc/doc_annot.cpp +++ b/core/fpdfdoc/doc_annot.cpp @@ -13,8 +13,8 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfdoc/cpvt_generateap.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fpdfdoc/fpdf_doc.h" -#include "core/include/fxge/fx_ge.h" CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) : m_pDocument(pPage->m_pDocument) { diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index d3b3cac627..0d91b20e8a 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -12,8 +12,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfdoc/doc_utils.h" +#include "core/fxge/include/fx_font.h" #include "core/include/fpdfdoc/fpdf_doc.h" -#include "core/include/fxge/fx_font.h" namespace { diff --git a/core/fpdfdoc/include/cpvt_wordprops.h b/core/fpdfdoc/include/cpvt_wordprops.h index e091579239..690a5e1950 100644 --- a/core/fpdfdoc/include/cpvt_wordprops.h +++ b/core/fpdfdoc/include/cpvt_wordprops.h @@ -9,7 +9,7 @@ #include "core/fpdfdoc/include/cpdf_variabletext.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" struct CPVT_WordProps { CPVT_WordProps() diff --git a/core/fxcodec/codec/fx_codec_bmp.cpp b/core/fxcodec/codec/fx_codec_bmp.cpp index 31383774aa..2dc537161b 100644 --- a/core/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/fxcodec/codec/fx_codec_bmp.cpp @@ -6,8 +6,8 @@ #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/lbmp/fx_bmp.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" struct FXBMP_Context { bmp_decompress_struct_p bmp_ptr; void* parent_ptr; diff --git a/core/fxcodec/codec/fx_codec_gif.cpp b/core/fxcodec/codec/fx_codec_gif.cpp index 1657d7257e..e1806a4001 100644 --- a/core/fxcodec/codec/fx_codec_gif.cpp +++ b/core/fxcodec/codec/fx_codec_gif.cpp @@ -6,8 +6,8 @@ #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/lgif/fx_gif.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" struct FXGIF_Context { gif_decompress_struct_p gif_ptr; void* parent_ptr; diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 553e237b32..ce39038438 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -8,8 +8,8 @@ #include "core/fxcodec/codec/codec_int.h" #include "core/fxcrt/include/fx_safe_types.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" extern "C" { #undef FAR diff --git a/core/fxcodec/codec/fx_codec_png.cpp b/core/fxcodec/codec/fx_codec_png.cpp index f8621001b6..e625737e34 100644 --- a/core/fxcodec/codec/fx_codec_png.cpp +++ b/core/fxcodec/codec/fx_codec_png.cpp @@ -7,8 +7,8 @@ #include #include "core/fxcodec/codec/codec_int.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" extern "C" { #undef FAR diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index 9e113c695c..ebd69ae1e3 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -6,8 +6,8 @@ #include "core/fxcodec/codec/fx_codec_progress.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" void CFXCODEC_WeightTable::Calc(int dest_len, int dest_min, diff --git a/core/fxcodec/codec/fx_codec_progress.h b/core/fxcodec/codec/fx_codec_progress.h index ccd52a95b1..2b2ba28e16 100644 --- a/core/fxcodec/codec/fx_codec_progress.h +++ b/core/fxcodec/codec/fx_codec_progress.h @@ -9,8 +9,8 @@ #include "core/fxcrt/include/fx_memory.h" #include "core/fxcrt/include/fx_system.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" #define FXCODEC_BLOCK_SIZE 4096 #define FXCODEC_PNG_GAMMA 2.2 diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp index 96249f9d14..d445769714 100644 --- a/core/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/fxcodec/codec/fx_codec_tiff.cpp @@ -5,8 +5,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxcodec/codec/codec_int.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" extern "C" { #include "third_party/libtiff/tiffiop.h" diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 8bda709c26..62fb539239 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -10,8 +10,8 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/fx_text_int.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_ge.h" #include "third_party/agg23/agg_conv_dash.h" #include "third_party/agg23/agg_conv_stroke.h" #include "third_party/agg23/agg_curves.h" diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 5bc9283b03..18f8d348ce 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -7,7 +7,7 @@ #ifndef CORE_FXGE_AGG_FX_AGG_DRIVER_H_ #define CORE_FXGE_AGG_FX_AGG_DRIVER_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "third_party/agg23/agg_clip_liang_barsky.h" #include "third_party/agg23/agg_path_storage.h" #include "third_party/agg23/agg_rasterizer_scanline_aa.h" diff --git a/core/fxge/android/fpf_skiafont.cpp b/core/fxge/android/fpf_skiafont.cpp index bd9b549e99..0d2069cd99 100644 --- a/core/fxge/android/fpf_skiafont.cpp +++ b/core/fxge/android/fpf_skiafont.cpp @@ -12,7 +12,7 @@ #include "core/fxge/android/fpf_skiafont.h" #include "core/fxge/android/fpf_skiafontmgr.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" #define FPF_EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) diff --git a/core/fxge/android/fpf_skiafont.h b/core/fxge/android/fpf_skiafont.h index 9e35c942d3..c21bdeadc4 100644 --- a/core/fxge/android/fpf_skiafont.h +++ b/core/fxge/android/fpf_skiafont.h @@ -11,8 +11,8 @@ #if _FX_OS_ == _FX_ANDROID_ -#include "core/include/fxge/fpf.h" -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fpf.h" +#include "core/fxge/include/fx_font.h" class CFPF_SkiaFontDescriptor; class CFPF_SkiaFontMgr; diff --git a/core/fxge/android/fpf_skiafontmgr.cpp b/core/fxge/android/fpf_skiafontmgr.cpp index 7d0d2de9e2..b7bc27acdf 100644 --- a/core/fxge/android/fpf_skiafontmgr.cpp +++ b/core/fxge/android/fpf_skiafontmgr.cpp @@ -16,7 +16,7 @@ #include "core/fxcrt/include/fx_ext.h" #include "core/fxge/android/fpf_skiafont.h" #include "core/fxge/android/fpf_skiafontmgr.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" #ifdef __cplusplus extern "C" { diff --git a/core/fxge/android/fpf_skiafontmgr.h b/core/fxge/android/fpf_skiafontmgr.h index 5ed409cccc..e939a55cb9 100644 --- a/core/fxge/android/fpf_skiafontmgr.h +++ b/core/fxge/android/fpf_skiafontmgr.h @@ -14,8 +14,8 @@ #include #include -#include "core/include/fxge/fpf.h" -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fpf.h" +#include "core/fxge/include/fx_font.h" #define FPF_SKIAFONTTYPE_Unknown 0 #define FPF_SKIAFONTTYPE_Path 1 diff --git a/core/fxge/android/fpf_skiamodule.h b/core/fxge/android/fpf_skiamodule.h index a95c974b5d..95748493c7 100644 --- a/core/fxge/android/fpf_skiamodule.h +++ b/core/fxge/android/fpf_skiamodule.h @@ -9,7 +9,7 @@ #if _FX_OS_ == _FX_ANDROID_ -#include "core/include/fxge/fpf.h" +#include "core/fxge/include/fpf.h" class CFPF_SkiaFontMgr; diff --git a/core/fxge/android/fx_android_font.cpp b/core/fxge/android/fx_android_font.cpp index d663ac0f4f..6554c66a13 100644 --- a/core/fxge/android/fx_android_font.cpp +++ b/core/fxge/android/fx_android_font.cpp @@ -9,7 +9,7 @@ #if _FX_OS_ == _FX_ANDROID_ #include "core/fxge/android/fx_android_font.h" -#include "core/include/fxge/fpf.h" +#include "core/fxge/include/fpf.h" CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(NULL) {} FX_BOOL CFX_AndroidFontInfo::Init(IFPF_FontMgr* pFontMgr) { diff --git a/core/fxge/android/fx_android_font.h b/core/fxge/android/fx_android_font.h index ee8859185e..6268c3ed7b 100644 --- a/core/fxge/android/fx_android_font.h +++ b/core/fxge/android/fx_android_font.h @@ -11,7 +11,7 @@ #if _FX_OS_ == _FX_ANDROID_ -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fx_font.h" class IFPF_FontMgr; diff --git a/core/fxge/android/fx_android_imp.cpp b/core/fxge/android/fx_android_imp.cpp index 3fac3706cf..e508183fd8 100644 --- a/core/fxge/android/fx_android_imp.cpp +++ b/core/fxge/android/fx_android_imp.cpp @@ -9,8 +9,8 @@ #if _FX_OS_ == _FX_ANDROID_ #include "core/fxge/android/fx_android_font.h" -#include "core/include/fxge/fpf.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fpf.h" +#include "core/fxge/include/fx_ge.h" void CFX_GEModule::InitPlatform() { IFPF_DeviceModule* pDeviceModule = FPF_GetDeviceModule(); diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index c6c8f6ac92..02754cc309 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -11,7 +11,7 @@ #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_MACOSX_ #include diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index b68d50eab3..e45b238cb5 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -13,8 +13,8 @@ #include "core/fxge/apple/apple_int.h" #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/fx_text_int.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge_apple.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge_apple.h" void CFX_AggDeviceDriver::InitPlatform() { CQuartz2D& quartz2d = diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index db9f802d64..aae3f71b39 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxge/apple/apple_int.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_MACOSX_ static const struct { diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 5386aba2d8..f3a4428ecc 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -8,12 +8,12 @@ #include "core/fxge/agg/fx_agg_driver.h" #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/fx_text_int.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ #include "core/fxge/apple/apple_int.h" -#include "core/include/fxge/fx_ge_apple.h" +#include "core/fxge/include/fx_ge_apple.h" #ifndef CGFLOAT_IS_DOUBLE #error Expected CGFLOAT_IS_DOUBLE to be defined by CoreGraphics headers #endif diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h index 1d2193e9bb..23dd0babba 100644 --- a/core/fxge/dib/dib_int.h +++ b/core/fxge/dib/dib_int.h @@ -10,7 +10,7 @@ #include #include "core/fxcrt/include/fx_coordinates.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class IFX_ScanlineComposer; diff --git a/core/fxge/dib/fx_dib_composite.cpp b/core/fxge/dib/fx_dib_composite.cpp index b10180deae..8b0b97c049 100644 --- a/core/fxge/dib/fx_dib_composite.cpp +++ b/core/fxge/dib/fx_dib_composite.cpp @@ -5,8 +5,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxge/dib/dib_int.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_ge.h" const uint8_t _color_sqrt[256] = { 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp index d9d5a3b0c0..5ed655afe2 100644 --- a/core/fxge/dib/fx_dib_convert.cpp +++ b/core/fxge/dib/fx_dib_convert.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_ge.h" class CFX_Palette { public: diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index a68583b346..349213e421 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -7,8 +7,8 @@ #include #include "core/fxge/dib/dib_int.h" -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_ge.h" void CWeightTable::Calc(int dest_len, int dest_min, diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index 3772459eca..3c500ecb53 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -4,13 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include #include "core/fxge/dib/dib_int.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_ge.h" FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index 91c65fbbc8..18adcea5d2 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -6,7 +6,7 @@ #include "core/fxge/dib/dib_int.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" namespace { diff --git a/core/fxge/freetype/fx_freetype.cpp b/core/fxge/freetype/fx_freetype.cpp index 2fc60e913e..f60d0c64d0 100644 --- a/core/fxge/freetype/fx_freetype.cpp +++ b/core/fxge/freetype/fx_freetype.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_freetype.h" #include "third_party/freetype/src/psnames/pstables.h" diff --git a/core/fxge/ge/fx_ge.cpp b/core/fxge/ge/fx_ge.cpp index 7ae9942dec..9e45dc7434 100644 --- a/core/fxge/ge/fx_ge.cpp +++ b/core/fxge/ge/fx_ge.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "core/fxge/ge/fx_text_int.h" diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp index d791859b03..0d6addab75 100644 --- a/core/fxge/ge/fx_ge_device.cpp +++ b/core/fxge/ge/fx_ge_device.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" CFX_RenderDevice::CFX_RenderDevice() { m_pDeviceDriver = NULL; diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp index fab5ea28a9..144228ff28 100644 --- a/core/fxge/ge/fx_ge_font.cpp +++ b/core/fxge/ge/fx_ge_font.cpp @@ -6,8 +6,8 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fxge/ge/fx_text_int.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" #define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp index c6b208c624..e3a6d68d0d 100644 --- a/core/fxge/ge/fx_ge_fontmap.cpp +++ b/core/fxge/ge/fx_ge_fontmap.cpp @@ -10,8 +10,8 @@ #include "core/fxge/fontdata/chromefontdata/chromefontdata.h" #include "core/fxge/ge/fx_text_int.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" #include "third_party/base/stl_util.h" #define GET_TT_SHORT(w) (uint16_t)(((w)[0] << 8) | (w)[1]) diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp index af731f78da..0bd67b01be 100644 --- a/core/fxge/ge/fx_ge_linux.cpp +++ b/core/fxge/ge/fx_ge_linux.cpp @@ -6,7 +6,7 @@ #include "core/fxge/agg/fx_agg_driver.h" #include "core/fxge/ge/fx_text_int.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ class CFX_LinuxFontInfo : public CFX_FolderFontInfo { diff --git a/core/fxge/ge/fx_ge_path.cpp b/core/fxge/ge/fx_ge_path.cpp index 90793c4746..baa391fef2 100644 --- a/core/fxge/ge/fx_ge_path.cpp +++ b/core/fxge/ge/fx_ge_path.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "third_party/base/numerics/safe_math.h" CFX_ClipRgn::CFX_ClipRgn(int width, int height) { diff --git a/core/fxge/ge/fx_ge_ps.cpp b/core/fxge/ge/fx_ge_ps.cpp index ec8f18e774..0d8ccbf566 100644 --- a/core/fxge/ge/fx_ge_ps.cpp +++ b/core/fxge/ge/fx_ge_ps.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "core/fxge/ge/fx_text_int.h" #include "core/include/fxcodec/fx_codec.h" diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index 0815bfaa67..78d1c15687 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -5,9 +5,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxge/ge/fx_text_int.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" #ifdef _SKIA_SUPPORT_ #include "third_party/skia/include/core/SkStream.h" diff --git a/core/fxge/ge/fx_text_int.h b/core/fxge/ge/fx_text_int.h index 04587c37cb..c3e9cd7679 100644 --- a/core/fxge/ge/fx_text_int.h +++ b/core/fxge/ge/fx_text_int.h @@ -9,8 +9,8 @@ #include -#include "core/include/fxge/fx_font.h" -#include "core/include/fxge/fx_freetype.h" +#include "core/fxge/include/fx_font.h" +#include "core/fxge/include/fx_freetype.h" struct _CFX_UniqueKeyGen { void Generate(int count, ...); diff --git a/core/fxge/include/fpf.h b/core/fxge/include/fpf.h new file mode 100644 index 0000000000..2d43e8da6f --- /dev/null +++ b/core/fxge/include/fpf.h @@ -0,0 +1,70 @@ +// Copyright 2014 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_INCLUDE_FPF_H_ +#define CORE_FXGE_INCLUDE_FPF_H_ + +#include "core/fxcrt/include/fx_coordinates.h" + +class IFPF_FontMgr; + +class IFPF_DeviceModule { + public: + virtual ~IFPF_DeviceModule() {} + virtual void Destroy() = 0; + virtual IFPF_FontMgr* GetFontMgr() = 0; +}; + +IFPF_DeviceModule* FPF_GetDeviceModule(); + +#define FPF_MATCHFONT_REPLACEANSI 1 + +typedef struct FPF_HFONT_ { void* pData; } * FPF_HFONT; + +class IFPF_Font { + public: + virtual void Release() = 0; + virtual IFPF_Font* Retain() = 0; + virtual FPF_HFONT GetHandle() = 0; + virtual CFX_ByteString GetFamilyName() = 0; + virtual CFX_WideString GetPsName() = 0; + virtual uint32_t GetFontStyle() const = 0; + virtual uint8_t GetCharset() const = 0; + + virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0; + virtual int32_t GetGlyphWidth(int32_t iGlyphIndex) = 0; + + virtual int32_t GetAscent() const = 0; + virtual int32_t GetDescent() const = 0; + + virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) = 0; + virtual FX_BOOL GetBBox(FX_RECT& rtBBox) = 0; + + virtual int32_t GetHeight() const = 0; + virtual int32_t GetItalicAngle() const = 0; + virtual uint32_t GetFontData(uint32_t dwTable, + uint8_t* pBuffer, + uint32_t dwSize) = 0; + + protected: + virtual ~IFPF_Font() {} +}; + +class IFPF_FontMgr { + public: + virtual ~IFPF_FontMgr() {} + virtual void LoadSystemFonts() = 0; + virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0; + virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName) = 0; + virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer) = 0; + + virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, + uint8_t charset, + uint32_t dwStyle, + uint32_t dwMatch = 0) = 0; +}; + +#endif // CORE_FXGE_INCLUDE_FPF_H_ diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h new file mode 100644 index 0000000000..4a9b29533a --- /dev/null +++ b/core/fxge/include/fx_dib.h @@ -0,0 +1,669 @@ +// Copyright 2014 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_INCLUDE_FX_DIB_H_ +#define CORE_FXGE_INCLUDE_FX_DIB_H_ + +#include "core/fxcrt/include/fx_basic.h" +#include "core/fxcrt/include/fx_coordinates.h" + +enum FXDIB_Format { + FXDIB_Invalid = 0, + FXDIB_1bppMask = 0x101, + FXDIB_1bppRgb = 0x001, + FXDIB_1bppCmyk = 0x401, + FXDIB_8bppMask = 0x108, + FXDIB_8bppRgb = 0x008, + FXDIB_8bppRgba = 0x208, + FXDIB_8bppCmyk = 0x408, + FXDIB_8bppCmyka = 0x608, + FXDIB_Rgb = 0x018, + FXDIB_Rgba = 0x218, + FXDIB_Rgb32 = 0x020, + FXDIB_Argb = 0x220, + FXDIB_Cmyk = 0x420, + FXDIB_Cmyka = 0x620, +}; +enum FXDIB_Channel { + FXDIB_Red = 1, + FXDIB_Green, + FXDIB_Blue, + FXDIB_Cyan, + FXDIB_Magenta, + FXDIB_Yellow, + FXDIB_Black, + FXDIB_Alpha +}; +#define FXDIB_DOWNSAMPLE 0x04 +#define FXDIB_INTERPOL 0x20 +#define FXDIB_BICUBIC_INTERPOL 0x80 +#define FXDIB_NOSMOOTH 0x100 +#define FXDIB_BLEND_NORMAL 0 +#define FXDIB_BLEND_MULTIPLY 1 +#define FXDIB_BLEND_SCREEN 2 +#define FXDIB_BLEND_OVERLAY 3 +#define FXDIB_BLEND_DARKEN 4 +#define FXDIB_BLEND_LIGHTEN 5 + +#define FXDIB_BLEND_COLORDODGE 6 +#define FXDIB_BLEND_COLORBURN 7 +#define FXDIB_BLEND_HARDLIGHT 8 +#define FXDIB_BLEND_SOFTLIGHT 9 +#define FXDIB_BLEND_DIFFERENCE 10 +#define FXDIB_BLEND_EXCLUSION 11 +#define FXDIB_BLEND_NONSEPARABLE 21 +#define FXDIB_BLEND_HUE 21 +#define FXDIB_BLEND_SATURATION 22 +#define FXDIB_BLEND_COLOR 23 +#define FXDIB_BLEND_LUMINOSITY 24 +#define FXDIB_BLEND_UNSUPPORTED -1 +typedef uint32_t FX_ARGB; +typedef uint32_t FX_COLORREF; +typedef uint32_t FX_CMYK; +class CFX_ClipRgn; +class CFX_DIBSource; +class CFX_DIBitmap; +class CStretchEngine; + +#define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) +#define FXSYS_GetRValue(rgb) ((rgb)&0xff) +#define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) +#define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) +#define FX_CCOLOR(val) (255 - (val)) +#define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) +#define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) +#define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) +#define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff) +#define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk)&0xff) +void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); +inline FX_CMYK CmykEncode(int c, int m, int y, int k) { + return (c << 24) | (m << 16) | (y << 8) | k; +} +void ArgbDecode(FX_ARGB argb, int& a, int& r, int& g, int& b); +void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); +inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { + return (a << 24) | (r << 16) | (g << 8) | b; +} +FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); +#define FXARGB_A(argb) ((uint8_t)((argb) >> 24)) +#define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) +#define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) +#define FXARGB_B(argb) ((uint8_t)(argb)) +#define FXARGB_MAKE(a, r, g, b) \ + (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) +#define FXARGB_MUL_ALPHA(argb, alpha) \ + (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) +#define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) +#define FXCMYK2GRAY(c, m, y, k) \ + (((255 - (c)) * (255 - (k)) * 30 + (255 - (m)) * (255 - (k)) * 59 + \ + (255 - (y)) * (255 - (k)) * 11) / \ + 25500) +#define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) \ + (((backdrop) * (255 - (source_alpha)) + (source) * (source_alpha)) / 255) +#define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) +#define FXCMYK_GETDIB(p) \ + ((((uint8_t*)(p))[0] << 24 | (((uint8_t*)(p))[1] << 16) | \ + (((uint8_t*)(p))[2] << 8) | ((uint8_t*)(p))[3])) +#define FXCMYK_SETDIB(p, cmyk) ((uint8_t*)(p))[0] = (uint8_t)((cmyk) >> 24), \ + ((uint8_t*)(p))[1] = (uint8_t)((cmyk) >> 16), \ + ((uint8_t*)(p))[2] = (uint8_t)((cmyk) >> 8), \ + ((uint8_t*)(p))[3] = (uint8_t)(cmyk)) +#define FXARGB_GETDIB(p) \ + ((((uint8_t*)(p))[0]) | (((uint8_t*)(p))[1] << 8) | \ + (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[3] << 24)) +#define FXARGB_SETDIB(p, argb) \ + ((uint8_t*)(p))[0] = (uint8_t)(argb), \ + ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ + ((uint8_t*)(p))[2] = (uint8_t)((argb) >> 16), \ + ((uint8_t*)(p))[3] = (uint8_t)((argb) >> 24) +#define FXARGB_COPY(dest, src) \ + *(uint8_t*)(dest) = *(uint8_t*)(src), \ + *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ + *((uint8_t*)(dest) + 2) = *((uint8_t*)(src) + 2), \ + *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3) +#define FXCMYK_COPY(dest, src) \ + *(uint8_t*)(dest) = *(uint8_t*)(src), \ + *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ + *((uint8_t*)(dest) + 2) = *((uint8_t*)(src) + 2), \ + *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3) +#define FXARGB_SETRGBORDERDIB(p, argb) \ + ((uint8_t*)(p))[3] = (uint8_t)(argb >> 24), \ + ((uint8_t*)(p))[0] = (uint8_t)((argb) >> 16), \ + ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ + ((uint8_t*)(p))[2] = (uint8_t)(argb) +#define FXARGB_GETRGBORDERDIB(p) \ + (((uint8_t*)(p))[2]) | (((uint8_t*)(p))[1] << 8) | \ + (((uint8_t*)(p))[0] << 16) | (((uint8_t*)(p))[3] << 24) +#define FXARGB_RGBORDERCOPY(dest, src) \ + *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3), \ + *(uint8_t*)(dest) = *((uint8_t*)(src) + 2), \ + *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ + *((uint8_t*)(dest) + 2) = *((uint8_t*)(src)) +#define FXARGB_TODIB(argb) (argb) +#define FXCMYK_TODIB(cmyk) \ + ((uint8_t)((cmyk) >> 24) | ((uint8_t)((cmyk) >> 16)) << 8 | \ + ((uint8_t)((cmyk) >> 8)) << 16 | ((uint8_t)(cmyk) << 24)) +#define FXARGB_TOBGRORDERDIB(argb) \ + ((uint8_t)(argb >> 16) | ((uint8_t)(argb >> 8)) << 8 | \ + ((uint8_t)(argb)) << 16 | ((uint8_t)(argb >> 24) << 24)) +#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8) +#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag) +#define FXGETFLAG_ALPHA_STROKE(flag) (uint8_t)((flag) >> 16) +#define FXSETFLAG_COLORTYPE(flag, val) \ + flag = (((val) << 8) | (flag & 0xffff00ff)) +#define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val) | (flag & 0xffffff00)) +#define FXSETFLAG_ALPHA_STROKE(flag, val) \ + flag = (((val) << 16) | (flag & 0xff00ffff)) + +class CFX_DIBSource { + public: + virtual ~CFX_DIBSource(); + + int GetWidth() const { return m_Width; } + int GetHeight() const { return m_Height; } + + FXDIB_Format GetFormat() const { + return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); + } + uint32_t GetPitch() const { return m_Pitch; } + uint32_t* GetPalette() const { return m_pPalette; } + + virtual uint8_t* GetBuffer() const; + virtual const uint8_t* GetScanline(int line) const = 0; + virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; + virtual void DownSampleScanline(int line, + uint8_t* dest_scan, + int dest_bpp, + int dest_width, + FX_BOOL bFlipX, + int clip_left, + int clip_width) const = 0; + + int GetBPP() const { return m_bpp; } + + // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format, + // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and + // IsOpaqueImage() below should never be able to return TRUE. + bool IsAlphaMask() const { return m_AlphaFlag == 1; } + bool HasAlpha() const { return !!(m_AlphaFlag & 2); } + bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); } + bool IsCmykImage() const { return !!(m_AlphaFlag & 4); } + + int GetPaletteSize() const { + return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); + } + + uint32_t GetPaletteEntry(int index) const; + + void SetPaletteEntry(int index, uint32_t color); + uint32_t GetPaletteArgb(int index) const { return GetPaletteEntry(index); } + void SetPaletteArgb(int index, uint32_t color) { + SetPaletteEntry(index, color); + } + + void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256); + + CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; + CFX_DIBitmap* CloneConvert(FXDIB_Format format, + const FX_RECT* pClip = NULL, + void* pIccTransform = NULL) const; + + CFX_DIBitmap* StretchTo(int dest_width, + int dest_height, + uint32_t flags = 0, + const FX_RECT* pClip = NULL) const; + CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix, + int& left, + int& top, + uint32_t flags = 0, + const FX_RECT* pClip = NULL) const; + + CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; + FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask, + const FX_RECT* pClip = NULL); + + CFX_DIBitmap* SwapXY(FX_BOOL bXFlip, + FX_BOOL bYFlip, + const FX_RECT* pClip = NULL) const; + + CFX_DIBitmap* FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const; + + void GetOverlapRect(int& dest_left, + int& dest_top, + int& width, + int& height, + int src_width, + int src_height, + int& src_left, + int& src_top, + const CFX_ClipRgn* pClipRgn); + + CFX_DIBitmap* m_pAlphaMask; + + protected: + CFX_DIBSource(); + + int m_Width; + int m_Height; + int m_bpp; + uint32_t m_AlphaFlag; + uint32_t m_Pitch; + uint32_t* m_pPalette; + + void BuildPalette(); + FX_BOOL BuildAlphaMask(); + int FindPalette(uint32_t color) const; + void GetPalette(uint32_t* pal, int alpha) const; +}; +class CFX_DIBitmap : public CFX_DIBSource { + public: + CFX_DIBitmap(); + explicit CFX_DIBitmap(const CFX_DIBitmap& src); + ~CFX_DIBitmap() override; + + FX_BOOL Create(int width, + int height, + FXDIB_Format format, + uint8_t* pBuffer = NULL, + int pitch = 0); + + FX_BOOL Copy(const CFX_DIBSource* pSrc); + + // CFX_DIBSource + uint8_t* GetBuffer() const override; + const uint8_t* GetScanline(int line) const override; + void DownSampleScanline(int line, + uint8_t* dest_scan, + int dest_bpp, + int dest_width, + FX_BOOL bFlipX, + int clip_left, + int clip_width) const override; + + void TakeOver(CFX_DIBitmap* pSrcBitmap); + + FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); + + void Clear(uint32_t color); + + uint32_t GetPixel(int x, int y) const; + + void SetPixel(int x, int y, uint32_t color); + + FX_BOOL LoadChannel(FXDIB_Channel destChannel, + const CFX_DIBSource* pSrcBitmap, + FXDIB_Channel srcChannel); + + FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value); + + FX_BOOL MultiplyAlpha(int alpha); + + FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask); + + FX_BOOL TransferBitmap(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top, + void* pIccTransform = NULL); + + FX_BOOL CompositeBitmap(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top, + int blend_type = FXDIB_BLEND_NORMAL, + const CFX_ClipRgn* pClipRgn = NULL, + FX_BOOL bRgbByteOrder = FALSE, + void* pIccTransform = NULL); + + FX_BOOL TransferMask(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pMask, + uint32_t color, + int src_left, + int src_top, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL CompositeMask(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pMask, + uint32_t color, + int src_left, + int src_top, + int blend_type = FXDIB_BLEND_NORMAL, + const CFX_ClipRgn* pClipRgn = NULL, + FX_BOOL bRgbByteOrder = FALSE, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL CompositeRect(int dest_left, + int dest_top, + int width, + int height, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor); + + FX_BOOL DitherFS(const uint32_t* pPalette, + int pal_size, + const FX_RECT* pRect = NULL); + + protected: + uint8_t* m_pBuffer; + + FX_BOOL m_bExtBuf; + + FX_BOOL GetGrayData(void* pIccTransform = NULL); +}; +class CFX_DIBExtractor { + public: + CFX_DIBExtractor(const CFX_DIBSource* pSrc); + + ~CFX_DIBExtractor(); + + operator CFX_DIBitmap*() { return m_pBitmap; } + + private: + CFX_DIBitmap* m_pBitmap; +}; + +typedef CFX_CountRef CFX_DIBitmapRef; +class CFX_FilteredDIB : public CFX_DIBSource { + public: + CFX_FilteredDIB(); + ~CFX_FilteredDIB() override; + + void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); + + virtual FXDIB_Format GetDestFormat() = 0; + + virtual uint32_t* GetDestPalette() = 0; + + virtual void TranslateScanline(uint8_t* dest_buf, + const uint8_t* src_buf) const = 0; + + virtual void TranslateDownSamples(uint8_t* dest_buf, + const uint8_t* src_buf, + int pixels, + int Bpp) const = 0; + + protected: + // CFX_DIBSource + const uint8_t* GetScanline(int line) const override; + void DownSampleScanline(int line, + uint8_t* dest_scan, + int dest_bpp, + int dest_width, + FX_BOOL bFlipX, + int clip_left, + int clip_width) const override; + + const CFX_DIBSource* m_pSrc; + + FX_BOOL m_bAutoDropSrc; + + uint8_t* m_pScanline; +}; + +class IFX_ScanlineComposer { + public: + virtual ~IFX_ScanlineComposer() {} + + virtual void ComposeScanline(int line, + const uint8_t* scanline, + const uint8_t* scan_extra_alpha = NULL) = 0; + + virtual FX_BOOL SetInfo(int width, + int height, + FXDIB_Format src_format, + uint32_t* pSrcPalette) = 0; +}; +class CFX_ScanlineCompositor { + public: + CFX_ScanlineCompositor(); + + ~CFX_ScanlineCompositor(); + + FX_BOOL Init(FXDIB_Format dest_format, + FXDIB_Format src_format, + int32_t width, + uint32_t* pSrcPalette, + uint32_t mask_color, + int blend_type, + FX_BOOL bClip, + FX_BOOL bRgbByteOrder = FALSE, + int alpha_flag = 0, + void* pIccTransform = NULL); + + void CompositeRgbBitmapLine(uint8_t* dest_scan, + const uint8_t* src_scan, + int width, + const uint8_t* clip_scan, + const uint8_t* src_extra_alpha = NULL, + uint8_t* dst_extra_alpha = NULL); + + void CompositePalBitmapLine(uint8_t* dest_scan, + const uint8_t* src_scan, + int src_left, + int width, + const uint8_t* clip_scan, + const uint8_t* src_extra_alpha = NULL, + uint8_t* dst_extra_alpha = NULL); + + void CompositeByteMaskLine(uint8_t* dest_scan, + const uint8_t* src_scan, + int width, + const uint8_t* clip_scan, + uint8_t* dst_extra_alpha = NULL); + + void CompositeBitMaskLine(uint8_t* dest_scan, + const uint8_t* src_scan, + int src_left, + int width, + const uint8_t* clip_scan, + uint8_t* dst_extra_alpha = NULL); + + protected: + int m_Transparency; + FXDIB_Format m_SrcFormat, m_DestFormat; + uint32_t* m_pSrcPalette; + + int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; + int m_BlendType; + void* m_pIccTransform; + uint8_t* m_pCacheScanline; + int m_CacheSize; + FX_BOOL m_bRgbByteOrder; +}; + +class CFX_BitmapComposer : public IFX_ScanlineComposer { + public: + CFX_BitmapComposer(); + ~CFX_BitmapComposer() override; + + void Compose(CFX_DIBitmap* pDest, + const CFX_ClipRgn* pClipRgn, + int bitmap_alpha, + uint32_t mask_color, + FX_RECT& dest_rect, + FX_BOOL bVertical, + FX_BOOL bFlipX, + FX_BOOL bFlipY, + FX_BOOL bRgbByteOrder = FALSE, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + // IFX_ScanlineComposer + FX_BOOL SetInfo(int width, + int height, + FXDIB_Format src_format, + uint32_t* pSrcPalette) override; + + void ComposeScanline(int line, + const uint8_t* scanline, + const uint8_t* scan_extra_alpha) override; + + protected: + void DoCompose(uint8_t* dest_scan, + const uint8_t* src_scan, + int dest_width, + const uint8_t* clip_scan, + const uint8_t* src_extra_alpha = NULL, + uint8_t* dst_extra_alpha = NULL); + CFX_DIBitmap* m_pBitmap; + const CFX_ClipRgn* m_pClipRgn; + FXDIB_Format m_SrcFormat; + int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; + uint32_t m_MaskColor; + const CFX_DIBitmap* m_pClipMask; + CFX_ScanlineCompositor m_Compositor; + FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; + int m_AlphaFlag; + void* m_pIccTransform; + FX_BOOL m_bRgbByteOrder; + int m_BlendType; + void ComposeScanlineV(int line, + const uint8_t* scanline, + const uint8_t* scan_extra_alpha = NULL); + uint8_t* m_pScanlineV; + uint8_t* m_pClipScanV; + uint8_t* m_pAddClipScan; + uint8_t* m_pScanlineAlphaV; +}; + +class CFX_BitmapStorer : public IFX_ScanlineComposer { + public: + CFX_BitmapStorer(); + ~CFX_BitmapStorer() override; + + // IFX_ScanlineComposer + void ComposeScanline(int line, + const uint8_t* scanline, + const uint8_t* scan_extra_alpha) override; + + FX_BOOL SetInfo(int width, + int height, + FXDIB_Format src_format, + uint32_t* pSrcPalette) override; + + CFX_DIBitmap* GetBitmap() { return m_pBitmap; } + + CFX_DIBitmap* Detach(); + + void Replace(CFX_DIBitmap* pBitmap); + + private: + CFX_DIBitmap* m_pBitmap; +}; + +class CFX_ImageStretcher { + public: + CFX_ImageStretcher(); + ~CFX_ImageStretcher(); + + FX_BOOL Start(IFX_ScanlineComposer* pDest, + const CFX_DIBSource* pBitmap, + int dest_width, + int dest_height, + const FX_RECT& bitmap_rect, + uint32_t flags); + + FX_BOOL Continue(IFX_Pause* pPause); + FX_BOOL StartQuickStretch(); + FX_BOOL StartStretch(); + FX_BOOL ContinueQuickStretch(IFX_Pause* pPause); + FX_BOOL ContinueStretch(IFX_Pause* pPause); + + IFX_ScanlineComposer* m_pDest; + const CFX_DIBSource* m_pSource; + CStretchEngine* m_pStretchEngine; + uint32_t m_Flags; + FX_BOOL m_bFlipX; + FX_BOOL m_bFlipY; + int m_DestWidth; + int m_DestHeight; + FX_RECT m_ClipRect; + int m_LineIndex; + int m_DestBPP; + uint8_t* m_pScanline; + uint8_t* m_pMaskScanline; + FXDIB_Format m_DestFormat; +}; +class CFX_ImageTransformer { + public: + CFX_ImageTransformer(); + ~CFX_ImageTransformer(); + + FX_BOOL Start(const CFX_DIBSource* pSrc, + const CFX_Matrix* pMatrix, + int flags, + const FX_RECT* pClip); + + FX_BOOL Continue(IFX_Pause* pPause); + + CFX_Matrix* m_pMatrix; + FX_RECT m_StretchClip; + int m_ResultLeft; + int m_ResultTop; + int m_ResultWidth; + int m_ResultHeight; + CFX_Matrix m_dest2stretch; + CFX_ImageStretcher m_Stretcher; + CFX_BitmapStorer m_Storer; + uint32_t m_Flags; + int m_Status; +}; +class CFX_ImageRenderer { + public: + CFX_ImageRenderer(); + ~CFX_ImageRenderer(); + + FX_BOOL Start(CFX_DIBitmap* pDevice, + const CFX_ClipRgn* pClipRgn, + const CFX_DIBSource* pSource, + int bitmap_alpha, + uint32_t mask_color, + const CFX_Matrix* pMatrix, + uint32_t dib_flags, + FX_BOOL bRgbByteOrder = FALSE, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + FX_BOOL Continue(IFX_Pause* pPause); + + protected: + CFX_DIBitmap* m_pDevice; + const CFX_ClipRgn* m_pClipRgn; + int m_BitmapAlpha; + uint32_t m_MaskColor; + CFX_Matrix m_Matrix; + CFX_ImageTransformer* m_pTransformer; + CFX_ImageStretcher m_Stretcher; + CFX_BitmapComposer m_Composer; + int m_Status; + FX_RECT m_ClipBox; + uint32_t m_Flags; + int m_AlphaFlag; + void* m_pIccTransform; + FX_BOOL m_bRgbByteOrder; + int m_BlendType; +}; + +#endif // CORE_FXGE_INCLUDE_FX_DIB_H_ diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h new file mode 100644 index 0000000000..aa59e0a5d4 --- /dev/null +++ b/core/fxge/include/fx_font.h @@ -0,0 +1,566 @@ +// Copyright 2014 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_INCLUDE_FX_FONT_H_ +#define CORE_FXGE_INCLUDE_FX_FONT_H_ + +#include +#include +#include + +#include "core/fxcrt/include/fx_system.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_freetype.h" + +typedef struct FT_FaceRec_* FXFT_Face; +typedef void* FXFT_Library; + +class CFX_FaceCache; +class CFX_FontFaceInfo; +class CFX_FontMapper; +class CFX_PathData; +class CFX_SizeGlyphCache; +class CFX_SubstFont; +class CTTFontDesc; +class IFX_SystemFontInfo; + +#ifdef _SKIA_SUPPORT_ +class SkTypeface; + +using CFX_TypeFace = SkTypeface; +#endif + +#define FXFONT_FIXED_PITCH 0x01 +#define FXFONT_SERIF 0x02 +#define FXFONT_SYMBOLIC 0x04 +#define FXFONT_SCRIPT 0x08 +#define FXFONT_ITALIC 0x40 +#define FXFONT_BOLD 0x40000 +#define FXFONT_USEEXTERNATTR 0x80000 +#define FXFONT_CIDFONT 0x100000 +#ifdef PDF_ENABLE_XFA +#define FXFONT_EXACTMATCH 0x80000000 +#endif // PDF_ENABLE_XFA +#define FXFONT_ANSI_CHARSET 0 +#define FXFONT_DEFAULT_CHARSET 1 +#define FXFONT_SYMBOL_CHARSET 2 +#define FXFONT_SHIFTJIS_CHARSET 128 +#define FXFONT_HANGEUL_CHARSET 129 +#define FXFONT_GB2312_CHARSET 134 +#define FXFONT_CHINESEBIG5_CHARSET 136 +#define FXFONT_THAI_CHARSET 222 +#define FXFONT_EASTEUROPE_CHARSET 238 +#define FXFONT_RUSSIAN_CHARSET 204 +#define FXFONT_GREEK_CHARSET 161 +#define FXFONT_TURKISH_CHARSET 162 +#define FXFONT_HEBREW_CHARSET 177 +#define FXFONT_ARABIC_CHARSET 178 +#define FXFONT_BALTIC_CHARSET 186 +#define FXFONT_FF_FIXEDPITCH 1 +#define FXFONT_FF_ROMAN (1 << 4) +#define FXFONT_FF_SCRIPT (4 << 4) +#define FXFONT_FW_NORMAL 400 +#define FXFONT_FW_BOLD 700 + +class CFX_Font { + public: + CFX_Font(); + ~CFX_Font(); + + void LoadSubst(const CFX_ByteString& face_name, + FX_BOOL bTrueType, + uint32_t flags, + int weight, + int italic_angle, + int CharsetCP, + FX_BOOL bVertical = FALSE); + FX_BOOL LoadEmbedded(const uint8_t* data, uint32_t size); + FXFT_Face GetFace() const { return m_Face; } + +#ifdef PDF_ENABLE_XFA + FX_BOOL LoadFile(IFX_FileRead* pFile, + int nFaceIndex = 0, + int* pFaceCount = NULL); + + FX_BOOL LoadClone(const CFX_Font* pFont); + CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } + void SetFace(FXFT_Face face) { m_Face = face; } + void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; } +#else // PDF_ENABLE_XFA + const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } +#endif // PDF_ENABLE_XFA + + CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width = 0); + int GetGlyphWidth(uint32_t glyph_index); + int GetAscent() const; + int GetDescent() const; + FX_BOOL GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox); + FX_BOOL IsItalic() const; + FX_BOOL IsBold() const; + FX_BOOL IsFixedWidth() const; + FX_BOOL IsVertical() const { return m_bVertical; } + CFX_WideString GetPsName() const; + CFX_ByteString GetFamilyName() const; + CFX_ByteString GetFaceName() const; + FX_BOOL IsTTFont() const; + FX_BOOL GetBBox(FX_RECT& bbox); + int GetHeight() const; + int GetULPos() const; + int GetULthickness() const; + int GetMaxAdvanceWidth() const; + FX_BOOL IsEmbedded() const { return m_bEmbedded; } + uint8_t* GetSubData() const { return m_pGsubData; } + void SetSubData(uint8_t* data) { m_pGsubData = data; } + void* GetPlatformFont() const { return m_pPlatformFont; } + void SetPlatformFont(void* font) { m_pPlatformFont = font; } + uint8_t* GetFontData() const { return m_pFontData; } + uint32_t GetSize() const { return m_dwSize; } + void AdjustMMParams(int glyph_index, int width, int weight); + + private: + void ReleasePlatformResource(); + void DeleteFace(); + + FXFT_Face m_Face; + CFX_SubstFont* m_pSubstFont; + uint8_t* m_pFontDataAllocation; + uint8_t* m_pFontData; + uint8_t* m_pGsubData; + uint32_t m_dwSize; + CFX_BinaryBuf m_OtfFontData; + void* m_hHandle; + void* m_pPlatformFont; + void* m_pPlatformFontCollection; + void* m_pDwFont; + FX_BOOL m_bDwLoaded; + FX_BOOL m_bEmbedded; + FX_BOOL m_bVertical; + +#ifdef PDF_ENABLE_XFA + + protected: + FX_BOOL m_bLogic; + void* m_pOwnedStream; + +#endif // PDF_ENABLE_XFA +}; + +#define ENCODING_INTERNAL 0 +#define ENCODING_UNICODE 1 + +#ifdef PDF_ENABLE_XFA +#define FXFM_ENC_TAG(a, b, c, d) \ + (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | \ + (uint32_t)(d)) +#define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) +#define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') +#define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') +#define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') +#define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') +#define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') +#define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's') +#define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a') +#define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B') +#define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E') +#define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C') +#define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1') +#define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2') +#define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n') +#endif // PDF_ENABLE_XFA + +class CFX_UnicodeEncoding { + public: + explicit CFX_UnicodeEncoding(CFX_Font* pFont); + virtual ~CFX_UnicodeEncoding(); + + virtual uint32_t GlyphFromCharCode(uint32_t charcode); + + protected: + // Unowned, not nullptr. + CFX_Font* m_pFont; +}; + +#ifdef PDF_ENABLE_XFA +class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding { + public: + CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID); + ~CFX_UnicodeEncodingEx() override; + + // CFX_UnicodeEncoding: + uint32_t GlyphFromCharCode(uint32_t charcode) override; + + uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; + + private: + uint32_t m_nEncodingID; +}; +CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx( + CFX_Font* pFont, + uint32_t nEncodingID = FXFM_ENCODING_NONE); +#endif // PDF_ENABLE_XFA + +#define FXFONT_SUBST_MM 0x01 +#define FXFONT_SUBST_GLYPHPATH 0x04 +#define FXFONT_SUBST_CLEARTYPE 0x08 +#define FXFONT_SUBST_TRANSFORM 0x10 +#define FXFONT_SUBST_NONSYMBOL 0x20 +#define FXFONT_SUBST_EXACT 0x40 +#define FXFONT_SUBST_STANDARD 0x80 + +class CFX_SubstFont { + public: + CFX_SubstFont(); + + void* m_ExtHandle; + + CFX_ByteString m_Family; + + int m_Charset; + + uint32_t m_SubstFlags; + + int m_Weight; + + int m_ItalicAngle; + + FX_BOOL m_bSubstOfCJK; + + int m_WeightCJK; + + FX_BOOL m_bItlicCJK; +}; +#define FX_FONT_FLAG_SERIF 0x01 +#define FX_FONT_FLAG_FIXEDPITCH 0x02 +#define FX_FONT_FLAG_ITALIC 0x04 +#define FX_FONT_FLAG_BOLD 0x08 +#define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 +#define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 +#define FX_FONT_FLAG_MULTIPLEMASTER 0x40 + +class CFX_FontMgr { + public: + CFX_FontMgr(); + ~CFX_FontMgr(); + + void InitFTLibrary(); + + FXFT_Face GetCachedFace(const CFX_ByteString& face_name, + int weight, + FX_BOOL bItalic, + uint8_t*& pFontData); + FXFT_Face AddCachedFace(const CFX_ByteString& face_name, + int weight, + FX_BOOL bItalic, + uint8_t* pData, + uint32_t size, + int face_index); + FXFT_Face GetCachedTTCFace(int ttc_size, + uint32_t checksum, + int font_offset, + uint8_t*& pFontData); + FXFT_Face AddCachedTTCFace(int ttc_size, + uint32_t checksum, + uint8_t* pData, + uint32_t size, + int font_offset); + FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); + FXFT_Face GetFixedFace(const uint8_t* pData, uint32_t size, int face_index); + void ReleaseFace(FXFT_Face face); + void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); + FXFT_Face FindSubstFont(const CFX_ByteString& face_name, + FX_BOOL bTrueType, + uint32_t flags, + int weight, + int italic_angle, + int CharsetCP, + CFX_SubstFont* pSubstFont); + bool GetBuiltinFont(size_t index, const uint8_t** pFontData, uint32_t* size); + CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); } + FXFT_Library GetFTLibrary() const { return m_FTLibrary; } + + private: + std::unique_ptr m_pBuiltinMapper; + std::map m_FaceMap; + FXFT_Library m_FTLibrary; +}; + +class IFX_FontEnumerator { + public: + virtual void HitFont() = 0; + + virtual void Finish() = 0; + + protected: + virtual ~IFX_FontEnumerator() {} +}; + +class IFX_AdditionalFontEnum { + public: + virtual int CountFiles() = 0; + virtual IFX_FileStream* GetFontFile(int index) = 0; + + protected: + virtual ~IFX_AdditionalFontEnum() {} +}; + +class CFX_FontMapper { + public: + explicit CFX_FontMapper(CFX_FontMgr* mgr); + ~CFX_FontMapper(); + + void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); + IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; } + void AddInstalledFont(const CFX_ByteString& name, int charset); + void LoadInstalledFonts(); + std::vector m_InstalledTTFonts; + void SetFontEnumerator(IFX_FontEnumerator* pFontEnumerator) { + m_pFontEnumerator = pFontEnumerator; + } + IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; } + FXFT_Face FindSubstFont(const CFX_ByteString& face_name, + FX_BOOL bTrueType, + uint32_t flags, + int weight, + int italic_angle, + int CharsetCP, + CFX_SubstFont* pSubstFont); +#ifdef PDF_ENABLE_XFA + FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, + uint32_t flags, + int weight, + int italic_angle); +#endif // PDF_ENABLE_XFA + FX_BOOL IsBuiltinFace(const FXFT_Face face) const; + int GetFaceSize() const; + CFX_ByteString GetFaceName(int index) const { return m_FaceArray[index]; } + + private: + static const size_t MM_FACE_COUNT = 2; + static const size_t FOXIT_FACE_COUNT = 14; + + CFX_ByteString GetPSNameFromTT(void* hFont); + CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); + FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, + int iBaseFont, + int italic_angle, + int weight, + int picthfamily); + + FX_BOOL m_bListLoaded; + FXFT_Face m_MMFaces[MM_FACE_COUNT]; + CFX_ByteString m_LastFamily; + CFX_ArrayTemplate m_CharsetArray; + std::vector m_FaceArray; + IFX_SystemFontInfo* m_pFontInfo; + FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; + IFX_FontEnumerator* m_pFontEnumerator; + CFX_FontMgr* const m_pFontMgr; +}; + +class IFX_SystemFontInfo { + public: + static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); + virtual void Release() = 0; + + virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; + virtual void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* face, + int& iExact) = 0; + +#ifdef PDF_ENABLE_XFA + virtual void* MapFontByUnicode(uint32_t dwUnicode, + int weight, + FX_BOOL bItalic, + int pitch_family); +#endif // PDF_ENABLE_XFA + + virtual void* GetFont(const FX_CHAR* face) = 0; + virtual uint32_t GetFontData(void* hFont, + uint32_t table, + uint8_t* buffer, + uint32_t size) = 0; + virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; + virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; + virtual int GetFaceIndex(void* hFont); + virtual void DeleteFont(void* hFont) = 0; + virtual void* RetainFont(void* hFont); + + protected: + virtual ~IFX_SystemFontInfo() {} +}; + +class CFX_FolderFontInfo : public IFX_SystemFontInfo { + public: + CFX_FolderFontInfo(); + ~CFX_FolderFontInfo() override; + void AddPath(const CFX_ByteStringC& path); + + // IFX_SytemFontInfo: + void Release() override; + FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; + void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* face, + int& bExact) override; +#ifdef PDF_ENABLE_XFA + void* MapFontByUnicode(uint32_t dwUnicode, + int weight, + FX_BOOL bItalic, + int pitch_family) override; +#endif // PDF_ENABLE_XFA + void* GetFont(const FX_CHAR* face) override; + uint32_t GetFontData(void* hFont, + uint32_t table, + uint8_t* buffer, + uint32_t size) override; + void DeleteFont(void* hFont) override; + FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; + FX_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, + uint32_t filesize, + uint32_t offset); + void* GetSubstFont(const CFX_ByteString& face); + void* FindFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* family, + FX_BOOL bMatchName); + + std::map m_FontList; + std::vector m_PathList; + CFX_FontMapper* m_pMapper; +}; + +class CFX_CountedFaceCache { + public: + CFX_FaceCache* m_Obj; + uint32_t m_nCount; +}; + +class CFX_FontCache { + public: + CFX_FontCache(); + ~CFX_FontCache(); + CFX_FaceCache* GetCachedFace(CFX_Font* pFont); + void ReleaseCachedFace(CFX_Font* pFont); + void FreeCache(FX_BOOL bRelease = FALSE); +#ifdef _SKIA_SUPPORT_ + CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); +#endif + + private: + using CFX_FTCacheMap = std::map; + CFX_FTCacheMap m_FTFaceMap; + CFX_FTCacheMap m_ExtFaceMap; +}; + +class CFX_AutoFontCache { + public: + CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) + : m_pFontCache(pFontCache), m_pFont(pFont) {} + ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } + CFX_FontCache* m_pFontCache; + CFX_Font* m_pFont; +}; +#define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ + CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) +class CFX_GlyphBitmap { + public: + int m_Top; + int m_Left; + CFX_DIBitmap m_Bitmap; +}; +class CFX_FaceCache { + public: + explicit CFX_FaceCache(FXFT_Face face); + ~CFX_FaceCache(); + const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, + uint32_t glyph_index, + FX_BOOL bFontStyle, + const CFX_Matrix* pMatrix, + int dest_width, + int anti_alias, + int& text_flags); + const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, + uint32_t glyph_index, + int dest_width); + +#ifdef _SKIA_SUPPORT_ + CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); +#endif + + private: + CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, + uint32_t glyph_index, + FX_BOOL bFontStyle, + const CFX_Matrix* pMatrix, + int dest_width, + int anti_alias); + CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, + uint32_t glyph_index, + const CFX_Matrix* pMatrix, + int dest_width, + int anti_alias); + CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, + const CFX_Matrix* pMatrix, + CFX_ByteStringC& FaceGlyphsKey, + uint32_t glyph_index, + FX_BOOL bFontStyle, + int dest_width, + int anti_alias); + void InitPlatform(); + void DestroyPlatform(); + + FXFT_Face const m_Face; + std::map m_SizeMap; + std::map m_PathMap; + CFX_DIBitmap* m_pBitmap; +#ifdef _SKIA_SUPPORT_ + CFX_TypeFace* m_pTypeface; +#endif +}; + +struct FXTEXT_GLYPHPOS { + const CFX_GlyphBitmap* m_pGlyph; + int m_OriginX; + int m_OriginY; + FX_FLOAT m_fOriginX; + FX_FLOAT m_fOriginY; +}; + +FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, + int nChars, + int anti_alias, + FX_FLOAT retinaScaleX = 1.0f, + FX_FLOAT retinaScaleY = 1.0f); + +class IFX_GSUBTable { + public: + static IFX_GSUBTable* Create(CFX_Font* pFont); + virtual FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) = 0; + + protected: + virtual ~IFX_GSUBTable() {} +}; + +CFX_ByteString GetNameFromTT(const uint8_t* name_table, + uint32_t name_table_size, + uint32_t name); + +int PDF_GetStandardFontName(CFX_ByteString* name); + +#endif // CORE_FXGE_INCLUDE_FX_FONT_H_ diff --git a/core/fxge/include/fx_freetype.h b/core/fxge/include/fx_freetype.h new file mode 100644 index 0000000000..533974dc2e --- /dev/null +++ b/core/fxge/include/fx_freetype.h @@ -0,0 +1,180 @@ +// Copyright 2014 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_INCLUDE_FX_FREETYPE_H_ +#define CORE_FXGE_INCLUDE_FX_FREETYPE_H_ + +#include +#include FT_FREETYPE_H +#include FT_GLYPH_H +#include FT_LCD_FILTER_H +#include FT_MULTIPLE_MASTERS_H +#include FT_OUTLINE_H +#include FT_TRUETYPE_TABLES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define FXFT_ENCODING_UNICODE FT_ENCODING_UNICODE +#define FXFT_ENCODING_ADOBE_STANDARD FT_ENCODING_ADOBE_STANDARD +#define FXFT_ENCODING_ADOBE_EXPERT FT_ENCODING_ADOBE_EXPERT +#define FXFT_ENCODING_ADOBE_LATIN_1 FT_ENCODING_ADOBE_LATIN_1 +#define FXFT_ENCODING_APPLE_ROMAN FT_ENCODING_APPLE_ROMAN +#define FXFT_ENCODING_ADOBE_CUSTOM FT_ENCODING_ADOBE_CUSTOM +#define FXFT_ENCODING_MS_SYMBOL FT_ENCODING_MS_SYMBOL +#define FXFT_ENCODING_GB2312 FT_ENCODING_GB2312 +#define FXFT_ENCODING_BIG5 FT_ENCODING_BIG5 +#define FXFT_ENCODING_SJIS FT_ENCODING_SJIS +#define FXFT_ENCODING_JOHAB FT_ENCODING_JOHAB +#define FXFT_ENCODING_WANSUNG FT_ENCODING_WANSUNG +#define FXFT_LOAD_NO_SCALE FT_LOAD_NO_SCALE +#define FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH \ + FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH +#define FXFT_RENDER_MODE_LCD FT_RENDER_MODE_LCD +#define FXFT_RENDER_MODE_MONO FT_RENDER_MODE_MONO +#define FXFT_RENDER_MODE_NORMAL FT_RENDER_MODE_NORMAL +#define FXFT_LOAD_IGNORE_TRANSFORM FT_LOAD_IGNORE_TRANSFORM +#define FXFT_LOAD_NO_BITMAP FT_LOAD_NO_BITMAP +#define FXFT_LOAD_NO_HINTING FT_LOAD_NO_HINTING +#define FXFT_PIXEL_MODE_MONO FT_PIXEL_MODE_MONO +#define FXFT_STYLE_FLAG_ITALIC FT_STYLE_FLAG_ITALIC +#define FXFT_STYLE_FLAG_BOLD FT_STYLE_FLAG_BOLD +#define FXFT_FACE_FLAG_SFNT FT_FACE_FLAG_SFNT +#define FXFT_FACE_FLAG_TRICKY (1L << 13) +typedef FT_MM_Var* FXFT_MM_Var; +typedef FT_Bitmap* FXFT_Bitmap; +#define FXFT_Matrix FT_Matrix +#define FXFT_Vector FT_Vector +#define FXFT_Outline_Funcs FT_Outline_Funcs +typedef FT_Open_Args FXFT_Open_Args; +typedef FT_StreamRec FXFT_StreamRec; +typedef FT_StreamRec* FXFT_Stream; +typedef FT_BBox FXFT_BBox; +typedef FT_Glyph FXFT_Glyph; +typedef FT_CharMap FXFT_CharMap; +#define FXFT_GLYPH_BBOX_PIXELS FT_GLYPH_BBOX_PIXELS +#define FXFT_Open_Face(library, args, index, face) \ + FT_Open_Face((FT_Library)(library), args, index, (FT_Face*)(face)) +#define FXFT_Done_Face(face) FT_Done_Face((FT_Face)(face)) +#define FXFT_Done_FreeType(library) FT_Done_FreeType((FT_Library)(library)) +#define FXFT_Init_FreeType(library) FT_Init_FreeType((FT_Library*)(library)) +#define FXFT_New_Memory_Face(library, base, size, index, face) \ + FT_New_Memory_Face((FT_Library)(library), base, size, index, (FT_Face*)(face)) +#define FXFT_New_Face(library, filename, index, face) \ + FT_New_Face((FT_Library)(library), filename, index, (FT_Face*)(face)) +#define FXFT_Get_Face_FreeType(face) ((FT_Face)face)->driver->root.library +#define FXFT_Select_Charmap(face, encoding) \ + FT_Select_Charmap((FT_Face)face, (FT_Encoding)encoding) +#define FXFT_Set_Charmap(face, charmap) \ + FT_Set_Charmap((FT_Face)face, (FT_CharMap)charmap) +#define FXFT_Load_Glyph(face, glyph_index, flags) \ + FT_Load_Glyph((FT_Face)face, glyph_index, flags) +#define FXFT_Get_Char_Index(face, code) FT_Get_Char_Index((FT_Face)face, code) +#define FXFT_Get_Glyph_Name(face, index, buffer, size) \ + FT_Get_Glyph_Name((FT_Face)face, index, buffer, size) +#define FXFT_Get_Name_Index(face, name) FT_Get_Name_Index((FT_Face)face, name) +#define FXFT_Has_Glyph_Names(face) \ + (((FT_Face)face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES) +#define FXFT_Get_Postscript_Name(face) FT_Get_Postscript_Name((FT_Face)face) +#define FXFT_Load_Sfnt_Table(face, tag, offset, buffer, length) \ + FT_Load_Sfnt_Table((FT_Face)face, tag, offset, buffer, length) +#define FXFT_Get_First_Char(face, glyph_index) \ + FT_Get_First_Char((FT_Face)face, glyph_index) +#define FXFT_Get_Next_Char(face, code, glyph_index) \ + FT_Get_Next_Char((FT_Face)face, code, glyph_index) +#define FXFT_Clear_Face_External_Stream(face) \ + (((FT_Face)face)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM) +#define FXFT_Get_Face_External_Stream(face) \ + (((FT_Face)face)->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM) +#define FXFT_Is_Face_TT_OT(face) \ + (((FT_Face)face)->face_flags & FT_FACE_FLAG_SFNT) +#define FXFT_Is_Face_Tricky(face) \ + (((FT_Face)face)->face_flags & FXFT_FACE_FLAG_TRICKY) +#define FXFT_Is_Face_fixedwidth(face) \ + (((FT_Face)face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH) +#define FXFT_Get_Face_Stream_Base(face) ((FT_Face)face)->stream->base +#define FXFT_Get_Face_Stream_Size(face) ((FT_Face)face)->stream->size +#define FXFT_Get_Face_Family_Name(face) ((FT_Face)face)->family_name +#define FXFT_Get_Face_Style_Name(face) ((FT_Face)face)->style_name +#define FXFT_Get_Face_Numfaces(face) ((FT_Face)face)->num_faces +#define FXFT_Get_Face_Faceindex(face) ((FT_Face)face)->face_index +#define FXFT_Is_Face_Italic(face) \ + (((FT_Face)face)->style_flags & FT_STYLE_FLAG_ITALIC) +#define FXFT_Is_Face_Bold(face) \ + (((FT_Face)face)->style_flags & FT_STYLE_FLAG_BOLD) +#define FXFT_Get_Face_Charmaps(face) ((FT_Face)face)->charmaps +#define FXFT_Get_Glyph_HoriBearingX(face) \ + ((FT_Face)face)->glyph->metrics.horiBearingX +#define FXFT_Get_Glyph_HoriBearingY(face) \ + ((FT_Face)face)->glyph->metrics.horiBearingY +#define FXFT_Get_Glyph_Width(face) ((FT_Face)face)->glyph->metrics.width +#define FXFT_Get_Glyph_Height(face) ((FT_Face)face)->glyph->metrics.height +#define FXFT_Get_Face_CharmapCount(face) ((FT_Face)face)->num_charmaps +#define FXFT_Get_Charmap_Encoding(charmap) ((FT_CharMap)charmap)->encoding +#define FXFT_Get_Face_Charmap(face) ((FT_Face)face)->charmap +#define FXFT_Get_Charmap_PlatformID(charmap) ((FT_CharMap)charmap)->platform_id +#define FXFT_Get_Charmap_EncodingID(charmap) ((FT_CharMap)charmap)->encoding_id +#define FXFT_Get_Face_UnitsPerEM(face) ((FT_Face)face)->units_per_EM +#define FXFT_Get_Face_xMin(face) ((FT_Face)face)->bbox.xMin +#define FXFT_Get_Face_xMax(face) ((FT_Face)face)->bbox.xMax +#define FXFT_Get_Face_yMin(face) ((FT_Face)face)->bbox.yMin +#define FXFT_Get_Face_yMax(face) ((FT_Face)face)->bbox.yMax +#define FXFT_Get_Face_Height(face) ((FT_Face)face)->height +#define FXFT_Get_Face_UnderLineThickness(face) \ + ((FT_Face)face)->underline_thickness +#define FXFT_Get_Face_UnderLinePosition(face) \ + ((FT_Face)face)->underline_position +#define FXFT_Get_Face_MaxAdvanceWidth(face) ((FT_Face)face)->max_advance_width +#define FXFT_Get_Face_Ascender(face) ((FT_Face)face)->ascender +#define FXFT_Get_Face_Descender(face) ((FT_Face)face)->descender +#define FXFT_Get_Glyph_HoriAdvance(face) \ + ((FT_Face)face)->glyph->metrics.horiAdvance +#define FXFT_Get_MM_Axis(var, index) &static_cast(var)->axis[index] +#define FXFT_Get_MM_Axis_Min(axis) ((FT_Var_Axis*)axis)->minimum +#define FXFT_Get_MM_Axis_Max(axis) ((FT_Var_Axis*)axis)->maximum +#define FXFT_Get_MM_Axis_Def(axis) ((FT_Var_Axis*)axis)->def +#define FXFT_Alloc(library, size) \ + ((FT_Library)library)->memory->alloc(((FT_Library)library)->memory, size) +#define FXFT_Free(face, p) \ + ((FT_Face)face)->memory->free(((FT_Face)face)->memory, p) +#define FXFT_Get_Glyph_Outline(face) &static_cast(face)->glyph->outline +#define FXFT_Get_Outline_Bbox(outline, cbox) FT_Outline_Get_CBox(outline, cbox) +#define FXFT_Render_Glyph(face, mode) \ + FT_Render_Glyph(((FT_Face)face)->glyph, (enum FT_Render_Mode_)mode) +#define FXFT_Get_MM_Var(face, p) FT_Get_MM_Var((FT_Face)face, p) +#define FXFT_Set_MM_Design_Coordinates(face, n, p) \ + FT_Set_MM_Design_Coordinates((FT_Face)face, n, p) +#define FXFT_Set_Pixel_Sizes(face, w, h) FT_Set_Pixel_Sizes((FT_Face)face, w, h) +#define FXFT_Set_Transform(face, m, d) FT_Set_Transform((FT_Face)face, m, d) +#define FXFT_Outline_Embolden(outline, s) FT_Outline_Embolden(outline, s) +#define FXFT_Get_Glyph_Bitmap(face) &static_cast(face)->glyph->bitmap +#define FXFT_Get_Bitmap_Width(bitmap) ((FT_Bitmap*)bitmap)->width +#define FXFT_Get_Bitmap_Rows(bitmap) ((FT_Bitmap*)bitmap)->rows +#define FXFT_Get_Bitmap_PixelMode(bitmap) ((FT_Bitmap*)bitmap)->pixel_mode +#define FXFT_Get_Bitmap_Pitch(bitmap) ((FT_Bitmap*)bitmap)->pitch +#define FXFT_Get_Bitmap_Buffer(bitmap) ((FT_Bitmap*)bitmap)->buffer +#define FXFT_Get_Glyph_BitmapLeft(face) ((FT_Face)face)->glyph->bitmap_left +#define FXFT_Get_Glyph_BitmapTop(face) ((FT_Face)face)->glyph->bitmap_top +#define FXFT_Outline_Decompose(outline, funcs, params) \ + FT_Outline_Decompose(outline, funcs, params) +#define FXFT_Set_Char_Size(face, char_width, char_height, horz_resolution, \ + vert_resolution) \ + FT_Set_Char_Size(face, char_width, char_height, horz_resolution, \ + vert_resolution) +#define FXFT_Get_Glyph(slot, aglyph) FT_Get_Glyph(slot, aglyph) +#define FXFT_Glyph_Get_CBox(glyph, bbox_mode, acbox) \ + FT_Glyph_Get_CBox(glyph, bbox_mode, acbox) +#define FXFT_Done_Glyph(glyph) FT_Done_Glyph(glyph) +#define FXFT_Library_SetLcdFilter(library, filter) \ + FT_Library_SetLcdFilter((FT_Library)(library), filter) +int FXFT_unicode_from_adobe_name(const char* glyph_name); +void FXFT_adobe_name_from_unicode(char* name, wchar_t unicode); +#ifdef __cplusplus +}; +#endif + +#endif // CORE_FXGE_INCLUDE_FX_FREETYPE_H_ diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h new file mode 100644 index 0000000000..4530677119 --- /dev/null +++ b/core/fxge/include/fx_ge.h @@ -0,0 +1,733 @@ +// Copyright 2014 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_INCLUDE_FX_GE_H_ +#define CORE_FXGE_INCLUDE_FX_GE_H_ + +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_font.h" + +class CFX_Font; +class CFX_FontMgr; +class CFX_FontCache; +class CFX_FaceCache; +class CPDF_ShadingPattern; +class IFX_RenderDeviceDriver; +class CCodec_ModuleMgr; +class SkPictureRecorder; + +class CFX_GEModule { + public: + static void Create(const char** pUserFontPaths); + + static void Use(CFX_GEModule* pMgr); + + static CFX_GEModule* Get(); + + static void Destroy(); + + public: + CFX_FontCache* GetFontCache(); + CFX_FontMgr* GetFontMgr() { return m_pFontMgr; } + void SetTextGamma(FX_FLOAT gammaValue); + const uint8_t* GetTextGammaTable(); + + void SetCodecModule(CCodec_ModuleMgr* pCodecModule) { + m_pCodecModule = pCodecModule; + } + CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } + FXFT_Library m_FTLibrary; + void* GetPlatformData() { return m_pPlatformData; } + + protected: + explicit CFX_GEModule(const char** pUserFontPaths); + + ~CFX_GEModule(); + void InitPlatform(); + void DestroyPlatform(); + + private: + uint8_t m_GammaValue[256]; + CFX_FontCache* m_pFontCache; + CFX_FontMgr* m_pFontMgr; + CCodec_ModuleMgr* m_pCodecModule; + void* m_pPlatformData; + const char** m_pUserFontPaths; +}; +typedef struct { + FX_FLOAT m_PointX; + + FX_FLOAT m_PointY; + + int m_Flag; +} FX_PATHPOINT; +#define FXPT_CLOSEFIGURE 0x01 +#define FXPT_LINETO 0x02 +#define FXPT_BEZIERTO 0x04 +#define FXPT_MOVETO 0x06 +#define FXPT_TYPE 0x06 +#define FXFILL_ALTERNATE 1 +#define FXFILL_WINDING 2 +class CFX_ClipRgn { + public: + CFX_ClipRgn(int device_width, int device_height); + + CFX_ClipRgn(const FX_RECT& rect); + + CFX_ClipRgn(const CFX_ClipRgn& src); + + ~CFX_ClipRgn(); + + typedef enum { RectI, MaskF } ClipType; + + void Reset(const FX_RECT& rect); + + ClipType GetType() const { return m_Type; } + + const FX_RECT& GetBox() const { return m_Box; } + + CFX_DIBitmapRef GetMask() const { return m_Mask; } + + void IntersectRect(const FX_RECT& rect); + + void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask); + + protected: + ClipType m_Type; + + FX_RECT m_Box; + + CFX_DIBitmapRef m_Mask; + + void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); +}; +#define FX_GAMMA(value) (value) +#define FX_GAMMA_INVERSE(value) (value) +inline FX_ARGB ArgbGamma(FX_ARGB argb) { + return argb; +} +inline FX_ARGB ArgbGammaInverse(FX_ARGB argb) { + return argb; +} +class CFX_PathData { + public: + CFX_PathData(); + + CFX_PathData(const CFX_PathData& src); + + ~CFX_PathData(); + + int GetPointCount() const { return m_PointCount; } + + int GetFlag(int index) const { return m_pPoints[index].m_Flag; } + + FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; } + + FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; } + + FX_PATHPOINT* GetPoints() const { return m_pPoints; } + + void SetPointCount(int nPoints); + void AllocPointCount(int nPoints); + void AddPointCount(int addPoints); + + CFX_FloatRect GetBoundingBox() const; + + CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; + + void Transform(const CFX_Matrix* pMatrix); + + FX_BOOL IsRect() const; + + FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath, + CFX_Matrix* pMatrix, + FX_BOOL& bThin, + FX_BOOL bAdjust) const; + + FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const; + + void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix); + void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); + + void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag); + + void TrimPoints(int nPoints); + + void Copy(const CFX_PathData& src); + + protected: + friend class CPDF_Path; + + int m_PointCount; + + FX_PATHPOINT* m_pPoints; + + int m_AllocCount; +}; +class CFX_GraphStateData { + public: + CFX_GraphStateData(); + + CFX_GraphStateData(const CFX_GraphStateData& src); + + ~CFX_GraphStateData(); + + void Copy(const CFX_GraphStateData& src); + + void SetDashCount(int count); + + typedef enum { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 } LineCap; + LineCap m_LineCap; + int m_DashCount; + FX_FLOAT* m_DashArray; + FX_FLOAT m_DashPhase; + + typedef enum { + LineJoinMiter = 0, + LineJoinRound = 1, + LineJoinBevel = 2, + } LineJoin; + LineJoin m_LineJoin; + FX_FLOAT m_MiterLimit; + FX_FLOAT m_LineWidth; +}; +#define FXDC_DEVICE_CLASS 1 +#define FXDC_PIXEL_WIDTH 2 +#define FXDC_PIXEL_HEIGHT 3 +#define FXDC_BITS_PIXEL 4 +#define FXDC_HORZ_SIZE 5 +#define FXDC_VERT_SIZE 6 +#define FXDC_RENDER_CAPS 7 +#define FXDC_DITHER_BITS 8 +#define FXDC_DISPLAY 1 +#define FXDC_PRINTER 2 +#define FXRC_GET_BITS 0x01 +#define FXRC_BIT_MASK 0x02 +#define FXRC_ALPHA_MASK 0x04 +#define FXRC_ALPHA_PATH 0x10 +#define FXRC_ALPHA_IMAGE 0x20 +#define FXRC_ALPHA_OUTPUT 0x40 +#define FXRC_BLEND_MODE 0x80 +#define FXRC_SOFT_CLIP 0x100 +#define FXRC_CMYK_OUTPUT 0x200 +#define FXRC_BITMASK_OUTPUT 0x400 +#define FXRC_BYTEMASK_OUTPUT 0x800 +#define FXRENDER_IMAGE_LOSSY 0x1000 +#define FXRC_FILLSTROKE_PATH 0x2000 +#define FXRC_SHADING 0x4000 +#define FXFILL_ALTERNATE 1 +#define FXFILL_WINDING 2 +#define FXFILL_FULLCOVER 4 +#define FXFILL_RECT_AA 8 +#define FX_FILL_STROKE 16 +#define FX_STROKE_ADJUST 32 +#define FX_STROKE_TEXT_MODE 64 +#define FX_FILL_TEXT_MODE 128 +#define FX_ZEROAREA_FILL 256 +#define FXFILL_NOPATHSMOOTH 512 +#define FXTEXT_CLEARTYPE 0x01 +#define FXTEXT_BGR_STRIPE 0x02 +#define FXTEXT_PRINTGRAPHICTEXT 0x04 +#define FXTEXT_NO_NATIVETEXT 0x08 +#define FXTEXT_PRINTIMAGETEXT 0x10 +#define FXTEXT_NOSMOOTH 0x20 +typedef struct { + uint32_t m_GlyphIndex; + FX_FLOAT m_OriginX, m_OriginY; + int m_FontCharWidth; + FX_BOOL m_bGlyphAdjust; + FX_FLOAT m_AdjustMatrix[4]; + uint32_t m_ExtGID; + FX_BOOL m_bFontStyle; +} FXTEXT_CHARPOS; + +class CFX_RenderDevice { + public: + CFX_RenderDevice(); + virtual ~CFX_RenderDevice(); + + void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); + IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } + + FX_BOOL StartRendering(); + void EndRendering(); + void SaveState(); + void RestoreState(FX_BOOL bKeepSaved = FALSE); + + int GetWidth() const { return m_Width; } + int GetHeight() const { return m_Height; } + int GetDeviceClass() const { return m_DeviceClass; } + int GetBPP() const { return m_bpp; } + int GetRenderCaps() const { return m_RenderCaps; } + int GetDeviceCaps(int id) const; + CFX_Matrix GetCTM() const; + + CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } + void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } + + FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, + int width, + int height) const; + + const FX_RECT& GetClipBox() const { return m_ClipBox; } + + FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + int fill_mode); + + FX_BOOL SetClip_Rect(const FX_RECT& pRect); + FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState); + + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + FX_BOOL SetPixel(int x, + int y, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL FillRect(const FX_RECT* pRect, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + FX_BOOL DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int fill_mode = 0, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, + int left, + int top, + void* pIccTransform = NULL); + + CFX_DIBitmap* GetBackDrop(); + + FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + int left, + int top, + int blend_type = FXDIB_BLEND_NORMAL, + void* pIccTransform = NULL); + + FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t flags = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, + int left, + int top, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t color, + uint32_t flags = 0, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t flags, + void*& handle, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + + FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + + void CancelDIBits(void* handle); + + FX_BOOL DrawNormalText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + FX_FLOAT font_size, + const CFX_Matrix* pText2Device, + uint32_t fill_color, + uint32_t text_flags, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL DrawTextPath(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + FX_FLOAT font_size, + const CFX_Matrix* pText2User, + const CFX_Matrix* pUser2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + CFX_PathData* pClippingPath, + int nFlag = 0, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL); + virtual void Begin() {} + virtual void End() {} + + private: + void InitDeviceInfo(); + void UpdateClipBox(); + FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int alpha_flag, + void* pIccTransform, + int blend_type); + + CFX_DIBitmap* m_pBitmap; + int m_Width; + int m_Height; + int m_bpp; + int m_RenderCaps; + int m_DeviceClass; + FX_RECT m_ClipBox; + IFX_RenderDeviceDriver* m_pDeviceDriver; +}; + +class CFX_FxgeDevice : public CFX_RenderDevice { + public: + CFX_FxgeDevice(); + ~CFX_FxgeDevice() override; + + bool Attach(CFX_DIBitmap* pBitmap, + int dither_bits = 0, + bool bRgbByteOrder = false, + CFX_DIBitmap* pOriDevice = NULL, + bool bGroupKnockout = false); + + bool Create(int width, + int height, + FXDIB_Format format, + int dither_bits = 0, + CFX_DIBitmap* pOriDevice = NULL); + + protected: + bool m_bOwnedBitmap; +}; + +class CFX_SkiaDevice : public CFX_RenderDevice { + public: + CFX_SkiaDevice(); + ~CFX_SkiaDevice() override; + + FX_BOOL Attach(CFX_DIBitmap* pBitmap, + int dither_bits = 0, + FX_BOOL bRgbByteOrder = FALSE, + CFX_DIBitmap* pOriDevice = NULL, + FX_BOOL bGroupKnockout = FALSE); + + FX_BOOL AttachRecorder(SkPictureRecorder* recorder); + + FX_BOOL Create(int width, + int height, + FXDIB_Format format, + int dither_bits = 0, + CFX_DIBitmap* pOriDevice = NULL); + + SkPictureRecorder* CreateRecorder(int size_x, int size_y); + + protected: + FX_BOOL m_bOwnedBitmap; +}; + +class IFX_RenderDeviceDriver { + public: + static IFX_RenderDeviceDriver* CreateFxgeDriver( + CFX_DIBitmap* pBitmap, + FX_BOOL bRgbByteOrder = FALSE, + CFX_DIBitmap* pOriDevice = NULL, + FX_BOOL bGroupKnockout = FALSE); + + virtual ~IFX_RenderDeviceDriver() {} + virtual void Begin() {} + virtual void End() {} + + virtual int GetDeviceCaps(int caps_id) = 0; + + virtual CFX_Matrix GetCTM() const { return CFX_Matrix(); } + + virtual FX_BOOL IsPSPrintDriver() { return FALSE; } + + virtual FX_BOOL StartRendering() { return TRUE; } + + virtual void EndRendering() {} + + virtual void SaveState() = 0; + + virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) = 0; + + virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + int fill_mode) = 0; + + virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState) { + return FALSE; + } + + virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) = 0; + + virtual FX_BOOL SetPixel(int x, + int y, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL) { + return FALSE; + } + + virtual FX_BOOL FillRect(const FX_RECT* pRect, + uint32_t fill_color, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) { + return FALSE; + } + + virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) { + return FALSE; + } + + virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0; + + virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, + int left, + int top, + void* pIccTransform = NULL, + FX_BOOL bDEdge = FALSE) { + return FALSE; + } + virtual CFX_DIBitmap* GetBackDrop() { return NULL; } + + virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + const FX_RECT* pSrcRect, + int dest_left, + int dest_top, + int blend_type, + int alpha_flag = 0, + void* pIccTransform = NULL) = 0; + + virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) = 0; + + virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t flags, + void*& handle, + int alpha_flag = 0, + void* pIccTransform = NULL, + int blend_type = FXDIB_BLEND_NORMAL) = 0; + + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { + return FALSE; + } + + virtual void CancelDIBits(void* handle) {} + + virtual FX_BOOL DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL) { + return FALSE; + } + + virtual void* GetPlatformSurface() const { return NULL; } + virtual int GetDriverType() const { return 0; } + virtual void ClearDriver() {} + + virtual FX_BOOL DrawShading(CPDF_ShadingPattern* pPattern, + CFX_Matrix* pMatrix, + int alpha, + FX_BOOL bAlphaMode) { + return false; + } +}; + +class IFX_PSOutput { + public: + virtual void Release() = 0; + virtual void OutputPS(const FX_CHAR* str, int len) = 0; + + protected: + virtual ~IFX_PSOutput() {} +}; + +class CPSFont; +class CFX_PSRenderer { + public: + CFX_PSRenderer(); + + ~CFX_PSRenderer(); + + void Init(IFX_PSOutput* pOutput, + int ps_level, + int width, + int height, + FX_BOOL bCmykOutput); + FX_BOOL StartRendering(); + void EndRendering(); + + void SaveState(); + + void RestoreState(FX_BOOL bKeepSaved = FALSE); + + void SetClip_PathFill(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + int fill_mode); + + void SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState); + + FX_RECT GetClipBox() { return m_ClipBox; } + + FX_BOOL DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t flags, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL DrawDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t flags, + int alpha_flag = 0, + void* pIccTransform = NULL); + + FX_BOOL DrawText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + CFX_FontCache* pCache, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + uint32_t color, + int alpha_flag = 0, + void* pIccTransform = NULL); + + private: + IFX_PSOutput* m_pOutput; + + int m_PSLevel; + + CFX_GraphStateData m_CurGraphState; + + FX_BOOL m_bGraphStateSet; + + FX_BOOL m_bCmykOutput; + + FX_BOOL m_bColorSet; + + uint32_t m_LastColor; + + FX_RECT m_ClipBox; + + CFX_ArrayTemplate m_PSFontList; + + CFX_ArrayTemplate m_ClipBoxStack; + FX_BOOL m_bInited; + + void OutputPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device); + + void SetGraphState(const CFX_GraphStateData* pGraphState); + + void SetColor(uint32_t color, int alpha_flag, void* pIccTransform); + + void FindPSFontGlyph(CFX_FaceCache* pFaceCache, + CFX_Font* pFont, + const FXTEXT_CHARPOS& charpos, + int& ps_fontnum, + int& ps_glyphindex); + + void WritePSBinary(const uint8_t* data, int len); +}; + +#endif // CORE_FXGE_INCLUDE_FX_GE_H_ diff --git a/core/fxge/include/fx_ge_apple.h b/core/fxge/include/fx_ge_apple.h new file mode 100644 index 0000000000..57acef653c --- /dev/null +++ b/core/fxge/include/fx_ge_apple.h @@ -0,0 +1,27 @@ +// Copyright 2014 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_INCLUDE_FX_GE_APPLE_H_ +#define CORE_FXGE_INCLUDE_FX_GE_APPLE_H_ + +#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ +class CFX_QuartzDevice : public CFX_RenderDevice { + public: + CFX_QuartzDevice(); + ~CFX_QuartzDevice(); + FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY); + FX_BOOL Attach(CFX_DIBitmap* pBitmap); + FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format); + + CGContextRef GetContext(); + + protected: + CGContextRef m_pContext; + FX_BOOL m_bOwnedBitmap; +}; +#endif + +#endif // CORE_FXGE_INCLUDE_FX_GE_APPLE_H_ diff --git a/core/fxge/include/fx_ge_win32.h b/core/fxge/include/fx_ge_win32.h new file mode 100644 index 0000000000..b4337c117c --- /dev/null +++ b/core/fxge/include/fx_ge_win32.h @@ -0,0 +1,98 @@ +// Copyright 2014 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_INCLUDE_FX_GE_WIN32_H_ +#define CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ + +#ifdef _WIN32 +#ifndef _WINDOWS_ +#include +#endif +#define WINDIB_OPEN_MEMORY 0x1 +#define WINDIB_OPEN_PATHNAME 0x2 +typedef struct WINDIB_Open_Args_ { + int flags; + + const uint8_t* memory_base; + + size_t memory_size; + + const FX_WCHAR* path_name; +} WINDIB_Open_Args_; +class CFX_WindowsDIB : public CFX_DIBitmap { + public: + static CFX_ByteString GetBitmapInfo(const CFX_DIBitmap* pBitmap); + + static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); + + static HBITMAP GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC); + + static CFX_DIBitmap* LoadFromDDB(HDC hDC, + HBITMAP hBitmap, + uint32_t* pPalette = NULL, + uint32_t size = 256); + + static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); + + static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename) { + return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); + } + + static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); + + CFX_WindowsDIB(HDC hDC, int width, int height); + + ~CFX_WindowsDIB(); + + HDC GetDC() const { return m_hMemDC; } + + HBITMAP GetWindowsBitmap() const { return m_hBitmap; } + + void LoadFromDevice(HDC hDC, int left, int top); + + void SetToDevice(HDC hDC, int left, int top); + + protected: + HDC m_hMemDC; + + HBITMAP m_hBitmap; + + HBITMAP m_hOldBitmap; +}; +class CFX_WindowsDevice : public CFX_RenderDevice { + public: + static IFX_RenderDeviceDriver* CreateDriver(HDC hDC, + FX_BOOL bCmykOutput = FALSE); + + CFX_WindowsDevice(HDC hDC, + FX_BOOL bCmykOutput = FALSE, + FX_BOOL bForcePSOutput = FALSE, + int psLevel = 2); + + HDC GetDC() const; + + FX_BOOL m_bForcePSOutput; + + static int m_psLevel; +}; +class CFX_WinBitmapDevice : public CFX_RenderDevice { + public: + CFX_WinBitmapDevice(int width, int height, FXDIB_Format format); + + ~CFX_WinBitmapDevice(); + + HDC GetDC() { return m_hDC; } + + protected: + HBITMAP m_hBitmap; + + HBITMAP m_hOldBitmap; + + HDC m_hDC; +}; +#endif + +#endif // CORE_FXGE_INCLUDE_FX_GE_WIN32_H_ diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 4405ba9274..1f8f086b2b 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if defined(_SKIA_SUPPORT_) #include "core/include/fxcodec/fx_codec.h" diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index ed57a02c23..bfcda1547c 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ #include @@ -12,11 +12,11 @@ #include "core/fxge/agg/fx_agg_driver.h" #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/fx_text_int.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge_win32.h" #include "core/fxge/win32/dwrite_int.h" #include "core/fxge/win32/win32_int.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge_win32.h" #include "third_party/base/stl_util.h" class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo { diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index cc627dbab0..eefa991eeb 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -4,13 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ #include +#include "core/fxge/include/fx_ge_win32.h" #include "core/fxge/win32/win32_int.h" -#include "core/include/fxge/fx_ge_win32.h" CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) { CFX_ByteString result; diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp index f95b5eb4a3..aa6ba9c8b9 100644 --- a/core/fxge/win32/fx_win32_dwrite.cpp +++ b/core/fxge/win32/fx_win32_dwrite.cpp @@ -4,13 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ #include +#include "core/fxge/include/fx_ge_win32.h" #include "core/fxge/win32/dwrite_int.h" -#include "core/include/fxge/fx_ge_win32.h" typedef HRESULT(__stdcall* FuncType_DWriteCreateFactory)( __in DWRITE_FACTORY_TYPE, diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index b9c2190041..4e52a8941a 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ #include @@ -17,8 +17,8 @@ using std::max; #include +#include "core/fxge/include/fx_ge_win32.h" #include "core/fxge/win32/win32_int.h" -#include "core/include/fxge/fx_ge_win32.h" using namespace Gdiplus; // NOLINT using namespace Gdiplus::DllExports; // NOLINT diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index cb5ce771a3..d0359138de 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ @@ -12,9 +12,9 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/fx_text_int.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge_win32.h" #include "core/fxge/win32/win32_int.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge_win32.h" #define SIZETHRESHOLD 1000 #define OUTPUTPSLEN 4096 diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index 18996afc5c..7916690817 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -7,8 +7,8 @@ #ifndef CORE_FXGE_WIN32_WIN32_INT_H_ #define CORE_FXGE_WIN32_WIN32_INT_H_ +#include "core/fxge/include/fx_ge.h" #include "core/fxge/win32/dwrite_int.h" -#include "core/include/fxge/fx_ge.h" struct WINDIB_Open_Args_; class CGdiplusExt { diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index f7788b7c9e..9cd6d1c408 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -14,7 +14,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class CFDF_Document; class CFieldTree; diff --git a/core/include/fpdfdoc/fpdf_tagged.h b/core/include/fpdfdoc/fpdf_tagged.h index d17b724d53..46d9fe2137 100644 --- a/core/include/fpdfdoc/fpdf_tagged.h +++ b/core/include/fpdfdoc/fpdf_tagged.h @@ -7,7 +7,7 @@ #ifndef CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ #define CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class CPDF_Document; class CPDF_StructElement; diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h deleted file mode 100644 index bc42a2dd95..0000000000 --- a/core/include/fxge/fpf.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FPF_H_ -#define CORE_INCLUDE_FXGE_FPF_H_ - -#include "core/fxcrt/include/fx_coordinates.h" - -class IFPF_FontMgr; - -class IFPF_DeviceModule { - public: - virtual ~IFPF_DeviceModule() {} - virtual void Destroy() = 0; - virtual IFPF_FontMgr* GetFontMgr() = 0; -}; - -IFPF_DeviceModule* FPF_GetDeviceModule(); - -#define FPF_MATCHFONT_REPLACEANSI 1 - -typedef struct FPF_HFONT_ { void* pData; } * FPF_HFONT; - -class IFPF_Font { - public: - virtual void Release() = 0; - virtual IFPF_Font* Retain() = 0; - virtual FPF_HFONT GetHandle() = 0; - virtual CFX_ByteString GetFamilyName() = 0; - virtual CFX_WideString GetPsName() = 0; - virtual uint32_t GetFontStyle() const = 0; - virtual uint8_t GetCharset() const = 0; - - virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0; - virtual int32_t GetGlyphWidth(int32_t iGlyphIndex) = 0; - - virtual int32_t GetAscent() const = 0; - virtual int32_t GetDescent() const = 0; - - virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) = 0; - virtual FX_BOOL GetBBox(FX_RECT& rtBBox) = 0; - - virtual int32_t GetHeight() const = 0; - virtual int32_t GetItalicAngle() const = 0; - virtual uint32_t GetFontData(uint32_t dwTable, - uint8_t* pBuffer, - uint32_t dwSize) = 0; - - protected: - virtual ~IFPF_Font() {} -}; - -class IFPF_FontMgr { - public: - virtual ~IFPF_FontMgr() {} - virtual void LoadSystemFonts() = 0; - virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0; - virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName) = 0; - virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer) = 0; - - virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, - uint8_t charset, - uint32_t dwStyle, - uint32_t dwMatch = 0) = 0; -}; - -#endif // CORE_INCLUDE_FXGE_FPF_H_ diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h deleted file mode 100644 index 59a494182c..0000000000 --- a/core/include/fxge/fx_dib.h +++ /dev/null @@ -1,669 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FX_DIB_H_ -#define CORE_INCLUDE_FXGE_FX_DIB_H_ - -#include "core/fxcrt/include/fx_basic.h" -#include "core/fxcrt/include/fx_coordinates.h" - -enum FXDIB_Format { - FXDIB_Invalid = 0, - FXDIB_1bppMask = 0x101, - FXDIB_1bppRgb = 0x001, - FXDIB_1bppCmyk = 0x401, - FXDIB_8bppMask = 0x108, - FXDIB_8bppRgb = 0x008, - FXDIB_8bppRgba = 0x208, - FXDIB_8bppCmyk = 0x408, - FXDIB_8bppCmyka = 0x608, - FXDIB_Rgb = 0x018, - FXDIB_Rgba = 0x218, - FXDIB_Rgb32 = 0x020, - FXDIB_Argb = 0x220, - FXDIB_Cmyk = 0x420, - FXDIB_Cmyka = 0x620, -}; -enum FXDIB_Channel { - FXDIB_Red = 1, - FXDIB_Green, - FXDIB_Blue, - FXDIB_Cyan, - FXDIB_Magenta, - FXDIB_Yellow, - FXDIB_Black, - FXDIB_Alpha -}; -#define FXDIB_DOWNSAMPLE 0x04 -#define FXDIB_INTERPOL 0x20 -#define FXDIB_BICUBIC_INTERPOL 0x80 -#define FXDIB_NOSMOOTH 0x100 -#define FXDIB_BLEND_NORMAL 0 -#define FXDIB_BLEND_MULTIPLY 1 -#define FXDIB_BLEND_SCREEN 2 -#define FXDIB_BLEND_OVERLAY 3 -#define FXDIB_BLEND_DARKEN 4 -#define FXDIB_BLEND_LIGHTEN 5 - -#define FXDIB_BLEND_COLORDODGE 6 -#define FXDIB_BLEND_COLORBURN 7 -#define FXDIB_BLEND_HARDLIGHT 8 -#define FXDIB_BLEND_SOFTLIGHT 9 -#define FXDIB_BLEND_DIFFERENCE 10 -#define FXDIB_BLEND_EXCLUSION 11 -#define FXDIB_BLEND_NONSEPARABLE 21 -#define FXDIB_BLEND_HUE 21 -#define FXDIB_BLEND_SATURATION 22 -#define FXDIB_BLEND_COLOR 23 -#define FXDIB_BLEND_LUMINOSITY 24 -#define FXDIB_BLEND_UNSUPPORTED -1 -typedef uint32_t FX_ARGB; -typedef uint32_t FX_COLORREF; -typedef uint32_t FX_CMYK; -class CFX_ClipRgn; -class CFX_DIBSource; -class CFX_DIBitmap; -class CStretchEngine; - -#define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) -#define FXSYS_GetRValue(rgb) ((rgb)&0xff) -#define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) -#define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) -#define FX_CCOLOR(val) (255 - (val)) -#define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) -#define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) -#define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) -#define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff) -#define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk)&0xff) -void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); -inline FX_CMYK CmykEncode(int c, int m, int y, int k) { - return (c << 24) | (m << 16) | (y << 8) | k; -} -void ArgbDecode(FX_ARGB argb, int& a, int& r, int& g, int& b); -void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); -inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { - return (a << 24) | (r << 16) | (g << 8) | b; -} -FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); -#define FXARGB_A(argb) ((uint8_t)((argb) >> 24)) -#define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) -#define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) -#define FXARGB_B(argb) ((uint8_t)(argb)) -#define FXARGB_MAKE(a, r, g, b) \ - (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) -#define FXARGB_MUL_ALPHA(argb, alpha) \ - (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) -#define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) -#define FXCMYK2GRAY(c, m, y, k) \ - (((255 - (c)) * (255 - (k)) * 30 + (255 - (m)) * (255 - (k)) * 59 + \ - (255 - (y)) * (255 - (k)) * 11) / \ - 25500) -#define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) \ - (((backdrop) * (255 - (source_alpha)) + (source) * (source_alpha)) / 255) -#define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) -#define FXCMYK_GETDIB(p) \ - ((((uint8_t*)(p))[0] << 24 | (((uint8_t*)(p))[1] << 16) | \ - (((uint8_t*)(p))[2] << 8) | ((uint8_t*)(p))[3])) -#define FXCMYK_SETDIB(p, cmyk) ((uint8_t*)(p))[0] = (uint8_t)((cmyk) >> 24), \ - ((uint8_t*)(p))[1] = (uint8_t)((cmyk) >> 16), \ - ((uint8_t*)(p))[2] = (uint8_t)((cmyk) >> 8), \ - ((uint8_t*)(p))[3] = (uint8_t)(cmyk)) -#define FXARGB_GETDIB(p) \ - ((((uint8_t*)(p))[0]) | (((uint8_t*)(p))[1] << 8) | \ - (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[3] << 24)) -#define FXARGB_SETDIB(p, argb) \ - ((uint8_t*)(p))[0] = (uint8_t)(argb), \ - ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ - ((uint8_t*)(p))[2] = (uint8_t)((argb) >> 16), \ - ((uint8_t*)(p))[3] = (uint8_t)((argb) >> 24) -#define FXARGB_COPY(dest, src) \ - *(uint8_t*)(dest) = *(uint8_t*)(src), \ - *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ - *((uint8_t*)(dest) + 2) = *((uint8_t*)(src) + 2), \ - *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3) -#define FXCMYK_COPY(dest, src) \ - *(uint8_t*)(dest) = *(uint8_t*)(src), \ - *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ - *((uint8_t*)(dest) + 2) = *((uint8_t*)(src) + 2), \ - *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3) -#define FXARGB_SETRGBORDERDIB(p, argb) \ - ((uint8_t*)(p))[3] = (uint8_t)(argb >> 24), \ - ((uint8_t*)(p))[0] = (uint8_t)((argb) >> 16), \ - ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ - ((uint8_t*)(p))[2] = (uint8_t)(argb) -#define FXARGB_GETRGBORDERDIB(p) \ - (((uint8_t*)(p))[2]) | (((uint8_t*)(p))[1] << 8) | \ - (((uint8_t*)(p))[0] << 16) | (((uint8_t*)(p))[3] << 24) -#define FXARGB_RGBORDERCOPY(dest, src) \ - *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3), \ - *(uint8_t*)(dest) = *((uint8_t*)(src) + 2), \ - *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ - *((uint8_t*)(dest) + 2) = *((uint8_t*)(src)) -#define FXARGB_TODIB(argb) (argb) -#define FXCMYK_TODIB(cmyk) \ - ((uint8_t)((cmyk) >> 24) | ((uint8_t)((cmyk) >> 16)) << 8 | \ - ((uint8_t)((cmyk) >> 8)) << 16 | ((uint8_t)(cmyk) << 24)) -#define FXARGB_TOBGRORDERDIB(argb) \ - ((uint8_t)(argb >> 16) | ((uint8_t)(argb >> 8)) << 8 | \ - ((uint8_t)(argb)) << 16 | ((uint8_t)(argb >> 24) << 24)) -#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8) -#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag) -#define FXGETFLAG_ALPHA_STROKE(flag) (uint8_t)((flag) >> 16) -#define FXSETFLAG_COLORTYPE(flag, val) \ - flag = (((val) << 8) | (flag & 0xffff00ff)) -#define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val) | (flag & 0xffffff00)) -#define FXSETFLAG_ALPHA_STROKE(flag, val) \ - flag = (((val) << 16) | (flag & 0xff00ffff)) - -class CFX_DIBSource { - public: - virtual ~CFX_DIBSource(); - - int GetWidth() const { return m_Width; } - int GetHeight() const { return m_Height; } - - FXDIB_Format GetFormat() const { - return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); - } - uint32_t GetPitch() const { return m_Pitch; } - uint32_t* GetPalette() const { return m_pPalette; } - - virtual uint8_t* GetBuffer() const; - virtual const uint8_t* GetScanline(int line) const = 0; - virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; - virtual void DownSampleScanline(int line, - uint8_t* dest_scan, - int dest_bpp, - int dest_width, - FX_BOOL bFlipX, - int clip_left, - int clip_width) const = 0; - - int GetBPP() const { return m_bpp; } - - // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format, - // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and - // IsOpaqueImage() below should never be able to return TRUE. - bool IsAlphaMask() const { return m_AlphaFlag == 1; } - bool HasAlpha() const { return !!(m_AlphaFlag & 2); } - bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); } - bool IsCmykImage() const { return !!(m_AlphaFlag & 4); } - - int GetPaletteSize() const { - return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); - } - - uint32_t GetPaletteEntry(int index) const; - - void SetPaletteEntry(int index, uint32_t color); - uint32_t GetPaletteArgb(int index) const { return GetPaletteEntry(index); } - void SetPaletteArgb(int index, uint32_t color) { - SetPaletteEntry(index, color); - } - - void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256); - - CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; - CFX_DIBitmap* CloneConvert(FXDIB_Format format, - const FX_RECT* pClip = NULL, - void* pIccTransform = NULL) const; - - CFX_DIBitmap* StretchTo(int dest_width, - int dest_height, - uint32_t flags = 0, - const FX_RECT* pClip = NULL) const; - CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix, - int& left, - int& top, - uint32_t flags = 0, - const FX_RECT* pClip = NULL) const; - - CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; - FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask, - const FX_RECT* pClip = NULL); - - CFX_DIBitmap* SwapXY(FX_BOOL bXFlip, - FX_BOOL bYFlip, - const FX_RECT* pClip = NULL) const; - - CFX_DIBitmap* FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const; - - void GetOverlapRect(int& dest_left, - int& dest_top, - int& width, - int& height, - int src_width, - int src_height, - int& src_left, - int& src_top, - const CFX_ClipRgn* pClipRgn); - - CFX_DIBitmap* m_pAlphaMask; - - protected: - CFX_DIBSource(); - - int m_Width; - int m_Height; - int m_bpp; - uint32_t m_AlphaFlag; - uint32_t m_Pitch; - uint32_t* m_pPalette; - - void BuildPalette(); - FX_BOOL BuildAlphaMask(); - int FindPalette(uint32_t color) const; - void GetPalette(uint32_t* pal, int alpha) const; -}; -class CFX_DIBitmap : public CFX_DIBSource { - public: - CFX_DIBitmap(); - explicit CFX_DIBitmap(const CFX_DIBitmap& src); - ~CFX_DIBitmap() override; - - FX_BOOL Create(int width, - int height, - FXDIB_Format format, - uint8_t* pBuffer = NULL, - int pitch = 0); - - FX_BOOL Copy(const CFX_DIBSource* pSrc); - - // CFX_DIBSource - uint8_t* GetBuffer() const override; - const uint8_t* GetScanline(int line) const override; - void DownSampleScanline(int line, - uint8_t* dest_scan, - int dest_bpp, - int dest_width, - FX_BOOL bFlipX, - int clip_left, - int clip_width) const override; - - void TakeOver(CFX_DIBitmap* pSrcBitmap); - - FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); - - void Clear(uint32_t color); - - uint32_t GetPixel(int x, int y) const; - - void SetPixel(int x, int y, uint32_t color); - - FX_BOOL LoadChannel(FXDIB_Channel destChannel, - const CFX_DIBSource* pSrcBitmap, - FXDIB_Channel srcChannel); - - FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value); - - FX_BOOL MultiplyAlpha(int alpha); - - FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask); - - FX_BOOL TransferBitmap(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top, - void* pIccTransform = NULL); - - FX_BOOL CompositeBitmap(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top, - int blend_type = FXDIB_BLEND_NORMAL, - const CFX_ClipRgn* pClipRgn = NULL, - FX_BOOL bRgbByteOrder = FALSE, - void* pIccTransform = NULL); - - FX_BOOL TransferMask(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pMask, - uint32_t color, - int src_left, - int src_top, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL CompositeMask(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pMask, - uint32_t color, - int src_left, - int src_top, - int blend_type = FXDIB_BLEND_NORMAL, - const CFX_ClipRgn* pClipRgn = NULL, - FX_BOOL bRgbByteOrder = FALSE, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL CompositeRect(int dest_left, - int dest_top, - int width, - int height, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor); - - FX_BOOL DitherFS(const uint32_t* pPalette, - int pal_size, - const FX_RECT* pRect = NULL); - - protected: - uint8_t* m_pBuffer; - - FX_BOOL m_bExtBuf; - - FX_BOOL GetGrayData(void* pIccTransform = NULL); -}; -class CFX_DIBExtractor { - public: - CFX_DIBExtractor(const CFX_DIBSource* pSrc); - - ~CFX_DIBExtractor(); - - operator CFX_DIBitmap*() { return m_pBitmap; } - - private: - CFX_DIBitmap* m_pBitmap; -}; - -typedef CFX_CountRef CFX_DIBitmapRef; -class CFX_FilteredDIB : public CFX_DIBSource { - public: - CFX_FilteredDIB(); - ~CFX_FilteredDIB() override; - - void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); - - virtual FXDIB_Format GetDestFormat() = 0; - - virtual uint32_t* GetDestPalette() = 0; - - virtual void TranslateScanline(uint8_t* dest_buf, - const uint8_t* src_buf) const = 0; - - virtual void TranslateDownSamples(uint8_t* dest_buf, - const uint8_t* src_buf, - int pixels, - int Bpp) const = 0; - - protected: - // CFX_DIBSource - const uint8_t* GetScanline(int line) const override; - void DownSampleScanline(int line, - uint8_t* dest_scan, - int dest_bpp, - int dest_width, - FX_BOOL bFlipX, - int clip_left, - int clip_width) const override; - - const CFX_DIBSource* m_pSrc; - - FX_BOOL m_bAutoDropSrc; - - uint8_t* m_pScanline; -}; - -class IFX_ScanlineComposer { - public: - virtual ~IFX_ScanlineComposer() {} - - virtual void ComposeScanline(int line, - const uint8_t* scanline, - const uint8_t* scan_extra_alpha = NULL) = 0; - - virtual FX_BOOL SetInfo(int width, - int height, - FXDIB_Format src_format, - uint32_t* pSrcPalette) = 0; -}; -class CFX_ScanlineCompositor { - public: - CFX_ScanlineCompositor(); - - ~CFX_ScanlineCompositor(); - - FX_BOOL Init(FXDIB_Format dest_format, - FXDIB_Format src_format, - int32_t width, - uint32_t* pSrcPalette, - uint32_t mask_color, - int blend_type, - FX_BOOL bClip, - FX_BOOL bRgbByteOrder = FALSE, - int alpha_flag = 0, - void* pIccTransform = NULL); - - void CompositeRgbBitmapLine(uint8_t* dest_scan, - const uint8_t* src_scan, - int width, - const uint8_t* clip_scan, - const uint8_t* src_extra_alpha = NULL, - uint8_t* dst_extra_alpha = NULL); - - void CompositePalBitmapLine(uint8_t* dest_scan, - const uint8_t* src_scan, - int src_left, - int width, - const uint8_t* clip_scan, - const uint8_t* src_extra_alpha = NULL, - uint8_t* dst_extra_alpha = NULL); - - void CompositeByteMaskLine(uint8_t* dest_scan, - const uint8_t* src_scan, - int width, - const uint8_t* clip_scan, - uint8_t* dst_extra_alpha = NULL); - - void CompositeBitMaskLine(uint8_t* dest_scan, - const uint8_t* src_scan, - int src_left, - int width, - const uint8_t* clip_scan, - uint8_t* dst_extra_alpha = NULL); - - protected: - int m_Transparency; - FXDIB_Format m_SrcFormat, m_DestFormat; - uint32_t* m_pSrcPalette; - - int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; - int m_BlendType; - void* m_pIccTransform; - uint8_t* m_pCacheScanline; - int m_CacheSize; - FX_BOOL m_bRgbByteOrder; -}; - -class CFX_BitmapComposer : public IFX_ScanlineComposer { - public: - CFX_BitmapComposer(); - ~CFX_BitmapComposer() override; - - void Compose(CFX_DIBitmap* pDest, - const CFX_ClipRgn* pClipRgn, - int bitmap_alpha, - uint32_t mask_color, - FX_RECT& dest_rect, - FX_BOOL bVertical, - FX_BOOL bFlipX, - FX_BOOL bFlipY, - FX_BOOL bRgbByteOrder = FALSE, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - // IFX_ScanlineComposer - FX_BOOL SetInfo(int width, - int height, - FXDIB_Format src_format, - uint32_t* pSrcPalette) override; - - void ComposeScanline(int line, - const uint8_t* scanline, - const uint8_t* scan_extra_alpha) override; - - protected: - void DoCompose(uint8_t* dest_scan, - const uint8_t* src_scan, - int dest_width, - const uint8_t* clip_scan, - const uint8_t* src_extra_alpha = NULL, - uint8_t* dst_extra_alpha = NULL); - CFX_DIBitmap* m_pBitmap; - const CFX_ClipRgn* m_pClipRgn; - FXDIB_Format m_SrcFormat; - int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; - uint32_t m_MaskColor; - const CFX_DIBitmap* m_pClipMask; - CFX_ScanlineCompositor m_Compositor; - FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; - int m_AlphaFlag; - void* m_pIccTransform; - FX_BOOL m_bRgbByteOrder; - int m_BlendType; - void ComposeScanlineV(int line, - const uint8_t* scanline, - const uint8_t* scan_extra_alpha = NULL); - uint8_t* m_pScanlineV; - uint8_t* m_pClipScanV; - uint8_t* m_pAddClipScan; - uint8_t* m_pScanlineAlphaV; -}; - -class CFX_BitmapStorer : public IFX_ScanlineComposer { - public: - CFX_BitmapStorer(); - ~CFX_BitmapStorer() override; - - // IFX_ScanlineComposer - void ComposeScanline(int line, - const uint8_t* scanline, - const uint8_t* scan_extra_alpha) override; - - FX_BOOL SetInfo(int width, - int height, - FXDIB_Format src_format, - uint32_t* pSrcPalette) override; - - CFX_DIBitmap* GetBitmap() { return m_pBitmap; } - - CFX_DIBitmap* Detach(); - - void Replace(CFX_DIBitmap* pBitmap); - - private: - CFX_DIBitmap* m_pBitmap; -}; - -class CFX_ImageStretcher { - public: - CFX_ImageStretcher(); - ~CFX_ImageStretcher(); - - FX_BOOL Start(IFX_ScanlineComposer* pDest, - const CFX_DIBSource* pBitmap, - int dest_width, - int dest_height, - const FX_RECT& bitmap_rect, - uint32_t flags); - - FX_BOOL Continue(IFX_Pause* pPause); - FX_BOOL StartQuickStretch(); - FX_BOOL StartStretch(); - FX_BOOL ContinueQuickStretch(IFX_Pause* pPause); - FX_BOOL ContinueStretch(IFX_Pause* pPause); - - IFX_ScanlineComposer* m_pDest; - const CFX_DIBSource* m_pSource; - CStretchEngine* m_pStretchEngine; - uint32_t m_Flags; - FX_BOOL m_bFlipX; - FX_BOOL m_bFlipY; - int m_DestWidth; - int m_DestHeight; - FX_RECT m_ClipRect; - int m_LineIndex; - int m_DestBPP; - uint8_t* m_pScanline; - uint8_t* m_pMaskScanline; - FXDIB_Format m_DestFormat; -}; -class CFX_ImageTransformer { - public: - CFX_ImageTransformer(); - ~CFX_ImageTransformer(); - - FX_BOOL Start(const CFX_DIBSource* pSrc, - const CFX_Matrix* pMatrix, - int flags, - const FX_RECT* pClip); - - FX_BOOL Continue(IFX_Pause* pPause); - - CFX_Matrix* m_pMatrix; - FX_RECT m_StretchClip; - int m_ResultLeft; - int m_ResultTop; - int m_ResultWidth; - int m_ResultHeight; - CFX_Matrix m_dest2stretch; - CFX_ImageStretcher m_Stretcher; - CFX_BitmapStorer m_Storer; - uint32_t m_Flags; - int m_Status; -}; -class CFX_ImageRenderer { - public: - CFX_ImageRenderer(); - ~CFX_ImageRenderer(); - - FX_BOOL Start(CFX_DIBitmap* pDevice, - const CFX_ClipRgn* pClipRgn, - const CFX_DIBSource* pSource, - int bitmap_alpha, - uint32_t mask_color, - const CFX_Matrix* pMatrix, - uint32_t dib_flags, - FX_BOOL bRgbByteOrder = FALSE, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - FX_BOOL Continue(IFX_Pause* pPause); - - protected: - CFX_DIBitmap* m_pDevice; - const CFX_ClipRgn* m_pClipRgn; - int m_BitmapAlpha; - uint32_t m_MaskColor; - CFX_Matrix m_Matrix; - CFX_ImageTransformer* m_pTransformer; - CFX_ImageStretcher m_Stretcher; - CFX_BitmapComposer m_Composer; - int m_Status; - FX_RECT m_ClipBox; - uint32_t m_Flags; - int m_AlphaFlag; - void* m_pIccTransform; - FX_BOOL m_bRgbByteOrder; - int m_BlendType; -}; - -#endif // CORE_INCLUDE_FXGE_FX_DIB_H_ diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h deleted file mode 100644 index 4e2b97e677..0000000000 --- a/core/include/fxge/fx_font.h +++ /dev/null @@ -1,566 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FX_FONT_H_ -#define CORE_INCLUDE_FXGE_FX_FONT_H_ - -#include -#include -#include - -#include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_freetype.h" - -typedef struct FT_FaceRec_* FXFT_Face; -typedef void* FXFT_Library; - -class CFX_FaceCache; -class CFX_FontFaceInfo; -class CFX_FontMapper; -class CFX_PathData; -class CFX_SizeGlyphCache; -class CFX_SubstFont; -class CTTFontDesc; -class IFX_SystemFontInfo; - -#ifdef _SKIA_SUPPORT_ -class SkTypeface; - -using CFX_TypeFace = SkTypeface; -#endif - -#define FXFONT_FIXED_PITCH 0x01 -#define FXFONT_SERIF 0x02 -#define FXFONT_SYMBOLIC 0x04 -#define FXFONT_SCRIPT 0x08 -#define FXFONT_ITALIC 0x40 -#define FXFONT_BOLD 0x40000 -#define FXFONT_USEEXTERNATTR 0x80000 -#define FXFONT_CIDFONT 0x100000 -#ifdef PDF_ENABLE_XFA -#define FXFONT_EXACTMATCH 0x80000000 -#endif // PDF_ENABLE_XFA -#define FXFONT_ANSI_CHARSET 0 -#define FXFONT_DEFAULT_CHARSET 1 -#define FXFONT_SYMBOL_CHARSET 2 -#define FXFONT_SHIFTJIS_CHARSET 128 -#define FXFONT_HANGEUL_CHARSET 129 -#define FXFONT_GB2312_CHARSET 134 -#define FXFONT_CHINESEBIG5_CHARSET 136 -#define FXFONT_THAI_CHARSET 222 -#define FXFONT_EASTEUROPE_CHARSET 238 -#define FXFONT_RUSSIAN_CHARSET 204 -#define FXFONT_GREEK_CHARSET 161 -#define FXFONT_TURKISH_CHARSET 162 -#define FXFONT_HEBREW_CHARSET 177 -#define FXFONT_ARABIC_CHARSET 178 -#define FXFONT_BALTIC_CHARSET 186 -#define FXFONT_FF_FIXEDPITCH 1 -#define FXFONT_FF_ROMAN (1 << 4) -#define FXFONT_FF_SCRIPT (4 << 4) -#define FXFONT_FW_NORMAL 400 -#define FXFONT_FW_BOLD 700 - -class CFX_Font { - public: - CFX_Font(); - ~CFX_Font(); - - void LoadSubst(const CFX_ByteString& face_name, - FX_BOOL bTrueType, - uint32_t flags, - int weight, - int italic_angle, - int CharsetCP, - FX_BOOL bVertical = FALSE); - FX_BOOL LoadEmbedded(const uint8_t* data, uint32_t size); - FXFT_Face GetFace() const { return m_Face; } - -#ifdef PDF_ENABLE_XFA - FX_BOOL LoadFile(IFX_FileRead* pFile, - int nFaceIndex = 0, - int* pFaceCount = NULL); - - FX_BOOL LoadClone(const CFX_Font* pFont); - CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } - void SetFace(FXFT_Face face) { m_Face = face; } - void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; } -#else // PDF_ENABLE_XFA - const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } -#endif // PDF_ENABLE_XFA - - CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width = 0); - int GetGlyphWidth(uint32_t glyph_index); - int GetAscent() const; - int GetDescent() const; - FX_BOOL GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox); - FX_BOOL IsItalic() const; - FX_BOOL IsBold() const; - FX_BOOL IsFixedWidth() const; - FX_BOOL IsVertical() const { return m_bVertical; } - CFX_WideString GetPsName() const; - CFX_ByteString GetFamilyName() const; - CFX_ByteString GetFaceName() const; - FX_BOOL IsTTFont() const; - FX_BOOL GetBBox(FX_RECT& bbox); - int GetHeight() const; - int GetULPos() const; - int GetULthickness() const; - int GetMaxAdvanceWidth() const; - FX_BOOL IsEmbedded() const { return m_bEmbedded; } - uint8_t* GetSubData() const { return m_pGsubData; } - void SetSubData(uint8_t* data) { m_pGsubData = data; } - void* GetPlatformFont() const { return m_pPlatformFont; } - void SetPlatformFont(void* font) { m_pPlatformFont = font; } - uint8_t* GetFontData() const { return m_pFontData; } - uint32_t GetSize() const { return m_dwSize; } - void AdjustMMParams(int glyph_index, int width, int weight); - - private: - void ReleasePlatformResource(); - void DeleteFace(); - - FXFT_Face m_Face; - CFX_SubstFont* m_pSubstFont; - uint8_t* m_pFontDataAllocation; - uint8_t* m_pFontData; - uint8_t* m_pGsubData; - uint32_t m_dwSize; - CFX_BinaryBuf m_OtfFontData; - void* m_hHandle; - void* m_pPlatformFont; - void* m_pPlatformFontCollection; - void* m_pDwFont; - FX_BOOL m_bDwLoaded; - FX_BOOL m_bEmbedded; - FX_BOOL m_bVertical; - -#ifdef PDF_ENABLE_XFA - - protected: - FX_BOOL m_bLogic; - void* m_pOwnedStream; - -#endif // PDF_ENABLE_XFA -}; - -#define ENCODING_INTERNAL 0 -#define ENCODING_UNICODE 1 - -#ifdef PDF_ENABLE_XFA -#define FXFM_ENC_TAG(a, b, c, d) \ - (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | \ - (uint32_t)(d)) -#define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) -#define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') -#define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') -#define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') -#define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') -#define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') -#define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's') -#define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a') -#define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B') -#define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E') -#define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C') -#define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1') -#define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2') -#define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n') -#endif // PDF_ENABLE_XFA - -class CFX_UnicodeEncoding { - public: - explicit CFX_UnicodeEncoding(CFX_Font* pFont); - virtual ~CFX_UnicodeEncoding(); - - virtual uint32_t GlyphFromCharCode(uint32_t charcode); - - protected: - // Unowned, not nullptr. - CFX_Font* m_pFont; -}; - -#ifdef PDF_ENABLE_XFA -class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding { - public: - CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID); - ~CFX_UnicodeEncodingEx() override; - - // CFX_UnicodeEncoding: - uint32_t GlyphFromCharCode(uint32_t charcode) override; - - uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; - - private: - uint32_t m_nEncodingID; -}; -CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx( - CFX_Font* pFont, - uint32_t nEncodingID = FXFM_ENCODING_NONE); -#endif // PDF_ENABLE_XFA - -#define FXFONT_SUBST_MM 0x01 -#define FXFONT_SUBST_GLYPHPATH 0x04 -#define FXFONT_SUBST_CLEARTYPE 0x08 -#define FXFONT_SUBST_TRANSFORM 0x10 -#define FXFONT_SUBST_NONSYMBOL 0x20 -#define FXFONT_SUBST_EXACT 0x40 -#define FXFONT_SUBST_STANDARD 0x80 - -class CFX_SubstFont { - public: - CFX_SubstFont(); - - void* m_ExtHandle; - - CFX_ByteString m_Family; - - int m_Charset; - - uint32_t m_SubstFlags; - - int m_Weight; - - int m_ItalicAngle; - - FX_BOOL m_bSubstOfCJK; - - int m_WeightCJK; - - FX_BOOL m_bItlicCJK; -}; -#define FX_FONT_FLAG_SERIF 0x01 -#define FX_FONT_FLAG_FIXEDPITCH 0x02 -#define FX_FONT_FLAG_ITALIC 0x04 -#define FX_FONT_FLAG_BOLD 0x08 -#define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 -#define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 -#define FX_FONT_FLAG_MULTIPLEMASTER 0x40 - -class CFX_FontMgr { - public: - CFX_FontMgr(); - ~CFX_FontMgr(); - - void InitFTLibrary(); - - FXFT_Face GetCachedFace(const CFX_ByteString& face_name, - int weight, - FX_BOOL bItalic, - uint8_t*& pFontData); - FXFT_Face AddCachedFace(const CFX_ByteString& face_name, - int weight, - FX_BOOL bItalic, - uint8_t* pData, - uint32_t size, - int face_index); - FXFT_Face GetCachedTTCFace(int ttc_size, - uint32_t checksum, - int font_offset, - uint8_t*& pFontData); - FXFT_Face AddCachedTTCFace(int ttc_size, - uint32_t checksum, - uint8_t* pData, - uint32_t size, - int font_offset); - FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); - FXFT_Face GetFixedFace(const uint8_t* pData, uint32_t size, int face_index); - void ReleaseFace(FXFT_Face face); - void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); - FXFT_Face FindSubstFont(const CFX_ByteString& face_name, - FX_BOOL bTrueType, - uint32_t flags, - int weight, - int italic_angle, - int CharsetCP, - CFX_SubstFont* pSubstFont); - bool GetBuiltinFont(size_t index, const uint8_t** pFontData, uint32_t* size); - CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); } - FXFT_Library GetFTLibrary() const { return m_FTLibrary; } - - private: - std::unique_ptr m_pBuiltinMapper; - std::map m_FaceMap; - FXFT_Library m_FTLibrary; -}; - -class IFX_FontEnumerator { - public: - virtual void HitFont() = 0; - - virtual void Finish() = 0; - - protected: - virtual ~IFX_FontEnumerator() {} -}; - -class IFX_AdditionalFontEnum { - public: - virtual int CountFiles() = 0; - virtual IFX_FileStream* GetFontFile(int index) = 0; - - protected: - virtual ~IFX_AdditionalFontEnum() {} -}; - -class CFX_FontMapper { - public: - explicit CFX_FontMapper(CFX_FontMgr* mgr); - ~CFX_FontMapper(); - - void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); - IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; } - void AddInstalledFont(const CFX_ByteString& name, int charset); - void LoadInstalledFonts(); - std::vector m_InstalledTTFonts; - void SetFontEnumerator(IFX_FontEnumerator* pFontEnumerator) { - m_pFontEnumerator = pFontEnumerator; - } - IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; } - FXFT_Face FindSubstFont(const CFX_ByteString& face_name, - FX_BOOL bTrueType, - uint32_t flags, - int weight, - int italic_angle, - int CharsetCP, - CFX_SubstFont* pSubstFont); -#ifdef PDF_ENABLE_XFA - FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, - uint32_t flags, - int weight, - int italic_angle); -#endif // PDF_ENABLE_XFA - FX_BOOL IsBuiltinFace(const FXFT_Face face) const; - int GetFaceSize() const; - CFX_ByteString GetFaceName(int index) const { return m_FaceArray[index]; } - - private: - static const size_t MM_FACE_COUNT = 2; - static const size_t FOXIT_FACE_COUNT = 14; - - CFX_ByteString GetPSNameFromTT(void* hFont); - CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); - FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, - int iBaseFont, - int italic_angle, - int weight, - int picthfamily); - - FX_BOOL m_bListLoaded; - FXFT_Face m_MMFaces[MM_FACE_COUNT]; - CFX_ByteString m_LastFamily; - CFX_ArrayTemplate m_CharsetArray; - std::vector m_FaceArray; - IFX_SystemFontInfo* m_pFontInfo; - FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; - IFX_FontEnumerator* m_pFontEnumerator; - CFX_FontMgr* const m_pFontMgr; -}; - -class IFX_SystemFontInfo { - public: - static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); - virtual void Release() = 0; - - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; - virtual void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* face, - int& iExact) = 0; - -#ifdef PDF_ENABLE_XFA - virtual void* MapFontByUnicode(uint32_t dwUnicode, - int weight, - FX_BOOL bItalic, - int pitch_family); -#endif // PDF_ENABLE_XFA - - virtual void* GetFont(const FX_CHAR* face) = 0; - virtual uint32_t GetFontData(void* hFont, - uint32_t table, - uint8_t* buffer, - uint32_t size) = 0; - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; - virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; - virtual int GetFaceIndex(void* hFont); - virtual void DeleteFont(void* hFont) = 0; - virtual void* RetainFont(void* hFont); - - protected: - virtual ~IFX_SystemFontInfo() {} -}; - -class CFX_FolderFontInfo : public IFX_SystemFontInfo { - public: - CFX_FolderFontInfo(); - ~CFX_FolderFontInfo() override; - void AddPath(const CFX_ByteStringC& path); - - // IFX_SytemFontInfo: - void Release() override; - FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; - void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* face, - int& bExact) override; -#ifdef PDF_ENABLE_XFA - void* MapFontByUnicode(uint32_t dwUnicode, - int weight, - FX_BOOL bItalic, - int pitch_family) override; -#endif // PDF_ENABLE_XFA - void* GetFont(const FX_CHAR* face) override; - uint32_t GetFontData(void* hFont, - uint32_t table, - uint8_t* buffer, - uint32_t size) override; - void DeleteFont(void* hFont) override; - FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; - FX_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, - uint32_t filesize, - uint32_t offset); - void* GetSubstFont(const CFX_ByteString& face); - void* FindFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* family, - FX_BOOL bMatchName); - - std::map m_FontList; - std::vector m_PathList; - CFX_FontMapper* m_pMapper; -}; - -class CFX_CountedFaceCache { - public: - CFX_FaceCache* m_Obj; - uint32_t m_nCount; -}; - -class CFX_FontCache { - public: - CFX_FontCache(); - ~CFX_FontCache(); - CFX_FaceCache* GetCachedFace(CFX_Font* pFont); - void ReleaseCachedFace(CFX_Font* pFont); - void FreeCache(FX_BOOL bRelease = FALSE); -#ifdef _SKIA_SUPPORT_ - CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); -#endif - - private: - using CFX_FTCacheMap = std::map; - CFX_FTCacheMap m_FTFaceMap; - CFX_FTCacheMap m_ExtFaceMap; -}; - -class CFX_AutoFontCache { - public: - CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) - : m_pFontCache(pFontCache), m_pFont(pFont) {} - ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } - CFX_FontCache* m_pFontCache; - CFX_Font* m_pFont; -}; -#define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ - CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) -class CFX_GlyphBitmap { - public: - int m_Top; - int m_Left; - CFX_DIBitmap m_Bitmap; -}; -class CFX_FaceCache { - public: - explicit CFX_FaceCache(FXFT_Face face); - ~CFX_FaceCache(); - const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, - uint32_t glyph_index, - FX_BOOL bFontStyle, - const CFX_Matrix* pMatrix, - int dest_width, - int anti_alias, - int& text_flags); - const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, - uint32_t glyph_index, - int dest_width); - -#ifdef _SKIA_SUPPORT_ - CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); -#endif - - private: - CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, - uint32_t glyph_index, - FX_BOOL bFontStyle, - const CFX_Matrix* pMatrix, - int dest_width, - int anti_alias); - CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, - uint32_t glyph_index, - const CFX_Matrix* pMatrix, - int dest_width, - int anti_alias); - CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, - const CFX_Matrix* pMatrix, - CFX_ByteStringC& FaceGlyphsKey, - uint32_t glyph_index, - FX_BOOL bFontStyle, - int dest_width, - int anti_alias); - void InitPlatform(); - void DestroyPlatform(); - - FXFT_Face const m_Face; - std::map m_SizeMap; - std::map m_PathMap; - CFX_DIBitmap* m_pBitmap; -#ifdef _SKIA_SUPPORT_ - CFX_TypeFace* m_pTypeface; -#endif -}; - -struct FXTEXT_GLYPHPOS { - const CFX_GlyphBitmap* m_pGlyph; - int m_OriginX; - int m_OriginY; - FX_FLOAT m_fOriginX; - FX_FLOAT m_fOriginY; -}; - -FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, - int nChars, - int anti_alias, - FX_FLOAT retinaScaleX = 1.0f, - FX_FLOAT retinaScaleY = 1.0f); - -class IFX_GSUBTable { - public: - static IFX_GSUBTable* Create(CFX_Font* pFont); - virtual FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) = 0; - - protected: - virtual ~IFX_GSUBTable() {} -}; - -CFX_ByteString GetNameFromTT(const uint8_t* name_table, - uint32_t name_table_size, - uint32_t name); - -int PDF_GetStandardFontName(CFX_ByteString* name); - -#endif // CORE_INCLUDE_FXGE_FX_FONT_H_ diff --git a/core/include/fxge/fx_freetype.h b/core/include/fxge/fx_freetype.h deleted file mode 100644 index 6920d86aca..0000000000 --- a/core/include/fxge/fx_freetype.h +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FX_FREETYPE_H_ -#define CORE_INCLUDE_FXGE_FX_FREETYPE_H_ - -#include -#include FT_FREETYPE_H -#include FT_GLYPH_H -#include FT_LCD_FILTER_H -#include FT_MULTIPLE_MASTERS_H -#include FT_OUTLINE_H -#include FT_TRUETYPE_TABLES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define FXFT_ENCODING_UNICODE FT_ENCODING_UNICODE -#define FXFT_ENCODING_ADOBE_STANDARD FT_ENCODING_ADOBE_STANDARD -#define FXFT_ENCODING_ADOBE_EXPERT FT_ENCODING_ADOBE_EXPERT -#define FXFT_ENCODING_ADOBE_LATIN_1 FT_ENCODING_ADOBE_LATIN_1 -#define FXFT_ENCODING_APPLE_ROMAN FT_ENCODING_APPLE_ROMAN -#define FXFT_ENCODING_ADOBE_CUSTOM FT_ENCODING_ADOBE_CUSTOM -#define FXFT_ENCODING_MS_SYMBOL FT_ENCODING_MS_SYMBOL -#define FXFT_ENCODING_GB2312 FT_ENCODING_GB2312 -#define FXFT_ENCODING_BIG5 FT_ENCODING_BIG5 -#define FXFT_ENCODING_SJIS FT_ENCODING_SJIS -#define FXFT_ENCODING_JOHAB FT_ENCODING_JOHAB -#define FXFT_ENCODING_WANSUNG FT_ENCODING_WANSUNG -#define FXFT_LOAD_NO_SCALE FT_LOAD_NO_SCALE -#define FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH \ - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH -#define FXFT_RENDER_MODE_LCD FT_RENDER_MODE_LCD -#define FXFT_RENDER_MODE_MONO FT_RENDER_MODE_MONO -#define FXFT_RENDER_MODE_NORMAL FT_RENDER_MODE_NORMAL -#define FXFT_LOAD_IGNORE_TRANSFORM FT_LOAD_IGNORE_TRANSFORM -#define FXFT_LOAD_NO_BITMAP FT_LOAD_NO_BITMAP -#define FXFT_LOAD_NO_HINTING FT_LOAD_NO_HINTING -#define FXFT_PIXEL_MODE_MONO FT_PIXEL_MODE_MONO -#define FXFT_STYLE_FLAG_ITALIC FT_STYLE_FLAG_ITALIC -#define FXFT_STYLE_FLAG_BOLD FT_STYLE_FLAG_BOLD -#define FXFT_FACE_FLAG_SFNT FT_FACE_FLAG_SFNT -#define FXFT_FACE_FLAG_TRICKY (1L << 13) -typedef FT_MM_Var* FXFT_MM_Var; -typedef FT_Bitmap* FXFT_Bitmap; -#define FXFT_Matrix FT_Matrix -#define FXFT_Vector FT_Vector -#define FXFT_Outline_Funcs FT_Outline_Funcs -typedef FT_Open_Args FXFT_Open_Args; -typedef FT_StreamRec FXFT_StreamRec; -typedef FT_StreamRec* FXFT_Stream; -typedef FT_BBox FXFT_BBox; -typedef FT_Glyph FXFT_Glyph; -typedef FT_CharMap FXFT_CharMap; -#define FXFT_GLYPH_BBOX_PIXELS FT_GLYPH_BBOX_PIXELS -#define FXFT_Open_Face(library, args, index, face) \ - FT_Open_Face((FT_Library)(library), args, index, (FT_Face*)(face)) -#define FXFT_Done_Face(face) FT_Done_Face((FT_Face)(face)) -#define FXFT_Done_FreeType(library) FT_Done_FreeType((FT_Library)(library)) -#define FXFT_Init_FreeType(library) FT_Init_FreeType((FT_Library*)(library)) -#define FXFT_New_Memory_Face(library, base, size, index, face) \ - FT_New_Memory_Face((FT_Library)(library), base, size, index, (FT_Face*)(face)) -#define FXFT_New_Face(library, filename, index, face) \ - FT_New_Face((FT_Library)(library), filename, index, (FT_Face*)(face)) -#define FXFT_Get_Face_FreeType(face) ((FT_Face)face)->driver->root.library -#define FXFT_Select_Charmap(face, encoding) \ - FT_Select_Charmap((FT_Face)face, (FT_Encoding)encoding) -#define FXFT_Set_Charmap(face, charmap) \ - FT_Set_Charmap((FT_Face)face, (FT_CharMap)charmap) -#define FXFT_Load_Glyph(face, glyph_index, flags) \ - FT_Load_Glyph((FT_Face)face, glyph_index, flags) -#define FXFT_Get_Char_Index(face, code) FT_Get_Char_Index((FT_Face)face, code) -#define FXFT_Get_Glyph_Name(face, index, buffer, size) \ - FT_Get_Glyph_Name((FT_Face)face, index, buffer, size) -#define FXFT_Get_Name_Index(face, name) FT_Get_Name_Index((FT_Face)face, name) -#define FXFT_Has_Glyph_Names(face) \ - (((FT_Face)face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES) -#define FXFT_Get_Postscript_Name(face) FT_Get_Postscript_Name((FT_Face)face) -#define FXFT_Load_Sfnt_Table(face, tag, offset, buffer, length) \ - FT_Load_Sfnt_Table((FT_Face)face, tag, offset, buffer, length) -#define FXFT_Get_First_Char(face, glyph_index) \ - FT_Get_First_Char((FT_Face)face, glyph_index) -#define FXFT_Get_Next_Char(face, code, glyph_index) \ - FT_Get_Next_Char((FT_Face)face, code, glyph_index) -#define FXFT_Clear_Face_External_Stream(face) \ - (((FT_Face)face)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM) -#define FXFT_Get_Face_External_Stream(face) \ - (((FT_Face)face)->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM) -#define FXFT_Is_Face_TT_OT(face) \ - (((FT_Face)face)->face_flags & FT_FACE_FLAG_SFNT) -#define FXFT_Is_Face_Tricky(face) \ - (((FT_Face)face)->face_flags & FXFT_FACE_FLAG_TRICKY) -#define FXFT_Is_Face_fixedwidth(face) \ - (((FT_Face)face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH) -#define FXFT_Get_Face_Stream_Base(face) ((FT_Face)face)->stream->base -#define FXFT_Get_Face_Stream_Size(face) ((FT_Face)face)->stream->size -#define FXFT_Get_Face_Family_Name(face) ((FT_Face)face)->family_name -#define FXFT_Get_Face_Style_Name(face) ((FT_Face)face)->style_name -#define FXFT_Get_Face_Numfaces(face) ((FT_Face)face)->num_faces -#define FXFT_Get_Face_Faceindex(face) ((FT_Face)face)->face_index -#define FXFT_Is_Face_Italic(face) \ - (((FT_Face)face)->style_flags & FT_STYLE_FLAG_ITALIC) -#define FXFT_Is_Face_Bold(face) \ - (((FT_Face)face)->style_flags & FT_STYLE_FLAG_BOLD) -#define FXFT_Get_Face_Charmaps(face) ((FT_Face)face)->charmaps -#define FXFT_Get_Glyph_HoriBearingX(face) \ - ((FT_Face)face)->glyph->metrics.horiBearingX -#define FXFT_Get_Glyph_HoriBearingY(face) \ - ((FT_Face)face)->glyph->metrics.horiBearingY -#define FXFT_Get_Glyph_Width(face) ((FT_Face)face)->glyph->metrics.width -#define FXFT_Get_Glyph_Height(face) ((FT_Face)face)->glyph->metrics.height -#define FXFT_Get_Face_CharmapCount(face) ((FT_Face)face)->num_charmaps -#define FXFT_Get_Charmap_Encoding(charmap) ((FT_CharMap)charmap)->encoding -#define FXFT_Get_Face_Charmap(face) ((FT_Face)face)->charmap -#define FXFT_Get_Charmap_PlatformID(charmap) ((FT_CharMap)charmap)->platform_id -#define FXFT_Get_Charmap_EncodingID(charmap) ((FT_CharMap)charmap)->encoding_id -#define FXFT_Get_Face_UnitsPerEM(face) ((FT_Face)face)->units_per_EM -#define FXFT_Get_Face_xMin(face) ((FT_Face)face)->bbox.xMin -#define FXFT_Get_Face_xMax(face) ((FT_Face)face)->bbox.xMax -#define FXFT_Get_Face_yMin(face) ((FT_Face)face)->bbox.yMin -#define FXFT_Get_Face_yMax(face) ((FT_Face)face)->bbox.yMax -#define FXFT_Get_Face_Height(face) ((FT_Face)face)->height -#define FXFT_Get_Face_UnderLineThickness(face) \ - ((FT_Face)face)->underline_thickness -#define FXFT_Get_Face_UnderLinePosition(face) \ - ((FT_Face)face)->underline_position -#define FXFT_Get_Face_MaxAdvanceWidth(face) ((FT_Face)face)->max_advance_width -#define FXFT_Get_Face_Ascender(face) ((FT_Face)face)->ascender -#define FXFT_Get_Face_Descender(face) ((FT_Face)face)->descender -#define FXFT_Get_Glyph_HoriAdvance(face) \ - ((FT_Face)face)->glyph->metrics.horiAdvance -#define FXFT_Get_MM_Axis(var, index) &static_cast(var)->axis[index] -#define FXFT_Get_MM_Axis_Min(axis) ((FT_Var_Axis*)axis)->minimum -#define FXFT_Get_MM_Axis_Max(axis) ((FT_Var_Axis*)axis)->maximum -#define FXFT_Get_MM_Axis_Def(axis) ((FT_Var_Axis*)axis)->def -#define FXFT_Alloc(library, size) \ - ((FT_Library)library)->memory->alloc(((FT_Library)library)->memory, size) -#define FXFT_Free(face, p) \ - ((FT_Face)face)->memory->free(((FT_Face)face)->memory, p) -#define FXFT_Get_Glyph_Outline(face) &static_cast(face)->glyph->outline -#define FXFT_Get_Outline_Bbox(outline, cbox) FT_Outline_Get_CBox(outline, cbox) -#define FXFT_Render_Glyph(face, mode) \ - FT_Render_Glyph(((FT_Face)face)->glyph, (enum FT_Render_Mode_)mode) -#define FXFT_Get_MM_Var(face, p) FT_Get_MM_Var((FT_Face)face, p) -#define FXFT_Set_MM_Design_Coordinates(face, n, p) \ - FT_Set_MM_Design_Coordinates((FT_Face)face, n, p) -#define FXFT_Set_Pixel_Sizes(face, w, h) FT_Set_Pixel_Sizes((FT_Face)face, w, h) -#define FXFT_Set_Transform(face, m, d) FT_Set_Transform((FT_Face)face, m, d) -#define FXFT_Outline_Embolden(outline, s) FT_Outline_Embolden(outline, s) -#define FXFT_Get_Glyph_Bitmap(face) &static_cast(face)->glyph->bitmap -#define FXFT_Get_Bitmap_Width(bitmap) ((FT_Bitmap*)bitmap)->width -#define FXFT_Get_Bitmap_Rows(bitmap) ((FT_Bitmap*)bitmap)->rows -#define FXFT_Get_Bitmap_PixelMode(bitmap) ((FT_Bitmap*)bitmap)->pixel_mode -#define FXFT_Get_Bitmap_Pitch(bitmap) ((FT_Bitmap*)bitmap)->pitch -#define FXFT_Get_Bitmap_Buffer(bitmap) ((FT_Bitmap*)bitmap)->buffer -#define FXFT_Get_Glyph_BitmapLeft(face) ((FT_Face)face)->glyph->bitmap_left -#define FXFT_Get_Glyph_BitmapTop(face) ((FT_Face)face)->glyph->bitmap_top -#define FXFT_Outline_Decompose(outline, funcs, params) \ - FT_Outline_Decompose(outline, funcs, params) -#define FXFT_Set_Char_Size(face, char_width, char_height, horz_resolution, \ - vert_resolution) \ - FT_Set_Char_Size(face, char_width, char_height, horz_resolution, \ - vert_resolution) -#define FXFT_Get_Glyph(slot, aglyph) FT_Get_Glyph(slot, aglyph) -#define FXFT_Glyph_Get_CBox(glyph, bbox_mode, acbox) \ - FT_Glyph_Get_CBox(glyph, bbox_mode, acbox) -#define FXFT_Done_Glyph(glyph) FT_Done_Glyph(glyph) -#define FXFT_Library_SetLcdFilter(library, filter) \ - FT_Library_SetLcdFilter((FT_Library)(library), filter) -int FXFT_unicode_from_adobe_name(const char* glyph_name); -void FXFT_adobe_name_from_unicode(char* name, wchar_t unicode); -#ifdef __cplusplus -}; -#endif - -#endif // CORE_INCLUDE_FXGE_FX_FREETYPE_H_ diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h deleted file mode 100644 index 3eb9303a80..0000000000 --- a/core/include/fxge/fx_ge.h +++ /dev/null @@ -1,733 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FX_GE_H_ -#define CORE_INCLUDE_FXGE_FX_GE_H_ - -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_font.h" - -class CFX_Font; -class CFX_FontMgr; -class CFX_FontCache; -class CFX_FaceCache; -class CPDF_ShadingPattern; -class IFX_RenderDeviceDriver; -class CCodec_ModuleMgr; -class SkPictureRecorder; - -class CFX_GEModule { - public: - static void Create(const char** pUserFontPaths); - - static void Use(CFX_GEModule* pMgr); - - static CFX_GEModule* Get(); - - static void Destroy(); - - public: - CFX_FontCache* GetFontCache(); - CFX_FontMgr* GetFontMgr() { return m_pFontMgr; } - void SetTextGamma(FX_FLOAT gammaValue); - const uint8_t* GetTextGammaTable(); - - void SetCodecModule(CCodec_ModuleMgr* pCodecModule) { - m_pCodecModule = pCodecModule; - } - CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } - FXFT_Library m_FTLibrary; - void* GetPlatformData() { return m_pPlatformData; } - - protected: - explicit CFX_GEModule(const char** pUserFontPaths); - - ~CFX_GEModule(); - void InitPlatform(); - void DestroyPlatform(); - - private: - uint8_t m_GammaValue[256]; - CFX_FontCache* m_pFontCache; - CFX_FontMgr* m_pFontMgr; - CCodec_ModuleMgr* m_pCodecModule; - void* m_pPlatformData; - const char** m_pUserFontPaths; -}; -typedef struct { - FX_FLOAT m_PointX; - - FX_FLOAT m_PointY; - - int m_Flag; -} FX_PATHPOINT; -#define FXPT_CLOSEFIGURE 0x01 -#define FXPT_LINETO 0x02 -#define FXPT_BEZIERTO 0x04 -#define FXPT_MOVETO 0x06 -#define FXPT_TYPE 0x06 -#define FXFILL_ALTERNATE 1 -#define FXFILL_WINDING 2 -class CFX_ClipRgn { - public: - CFX_ClipRgn(int device_width, int device_height); - - CFX_ClipRgn(const FX_RECT& rect); - - CFX_ClipRgn(const CFX_ClipRgn& src); - - ~CFX_ClipRgn(); - - typedef enum { RectI, MaskF } ClipType; - - void Reset(const FX_RECT& rect); - - ClipType GetType() const { return m_Type; } - - const FX_RECT& GetBox() const { return m_Box; } - - CFX_DIBitmapRef GetMask() const { return m_Mask; } - - void IntersectRect(const FX_RECT& rect); - - void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask); - - protected: - ClipType m_Type; - - FX_RECT m_Box; - - CFX_DIBitmapRef m_Mask; - - void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); -}; -#define FX_GAMMA(value) (value) -#define FX_GAMMA_INVERSE(value) (value) -inline FX_ARGB ArgbGamma(FX_ARGB argb) { - return argb; -} -inline FX_ARGB ArgbGammaInverse(FX_ARGB argb) { - return argb; -} -class CFX_PathData { - public: - CFX_PathData(); - - CFX_PathData(const CFX_PathData& src); - - ~CFX_PathData(); - - int GetPointCount() const { return m_PointCount; } - - int GetFlag(int index) const { return m_pPoints[index].m_Flag; } - - FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; } - - FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; } - - FX_PATHPOINT* GetPoints() const { return m_pPoints; } - - void SetPointCount(int nPoints); - void AllocPointCount(int nPoints); - void AddPointCount(int addPoints); - - CFX_FloatRect GetBoundingBox() const; - - CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; - - void Transform(const CFX_Matrix* pMatrix); - - FX_BOOL IsRect() const; - - FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath, - CFX_Matrix* pMatrix, - FX_BOOL& bThin, - FX_BOOL bAdjust) const; - - FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const; - - void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix); - void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); - - void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag); - - void TrimPoints(int nPoints); - - void Copy(const CFX_PathData& src); - - protected: - friend class CPDF_Path; - - int m_PointCount; - - FX_PATHPOINT* m_pPoints; - - int m_AllocCount; -}; -class CFX_GraphStateData { - public: - CFX_GraphStateData(); - - CFX_GraphStateData(const CFX_GraphStateData& src); - - ~CFX_GraphStateData(); - - void Copy(const CFX_GraphStateData& src); - - void SetDashCount(int count); - - typedef enum { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 } LineCap; - LineCap m_LineCap; - int m_DashCount; - FX_FLOAT* m_DashArray; - FX_FLOAT m_DashPhase; - - typedef enum { - LineJoinMiter = 0, - LineJoinRound = 1, - LineJoinBevel = 2, - } LineJoin; - LineJoin m_LineJoin; - FX_FLOAT m_MiterLimit; - FX_FLOAT m_LineWidth; -}; -#define FXDC_DEVICE_CLASS 1 -#define FXDC_PIXEL_WIDTH 2 -#define FXDC_PIXEL_HEIGHT 3 -#define FXDC_BITS_PIXEL 4 -#define FXDC_HORZ_SIZE 5 -#define FXDC_VERT_SIZE 6 -#define FXDC_RENDER_CAPS 7 -#define FXDC_DITHER_BITS 8 -#define FXDC_DISPLAY 1 -#define FXDC_PRINTER 2 -#define FXRC_GET_BITS 0x01 -#define FXRC_BIT_MASK 0x02 -#define FXRC_ALPHA_MASK 0x04 -#define FXRC_ALPHA_PATH 0x10 -#define FXRC_ALPHA_IMAGE 0x20 -#define FXRC_ALPHA_OUTPUT 0x40 -#define FXRC_BLEND_MODE 0x80 -#define FXRC_SOFT_CLIP 0x100 -#define FXRC_CMYK_OUTPUT 0x200 -#define FXRC_BITMASK_OUTPUT 0x400 -#define FXRC_BYTEMASK_OUTPUT 0x800 -#define FXRENDER_IMAGE_LOSSY 0x1000 -#define FXRC_FILLSTROKE_PATH 0x2000 -#define FXRC_SHADING 0x4000 -#define FXFILL_ALTERNATE 1 -#define FXFILL_WINDING 2 -#define FXFILL_FULLCOVER 4 -#define FXFILL_RECT_AA 8 -#define FX_FILL_STROKE 16 -#define FX_STROKE_ADJUST 32 -#define FX_STROKE_TEXT_MODE 64 -#define FX_FILL_TEXT_MODE 128 -#define FX_ZEROAREA_FILL 256 -#define FXFILL_NOPATHSMOOTH 512 -#define FXTEXT_CLEARTYPE 0x01 -#define FXTEXT_BGR_STRIPE 0x02 -#define FXTEXT_PRINTGRAPHICTEXT 0x04 -#define FXTEXT_NO_NATIVETEXT 0x08 -#define FXTEXT_PRINTIMAGETEXT 0x10 -#define FXTEXT_NOSMOOTH 0x20 -typedef struct { - uint32_t m_GlyphIndex; - FX_FLOAT m_OriginX, m_OriginY; - int m_FontCharWidth; - FX_BOOL m_bGlyphAdjust; - FX_FLOAT m_AdjustMatrix[4]; - uint32_t m_ExtGID; - FX_BOOL m_bFontStyle; -} FXTEXT_CHARPOS; - -class CFX_RenderDevice { - public: - CFX_RenderDevice(); - virtual ~CFX_RenderDevice(); - - void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); - IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } - - FX_BOOL StartRendering(); - void EndRendering(); - void SaveState(); - void RestoreState(FX_BOOL bKeepSaved = FALSE); - - int GetWidth() const { return m_Width; } - int GetHeight() const { return m_Height; } - int GetDeviceClass() const { return m_DeviceClass; } - int GetBPP() const { return m_bpp; } - int GetRenderCaps() const { return m_RenderCaps; } - int GetDeviceCaps(int id) const; - CFX_Matrix GetCTM() const; - - CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } - void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } - - FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, - int width, - int height) const; - - const FX_RECT& GetClipBox() const { return m_ClipBox; } - - FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - int fill_mode); - - FX_BOOL SetClip_Rect(const FX_RECT& pRect); - FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState); - - FX_BOOL DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - FX_BOOL SetPixel(int x, - int y, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL FillRect(const FX_RECT* pRect, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int fill_mode = 0, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top, - void* pIccTransform = NULL); - - CFX_DIBitmap* GetBackDrop(); - - FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - int left, - int top, - int blend_type = FXDIB_BLEND_NORMAL, - void* pIccTransform = NULL); - - FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t flags = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, - int left, - int top, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t color, - uint32_t flags = 0, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t flags, - void*& handle, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - - FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); - - void CancelDIBits(void* handle); - - FX_BOOL DrawNormalText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - FX_FLOAT font_size, - const CFX_Matrix* pText2Device, - uint32_t fill_color, - uint32_t text_flags, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL DrawTextPath(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - FX_FLOAT font_size, - const CFX_Matrix* pText2User, - const CFX_Matrix* pUser2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - CFX_PathData* pClippingPath, - int nFlag = 0, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL); - virtual void Begin() {} - virtual void End() {} - - private: - void InitDeviceInfo(); - void UpdateClipBox(); - FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int alpha_flag, - void* pIccTransform, - int blend_type); - - CFX_DIBitmap* m_pBitmap; - int m_Width; - int m_Height; - int m_bpp; - int m_RenderCaps; - int m_DeviceClass; - FX_RECT m_ClipBox; - IFX_RenderDeviceDriver* m_pDeviceDriver; -}; - -class CFX_FxgeDevice : public CFX_RenderDevice { - public: - CFX_FxgeDevice(); - ~CFX_FxgeDevice() override; - - bool Attach(CFX_DIBitmap* pBitmap, - int dither_bits = 0, - bool bRgbByteOrder = false, - CFX_DIBitmap* pOriDevice = NULL, - bool bGroupKnockout = false); - - bool Create(int width, - int height, - FXDIB_Format format, - int dither_bits = 0, - CFX_DIBitmap* pOriDevice = NULL); - - protected: - bool m_bOwnedBitmap; -}; - -class CFX_SkiaDevice : public CFX_RenderDevice { - public: - CFX_SkiaDevice(); - ~CFX_SkiaDevice() override; - - FX_BOOL Attach(CFX_DIBitmap* pBitmap, - int dither_bits = 0, - FX_BOOL bRgbByteOrder = FALSE, - CFX_DIBitmap* pOriDevice = NULL, - FX_BOOL bGroupKnockout = FALSE); - - FX_BOOL AttachRecorder(SkPictureRecorder* recorder); - - FX_BOOL Create(int width, - int height, - FXDIB_Format format, - int dither_bits = 0, - CFX_DIBitmap* pOriDevice = NULL); - - SkPictureRecorder* CreateRecorder(int size_x, int size_y); - - protected: - FX_BOOL m_bOwnedBitmap; -}; - -class IFX_RenderDeviceDriver { - public: - static IFX_RenderDeviceDriver* CreateFxgeDriver( - CFX_DIBitmap* pBitmap, - FX_BOOL bRgbByteOrder = FALSE, - CFX_DIBitmap* pOriDevice = NULL, - FX_BOOL bGroupKnockout = FALSE); - - virtual ~IFX_RenderDeviceDriver() {} - virtual void Begin() {} - virtual void End() {} - - virtual int GetDeviceCaps(int caps_id) = 0; - - virtual CFX_Matrix GetCTM() const { return CFX_Matrix(); } - - virtual FX_BOOL IsPSPrintDriver() { return FALSE; } - - virtual FX_BOOL StartRendering() { return TRUE; } - - virtual void EndRendering() {} - - virtual void SaveState() = 0; - - virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) = 0; - - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - int fill_mode) = 0; - - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState) { - return FALSE; - } - - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) = 0; - - virtual FX_BOOL SetPixel(int x, - int y, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL) { - return FALSE; - } - - virtual FX_BOOL FillRect(const FX_RECT* pRect, - uint32_t fill_color, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) { - return FALSE; - } - - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) { - return FALSE; - } - - virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0; - - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top, - void* pIccTransform = NULL, - FX_BOOL bDEdge = FALSE) { - return FALSE; - } - virtual CFX_DIBitmap* GetBackDrop() { return NULL; } - - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - const FX_RECT* pSrcRect, - int dest_left, - int dest_top, - int blend_type, - int alpha_flag = 0, - void* pIccTransform = NULL) = 0; - - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) = 0; - - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t flags, - void*& handle, - int alpha_flag = 0, - void* pIccTransform = NULL, - int blend_type = FXDIB_BLEND_NORMAL) = 0; - - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { - return FALSE; - } - - virtual void CancelDIBits(void* handle) {} - - virtual FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL) { - return FALSE; - } - - virtual void* GetPlatformSurface() const { return NULL; } - virtual int GetDriverType() const { return 0; } - virtual void ClearDriver() {} - - virtual FX_BOOL DrawShading(CPDF_ShadingPattern* pPattern, - CFX_Matrix* pMatrix, - int alpha, - FX_BOOL bAlphaMode) { - return false; - } -}; - -class IFX_PSOutput { - public: - virtual void Release() = 0; - virtual void OutputPS(const FX_CHAR* str, int len) = 0; - - protected: - virtual ~IFX_PSOutput() {} -}; - -class CPSFont; -class CFX_PSRenderer { - public: - CFX_PSRenderer(); - - ~CFX_PSRenderer(); - - void Init(IFX_PSOutput* pOutput, - int ps_level, - int width, - int height, - FX_BOOL bCmykOutput); - FX_BOOL StartRendering(); - void EndRendering(); - - void SaveState(); - - void RestoreState(FX_BOOL bKeepSaved = FALSE); - - void SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - int fill_mode); - - void SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState); - - FX_RECT GetClipBox() { return m_ClipBox; } - - FX_BOOL DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t flags, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL DrawDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t flags, - int alpha_flag = 0, - void* pIccTransform = NULL); - - FX_BOOL DrawText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color, - int alpha_flag = 0, - void* pIccTransform = NULL); - - private: - IFX_PSOutput* m_pOutput; - - int m_PSLevel; - - CFX_GraphStateData m_CurGraphState; - - FX_BOOL m_bGraphStateSet; - - FX_BOOL m_bCmykOutput; - - FX_BOOL m_bColorSet; - - uint32_t m_LastColor; - - FX_RECT m_ClipBox; - - CFX_ArrayTemplate m_PSFontList; - - CFX_ArrayTemplate m_ClipBoxStack; - FX_BOOL m_bInited; - - void OutputPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device); - - void SetGraphState(const CFX_GraphStateData* pGraphState); - - void SetColor(uint32_t color, int alpha_flag, void* pIccTransform); - - void FindPSFontGlyph(CFX_FaceCache* pFaceCache, - CFX_Font* pFont, - const FXTEXT_CHARPOS& charpos, - int& ps_fontnum, - int& ps_glyphindex); - - void WritePSBinary(const uint8_t* data, int len); -}; - -#endif // CORE_INCLUDE_FXGE_FX_GE_H_ diff --git a/core/include/fxge/fx_ge_apple.h b/core/include/fxge/fx_ge_apple.h deleted file mode 100644 index 16298581b3..0000000000 --- a/core/include/fxge/fx_ge_apple.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FX_GE_APPLE_H_ -#define CORE_INCLUDE_FXGE_FX_GE_APPLE_H_ - -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ -class CFX_QuartzDevice : public CFX_RenderDevice { - public: - CFX_QuartzDevice(); - ~CFX_QuartzDevice(); - FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY); - FX_BOOL Attach(CFX_DIBitmap* pBitmap); - FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format); - - CGContextRef GetContext(); - - protected: - CGContextRef m_pContext; - FX_BOOL m_bOwnedBitmap; -}; -#endif - -#endif // CORE_INCLUDE_FXGE_FX_GE_APPLE_H_ diff --git a/core/include/fxge/fx_ge_win32.h b/core/include/fxge/fx_ge_win32.h deleted file mode 100644 index f1864590c5..0000000000 --- a/core/include/fxge/fx_ge_win32.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXGE_FX_GE_WIN32_H_ -#define CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ - -#ifdef _WIN32 -#ifndef _WINDOWS_ -#include -#endif -#define WINDIB_OPEN_MEMORY 0x1 -#define WINDIB_OPEN_PATHNAME 0x2 -typedef struct WINDIB_Open_Args_ { - int flags; - - const uint8_t* memory_base; - - size_t memory_size; - - const FX_WCHAR* path_name; -} WINDIB_Open_Args_; -class CFX_WindowsDIB : public CFX_DIBitmap { - public: - static CFX_ByteString GetBitmapInfo(const CFX_DIBitmap* pBitmap); - - static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); - - static HBITMAP GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC); - - static CFX_DIBitmap* LoadFromDDB(HDC hDC, - HBITMAP hBitmap, - uint32_t* pPalette = NULL, - uint32_t size = 256); - - static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); - - static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename) { - return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); - } - - static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); - - CFX_WindowsDIB(HDC hDC, int width, int height); - - ~CFX_WindowsDIB(); - - HDC GetDC() const { return m_hMemDC; } - - HBITMAP GetWindowsBitmap() const { return m_hBitmap; } - - void LoadFromDevice(HDC hDC, int left, int top); - - void SetToDevice(HDC hDC, int left, int top); - - protected: - HDC m_hMemDC; - - HBITMAP m_hBitmap; - - HBITMAP m_hOldBitmap; -}; -class CFX_WindowsDevice : public CFX_RenderDevice { - public: - static IFX_RenderDeviceDriver* CreateDriver(HDC hDC, - FX_BOOL bCmykOutput = FALSE); - - CFX_WindowsDevice(HDC hDC, - FX_BOOL bCmykOutput = FALSE, - FX_BOOL bForcePSOutput = FALSE, - int psLevel = 2); - - HDC GetDC() const; - - FX_BOOL m_bForcePSOutput; - - static int m_psLevel; -}; -class CFX_WinBitmapDevice : public CFX_RenderDevice { - public: - CFX_WinBitmapDevice(int width, int height, FXDIB_Format format); - - ~CFX_WinBitmapDevice(); - - HDC GetDC() { return m_hDC; } - - protected: - HBITMAP m_hBitmap; - - HBITMAP m_hOldBitmap; - - HDC m_hDC; -}; -#endif - -#endif // CORE_INCLUDE_FXGE_FX_GE_WIN32_H_ diff --git a/fpdfsdk/DEPS b/fpdfsdk/DEPS index 1383f25c35..99e35b4151 100644 --- a/fpdfsdk/DEPS +++ b/fpdfsdk/DEPS @@ -7,6 +7,7 @@ include_rules = [ '+core/fpdfapi/fpdf_parser/include', '+core/fpdfapi/fpdf_render/include', '+core/fxcrt/include', + '+core/fxge/include', '+public', '+v8', '+xfa/include', diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp index 1fe40d98c1..41252277ac 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/fpdfdoc/include/cpvt_word.h" #include "core/fpdfdoc/include/ipvt_fontmap.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/include/fx_systemhandler.h" #include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/include/fxedit/fxet_edit.h" diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index 06f0666c81..2ee130feb3 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -11,8 +11,8 @@ #include #include "core/fxcrt/include/fx_basic.h" +#include "core/fxge/include/fx_dib.h" #include "core/include/fpdfdoc/fpdf_doc.h" -#include "core/include/fxge/fx_dib.h" #include "fpdfsdk/include/fsdk_baseannot.h" #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index 9d81737f62..9882888ed9 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -8,9 +8,9 @@ #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fxge/include/fx_ge.h" +#include "core/fxge/include/fx_ge_win32.h" #include "core/include/fpdfdoc/fpdf_doc.h" -#include "core/include/fxge/fx_ge.h" -#include "core/include/fxge/fx_ge_win32.h" #include "public/fpdfview.h" #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index 532e96d97f..46896457af 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -9,7 +9,7 @@ #include "core/fpdfdoc/include/cpdf_variabletext.h" #include "core/fxcrt/include/fx_basic.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class CPDF_Font; class CPDF_PageObjectHolder; diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index aa6f0182e2..e49471a0d2 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/pdfwindow/PWL_Caret.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_Utils.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index c07233f499..aa0db4b291 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/pdfwindow/PWL_ComboBox.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_Edit.h" #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/pdfwindow/PWL_ListBox.h" diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index b5e2093483..e193d0f469 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -12,7 +12,7 @@ #include "core/fpdfdoc/include/cpvt_word.h" #include "core/fxcrt/include/fx_safe_types.h" #include "core/fxcrt/include/fx_xml.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_Caret.h" #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/pdfwindow/PWL_FontMap.h" diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp index 60bd40a258..8067907978 100644 --- a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_Note.cpp b/fpdfsdk/pdfwindow/PWL_Note.cpp index db7d1a5670..e0f9132b18 100644 --- a/fpdfsdk/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/pdfwindow/PWL_Note.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/pdfwindow/PWL_Note.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_Button.h" #include "fpdfsdk/pdfwindow/PWL_Caret.h" #include "fpdfsdk/pdfwindow/PWL_Edit.h" diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index a96cf5f2a5..2dfa6cfe6a 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_Utils.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp index 221922972f..6dd2ea1b30 100644 --- a/fpdfsdk/pdfwindow/PWL_Signature.cpp +++ b/fpdfsdk/pdfwindow/PWL_Signature.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/pdfwindow/PWL_Signature.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/pdfwindow/PWL_Icon.h" #include "fpdfsdk/pdfwindow/PWL_Label.h" #include "fpdfsdk/pdfwindow/PWL_Utils.h" diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index acd362a29c..6a872bd4df 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -9,7 +9,7 @@ #include #include "core/fpdfdoc/include/cpvt_word.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/pdfwindow/PWL_Icon.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" diff --git a/pdfium.gyp b/pdfium.gyp index dd864e91da..2a22944543 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -669,13 +669,6 @@ 'third_party/third_party.gyp:fx_agg', ], 'sources': [ - 'core/include/fxge/fpf.h', - 'core/include/fxge/fx_dib.h', - 'core/include/fxge/fx_font.h', - 'core/include/fxge/fx_freetype.h', - 'core/include/fxge/fx_ge.h', - 'core/include/fxge/fx_ge_apple.h', - 'core/include/fxge/fx_ge_win32.h', 'core/fxge/agg/fx_agg_driver.h', 'core/fxge/agg/fx_agg_driver.cpp', 'core/fxge/android/fpf_skiafont.cpp', @@ -724,6 +717,13 @@ 'core/fxge/ge/fx_ge_ps.cpp', 'core/fxge/ge/fx_ge_text.cpp', 'core/fxge/ge/fx_text_int.h', + 'core/fxge/include/fpf.h', + 'core/fxge/include/fx_dib.h', + 'core/fxge/include/fx_font.h', + 'core/fxge/include/fx_freetype.h', + 'core/fxge/include/fx_ge.h', + 'core/fxge/include/fx_ge_apple.h', + 'core/fxge/include/fx_ge_win32.h', ], 'variables': { 'clang_warning_flags': [ diff --git a/testing/DEPS b/testing/DEPS index 99f34dc190..e261291c0c 100644 --- a/testing/DEPS +++ b/testing/DEPS @@ -2,6 +2,7 @@ include_rules = [ '+core/include', '+core/fxcodec', '+core/fxcrt/include', + '+core/fxge/include', '+fpdfsdk/include', '+public', '+v8', diff --git a/testing/libfuzzer/pdf_jpx_fuzzer.cc b/testing/libfuzzer/pdf_jpx_fuzzer.cc index 12d2061445..7af5d13fc1 100644 --- a/testing/libfuzzer/pdf_jpx_fuzzer.cc +++ b/testing/libfuzzer/pdf_jpx_fuzzer.cc @@ -7,7 +7,7 @@ #include #include "core/fxcodec/codec/codec_int.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" CCodec_JpxModule g_module; diff --git a/xfa/DEPS b/xfa/DEPS index ef5e5b9d06..f106513e9c 100644 --- a/xfa/DEPS +++ b/xfa/DEPS @@ -2,5 +2,6 @@ include_rules = [ '+core/include', '+core/fxcrt/include', '+core/fpdfapi/fpdf_parser/include', + '+core/fxge/include', '+third_party/bigint' ] diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 6a1b0d6543..0856accca6 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -7,7 +7,7 @@ #ifndef XFA_FDE_CSS_FDE_CSS_H_ #define XFA_FDE_CSS_FDE_CSS_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fgas/crt/fgas_stream.h" #include "xfa/fgas/crt/fgas_utils.h" #include "xfa/fgas/font/fgas_font.h" diff --git a/xfa/fde/fde_brush.h b/xfa/fde/fde_brush.h index cfa40a055f..924ef62c12 100644 --- a/xfa/fde/fde_brush.h +++ b/xfa/fde/fde_brush.h @@ -8,7 +8,7 @@ #define XFA_FDE_FDE_BRUSH_H_ #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" class IFDE_Image; diff --git a/xfa/fde/fde_geobject.h b/xfa/fde/fde_geobject.h index 11819154ab..debec6ab2e 100644 --- a/xfa/fde/fde_geobject.h +++ b/xfa/fde/fde_geobject.h @@ -7,7 +7,7 @@ #ifndef XFA_FDE_FDE_GEOBJECT_H_ #define XFA_FDE_FDE_GEOBJECT_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fde/fde_path.h" #include "xfa/fgas/crt/fgas_memory.h" diff --git a/xfa/fde/fde_object.h b/xfa/fde/fde_object.h index ae7b95aa32..e222b1a562 100644 --- a/xfa/fde/fde_object.h +++ b/xfa/fde/fde_object.h @@ -9,7 +9,7 @@ #include -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fde/fde_brush.h" #include "xfa/fde/fde_pen.h" #include "xfa/fgas/crt/fgas_memory.h" diff --git a/xfa/fde/fde_renderdevice.h b/xfa/fde/fde_renderdevice.h index 58da7759fa..55f6524cff 100644 --- a/xfa/fde/fde_renderdevice.h +++ b/xfa/fde/fde_renderdevice.h @@ -8,8 +8,8 @@ #define XFA_FDE_FDE_RENDERDEVICE_H_ #include "core/fxcrt/include/fx_coordinates.h" -#include "core/include/fxge/fx_font.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_font.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fde/fde_path.h" #include "xfa/fgas/font/fgas_font.h" diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h index 5dc7f84cb7..6dcb42c296 100644 --- a/xfa/fde/fde_visualset.h +++ b/xfa/fde/fde_visualset.h @@ -9,8 +9,8 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fde/fde_brush.h" #include "xfa/fde/fde_image.h" #include "xfa/fde/fde_path.h" diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 159850e0f2..e20c00a2e0 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -7,8 +7,8 @@ #ifndef XFA_FDE_TTO_FDE_TEXTOUT_H_ #define XFA_FDE_TTO_FDE_TEXTOUT_H_ -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fgas/font/fgas_font.h" #define FDE_TTOSTYLE_Underline 0x0001 diff --git a/xfa/fee/ifde_txtedtengine.h b/xfa/fee/ifde_txtedtengine.h index 047bf50b4e..6a31af6bd8 100644 --- a/xfa/fee/ifde_txtedtengine.h +++ b/xfa/fee/ifde_txtedtengine.h @@ -7,7 +7,7 @@ #ifndef XFA_FEE_IFDE_TXTEDTENGINE_H_ #define XFA_FEE_IFDE_TXTEDTENGINE_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fgas/font/fgas_font.h" class IFDE_TxtEdtPage; diff --git a/xfa/fee/ifde_txtedtpage.h b/xfa/fee/ifde_txtedtpage.h index ec5912d0f1..094568834a 100644 --- a/xfa/fee/ifde_txtedtpage.h +++ b/xfa/fee/ifde_txtedtpage.h @@ -7,7 +7,7 @@ #ifndef XFA_FEE_IFDE_TXTEDTPAGE_H_ #define XFA_FEE_IFDE_TXTEDTPAGE_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fde/fde_visualset.h" #include "xfa/fgas/layout/fgas_textbreak.h" diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index 8b1091ff50..56ddb7129f 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -7,7 +7,7 @@ #ifndef XFA_FGAS_FONT_FGAS_FONT_H_ #define XFA_FGAS_FONT_FGAS_FONT_H_ -#include "core/include/fxge/fx_font.h" +#include "core/fxge/include/fx_font.h" #include "xfa/fgas/crt/fgas_stream.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index 433f2df276..88e0e8e897 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -8,8 +8,8 @@ #define XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ #include "core/fxcrt/include/fx_ext.h" -#include "core/include/fxge/fx_freetype.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_freetype.h" +#include "core/fxge/include/fx_ge.h" #include "third_party/freetype/include/freetype/fttypes.h" #include "xfa/fgas/font/fgas_font.h" diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index dd791c24df..83310e9d82 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -8,7 +8,7 @@ #define XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ #include "core/fxcrt/include/fx_ucd.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_utils.h" #include "xfa/fgas/layout/fgas_textbreak.h" diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index add156e971..af817547d3 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -8,7 +8,7 @@ #define XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ #include "core/fxcrt/include/fx_ucd.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fgas/crt/fgas_utils.h" #include "xfa/fgas/layout/fgas_unicode.h" diff --git a/xfa/fwl/basewidget/ifx_barcode.h b/xfa/fwl/basewidget/ifx_barcode.h index a44a01ba8d..2cad68cbeb 100644 --- a/xfa/fwl/basewidget/ifx_barcode.h +++ b/xfa/fwl/basewidget/ifx_barcode.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/include/BC_Library.h" class CFX_Font; diff --git a/xfa/fwl/core/cfwl_themebackground.h b/xfa/fwl/core/cfwl_themebackground.h index cdab5b2729..6cecbbf26a 100644 --- a/xfa/fwl/core/cfwl_themebackground.h +++ b/xfa/fwl/core/cfwl_themebackground.h @@ -7,7 +7,7 @@ #ifndef XFA_FWL_CORE_CFWL_THEMEBACKGROUND_H_ #define XFA_FWL_CORE_CFWL_THEMEBACKGROUND_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fwl/core/cfwl_themepart.h" class CFX_DIBitmpa; diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h index fa62e092fb..925cdb780a 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.h +++ b/xfa/fwl/lightwidget/cfwl_theme.h @@ -12,7 +12,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fwl/core/ifwl_themeprovider.h" class CFWL_WidgetTP; diff --git a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.h b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.h index e27dd1df3d..ca3aafb27d 100644 --- a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.h +++ b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_string.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/BC_LuminanceSource.h" class CBC_BufferedImageLuminanceSource : public CBC_LuminanceSource { diff --git a/xfa/fxbarcode/BC_TwoDimWriter.h b/xfa/fxbarcode/BC_TwoDimWriter.h index f5dcd61ff8..ba94c3269f 100644 --- a/xfa/fxbarcode/BC_TwoDimWriter.h +++ b/xfa/fxbarcode/BC_TwoDimWriter.h @@ -7,7 +7,7 @@ #ifndef XFA_FXBARCODE_BC_TWODIMWRITER_H_ #define XFA_FXBARCODE_BC_TWODIMWRITER_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fxbarcode/BC_Writer.h" class CBC_CommonBitMatrix; diff --git a/xfa/fxbarcode/BC_Writer.h b/xfa/fxbarcode/BC_Writer.h index 0b7719a541..9b5d037335 100644 --- a/xfa/fxbarcode/BC_Writer.h +++ b/xfa/fxbarcode/BC_Writer.h @@ -8,7 +8,7 @@ #define XFA_FXBARCODE_BC_WRITER_H_ #include "core/fxcrt/include/fx_string.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/utils.h" class CBC_Writer { diff --git a/xfa/fxbarcode/cbc_codabar.h b/xfa/fxbarcode/cbc_codabar.h index bab39a8496..c375cccfb0 100644 --- a/xfa/fxbarcode/cbc_codabar.h +++ b/xfa/fxbarcode/cbc_codabar.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_onecode.h" class CBC_Codabar : public CBC_OneCode { diff --git a/xfa/fxbarcode/cbc_code128.h b/xfa/fxbarcode/cbc_code128.h index 33005b1dd3..d351a9af33 100644 --- a/xfa/fxbarcode/cbc_code128.h +++ b/xfa/fxbarcode/cbc_code128.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_onecode.h" class CBC_Code128 : public CBC_OneCode { diff --git a/xfa/fxbarcode/cbc_code39.h b/xfa/fxbarcode/cbc_code39.h index c93b7d7d7c..3853da18d7 100644 --- a/xfa/fxbarcode/cbc_code39.h +++ b/xfa/fxbarcode/cbc_code39.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_onecode.h" class CBC_Code39 : public CBC_OneCode { diff --git a/xfa/fxbarcode/cbc_codebase.h b/xfa/fxbarcode/cbc_codebase.h index 145b929c00..317e0ecef7 100644 --- a/xfa/fxbarcode/cbc_codebase.h +++ b/xfa/fxbarcode/cbc_codebase.h @@ -8,7 +8,7 @@ #define XFA_FXBARCODE_CBC_CODEBASE_H_ #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/include/BC_Library.h" class CBC_Writer; diff --git a/xfa/fxbarcode/cbc_datamatrix.h b/xfa/fxbarcode/cbc_datamatrix.h index ea1e136477..496df6ecaa 100644 --- a/xfa/fxbarcode/cbc_datamatrix.h +++ b/xfa/fxbarcode/cbc_datamatrix.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_codebase.h" class CBC_DataMatrix : public CBC_CodeBase { diff --git a/xfa/fxbarcode/cbc_ean13.h b/xfa/fxbarcode/cbc_ean13.h index eaf95fe8ab..7c33f512a9 100644 --- a/xfa/fxbarcode/cbc_ean13.h +++ b/xfa/fxbarcode/cbc_ean13.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_onecode.h" class CBC_EAN13 : public CBC_OneCode { diff --git a/xfa/fxbarcode/cbc_ean8.h b/xfa/fxbarcode/cbc_ean8.h index fd582deb13..82fe0c167d 100644 --- a/xfa/fxbarcode/cbc_ean8.h +++ b/xfa/fxbarcode/cbc_ean8.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_onecode.h" class CBC_EAN8 : public CBC_OneCode { diff --git a/xfa/fxbarcode/cbc_pdf417i.h b/xfa/fxbarcode/cbc_pdf417i.h index 9ad387cada..f38b416170 100644 --- a/xfa/fxbarcode/cbc_pdf417i.h +++ b/xfa/fxbarcode/cbc_pdf417i.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_codebase.h" class CBC_PDF417I : public CBC_CodeBase { diff --git a/xfa/fxbarcode/cbc_qrcode.h b/xfa/fxbarcode/cbc_qrcode.h index ccf7d13beb..d77a23d4ab 100644 --- a/xfa/fxbarcode/cbc_qrcode.h +++ b/xfa/fxbarcode/cbc_qrcode.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_codebase.h" class CBC_QRCode : public CBC_CodeBase { diff --git a/xfa/fxbarcode/cbc_upca.h b/xfa/fxbarcode/cbc_upca.h index 1a94cfac0e..3e0d24a934 100644 --- a/xfa/fxbarcode/cbc_upca.h +++ b/xfa/fxbarcode/cbc_upca.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxbarcode/cbc_onecode.h" class CBC_UPCA : public CBC_OneCode { diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index e504f0bacb..15a1a1a6c7 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -7,7 +7,7 @@ #ifndef XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ #define XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" #include "xfa/fxbarcode/BC_Writer.h" #include "xfa/fxbarcode/include/BC_Library.h" diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 0c09830094..d040e0dd2b 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -7,8 +7,8 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "core/fxcrt/include/fx_xml.h" +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec.h" -#include "core/include/fxge/fx_ge.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" diff --git a/xfa/fxgraphics/cagg_graphics.h b/xfa/fxgraphics/cagg_graphics.h index d19773a42b..bac9c19167 100644 --- a/xfa/fxgraphics/cagg_graphics.h +++ b/xfa/fxgraphics/cagg_graphics.h @@ -7,7 +7,7 @@ #ifndef XFA_FXGRAPHICS_CAGG_GRAPHICS_H_ #define XFA_FXGRAPHICS_CAGG_GRAPHICS_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxgraphics/include/cfx_graphics.h" class CFX_Graphics; diff --git a/xfa/fxgraphics/cfx_color.h b/xfa/fxgraphics/cfx_color.h index 5ab99d8d87..3f6684dc63 100644 --- a/xfa/fxgraphics/cfx_color.h +++ b/xfa/fxgraphics/cfx_color.h @@ -7,7 +7,7 @@ #ifndef XFA_FXGRAPHICS_CFX_COLOR_H_ #define XFA_FXGRAPHICS_CFX_COLOR_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxgraphics/include/cfx_graphics.h" class CFX_Pattern; diff --git a/xfa/fxgraphics/cfx_path_generator.h b/xfa/fxgraphics/cfx_path_generator.h index efe316697d..02aa4230d5 100644 --- a/xfa/fxgraphics/cfx_path_generator.h +++ b/xfa/fxgraphics/cfx_path_generator.h @@ -7,7 +7,7 @@ #ifndef XFA_FXGRAPHICS_CFX_PATH_GENERATOR_H_ #define XFA_FXGRAPHICS_CFX_PATH_GENERATOR_H_ -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_ge.h" class CFX_PathGenerator { public: diff --git a/xfa/fxgraphics/cfx_shading.h b/xfa/fxgraphics/cfx_shading.h index 8bfd3ca9d4..302aa65be5 100644 --- a/xfa/fxgraphics/cfx_shading.h +++ b/xfa/fxgraphics/cfx_shading.h @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #define FX_SHADING_Steps 256 diff --git a/xfa/fxgraphics/include/cfx_graphics.h b/xfa/fxgraphics/include/cfx_graphics.h index be9176ebc2..1438acb7f4 100644 --- a/xfa/fxgraphics/include/cfx_graphics.h +++ b/xfa/fxgraphics/include/cfx_graphics.h @@ -8,8 +8,8 @@ #define XFA_FXGRAPHICS_INCLUDE_CFX_GRAPHICS_H_ #include "core/fxcrt/include/fx_system.h" -#include "core/include/fxge/fx_dib.h" -#include "core/include/fxge/fx_ge.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_ge.h" class CFX_Color; class CFX_Path; diff --git a/xfa/include/fxfa/fxfa_objectacc.h b/xfa/include/fxfa/fxfa_objectacc.h index 782b62f9d1..f6f48e96d4 100644 --- a/xfa/include/fxfa/fxfa_objectacc.h +++ b/xfa/include/fxfa/fxfa_objectacc.h @@ -7,7 +7,7 @@ #ifndef XFA_INCLUDE_FXFA_FXFA_OBJECTACC_H_ #define XFA_INCLUDE_FXFA_FXFA_OBJECTACC_H_ -#include "core/include/fxge/fx_dib.h" +#include "core/fxge/include/fx_dib.h" #include "xfa/fxfa/parser/xfa_object.h" class CXFA_Node; diff --git a/xfa/include/fxfa/xfa_ffwidget.h b/xfa/include/fxfa/xfa_ffwidget.h index f82bf2faf7..0690b7f3a1 100644 --- a/xfa/include/fxfa/xfa_ffwidget.h +++ b/xfa/include/fxfa/xfa_ffwidget.h @@ -9,8 +9,8 @@ #include +#include "core/fxge/include/fx_ge.h" #include "core/include/fxcodec/fx_codec_def.h" -#include "core/include/fxge/fx_ge.h" #include "xfa/fxfa/parser/xfa_doclayout.h" #include "xfa/include/fxfa/fxfa.h" -- cgit v1.2.3